monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] Automatic (and incorrect) resolution of an ambiguous me


From: Daniel THOMPSON
Subject: [Monotone-devel] Automatic (and incorrect) resolution of an ambiguous merge (monotone 0.35)
Date: Tue, 31 Jul 2007 15:57:00 +0100
User-agent: Thunderbird 2.0.0.5 (X11/20070719)

Hi Folks

[Sorry if anyone receives this twice, original version had binary
attachment (monotone database) and I think it was therefore ruled out of
order by the mailing list.]

We stumbled upon this small issue with the monotone merge algorithm the
other day. Basically we created divergence where one branch replaced a
line and the other branch, immediately after the replaced line, inserted
some new code. The resolution of such a conflict is ambiguous since it
is not possible to determine the order of the replaced line versus the
new code.

Monotone (0.35) merges changes like this without flagging a conflict
(and oddly enough by inserting the new code *before* the replaced line).

My opinion is that it should offered me the change to merge manually.

Below are instructions to reproduce. If any one wants it I can send the
 database before I did the merge. (you can see me backup the database in
the instructions below).

--- cut here ---

# Setup

butch$ mtn db init --db=manualmerge.mtn
butch$ mkdir manualmerge
butch$ cd manualmerge
butch$ mtn setup . --db=../manualmerge.mtn
--branch=com.st.manualmerge.testcase

# Create an ancestor revision

butch$ cp ../common.c manualmerge.c
butch$ cat manualmerge.c
void manual_merge(void)
{
        // part 1
        if (test())
                part1();

        // part 3
        part3();
}
butch$ mtn add manualmerge.c
mtn: adding manualmerge.c to workspace manifest
butch$ mtn commit --message="Common ancestor"
mtn: beginning commit on branch 'com.st.manualmerge.testcase'
mtn: committed revision ad4a04dd12b6120673237add90e0c44c877da58e

# Create a child revision with a debug statement added in part 1

butch$ vi manualmerge.c
butch$ cat manualmerge.c
void manual_merge(void)
{
        // part 1
        if (test())
        {
                debug_statement();
                part1();
        }
        // part 3
        part3();
}
butch$ mtn commit --message="Left child"
mtn: beginning commit on branch 'com.st.manualmerge.testcase'
mtn: committed revision 8503573e40708e3223815494cd5b23d22e9bec3b

# Create a child revision is a branch new part 2
butch$ mtn update -r ad4a04dd12b6120673237add90e0c44c877da58e
mtn: selected update target ad4a04dd12b6120673237add90e0c44c877da58e
mtn: modifying manualmerge.c
mtn: updated to base revision ad4a04dd12b6120673237add90e0c44c877da58e
butch$ vi manualmerge.c
butch$ cat manualmerge.c
void manual_merge(void)
{
        // part 1
        if (test())
                part1();

        // part 2
        part2();

        // part 3
        part3();
}
butch$ mtn commit --message="Right child"
mtn: beginning commit on branch 'com.st.manualmerge.testcase'
mtn: committed revision 56ade8ce856c2d8d863154a31eedf59fa64c6070
mtn: note: this revision creates divergence
mtn: note: you may (or may not) wish to run 'mtn merge'

# Merge the revisions. The believe the request to be ambiguous because both
# revisions insert lines code after 'part1()' and before '// part 3' and was
# therefore puzzled not to get a manual merge.

butch$ cp ../manualmerge.mtn ../manualmerge.mtn.bak
butch$ mtn merge
mtn: 2 heads on branch 'com.st.manualmerge.testcase'
mtn: [left]  56ade8ce856c2d8d863154a31eedf59fa64c6070
mtn: [right] 8503573e40708e3223815494cd5b23d22e9bec3b
mtmtn: [merged] ba67776440ae60d8e516e1496951df7da60474ad
mtn: note: your workspaces have not been updated
butch$ mtn update
mtn: updating along branch 'com.st.manualmerge.testcase'
mtn: selected update target ba67776440ae60d8e516e1496951df7da60474ad
mtn: modifying manualmerge.c
mtn: updated to base revision ba67776440ae60d8e516e1496951df7da60474ad

# Monotone has merged them into something compilable but broken without
a merge
# conflict.

butch$ cat manualmerge.c
void manual_merge(void)
{
        // part 1
        if (test())
        {
                debug_statement();
                part1();

        // part 2
        part2();
        }
        // part 3
        part3();
}

-- 
Daniel Thompson (STMicroelectronics) <address@hidden>
1000 Aztec West, Almondsbury, Bristol, BS32 4SQ. 01454 462659

If a car is a horseless carriage then is a motorcycle a horseless horse?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]