[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone.issue-209: be008714e09af86a7
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone.issue-209: be008714e09af86a72e27ae7044cb85b9e689909 |
Date: |
Sun, 3 Jun 2012 17:47:17 +0200 (CEST) |
revision: be008714e09af86a72e27ae7044cb85b9e689909
date: 2012-05-27T16:15:03
author: address@hidden
branch: net.venge.monotone.issue-209
changelog:
dropped_modified conflicts; better implementation. Still failing due to history
of drop.
* src/merge_roster.cc (assign_name): handle dropped_modified conflicts here,
not higher up.
* test/func/resolve_conflicts_dropped_modified/conflicts-resolved:
* test/func/resolve_conflicts_dropped_modified/conflicts:
* test/func/resolve_conflicts_dropped_modified/__driver__.lua: use 6 conflicts
to cover all left/right cases
manifest:
format_version "1"
new_manifest [86cda21fd0f81e3af799eb6dc9aa63c435032ef5]
old_revision [898bc317e5a1db50c15daa6038a4cecc6d4e8230]
patch "src/merge_roster.cc"
from [2eadb8046723bafb4a41f36d439abccc68f3f2fd]
to [4db179b2bb8e140d9ff9bd49f09306c578348759]
patch "test/func/resolve_conflicts_dropped_modified/__driver__.lua"
from [bef29a13e2c5cd3b053e3b6905506a8e3341f68b]
to [939ea819f903966c0d0cf89ceb8375d5f2c40e6c]
patch "test/func/resolve_conflicts_dropped_modified/conflicts"
from [b791de2fc74adc9d489666b7ab097bb229dc4b5f]
to [a175b596bc382b62b1646b03e9b8532cf2a19ac4]
patch "test/func/resolve_conflicts_dropped_modified/conflicts-resolved"
from [3e6671f4e719c9171bdd0cb9bbe9f4b5db57b2eb]
to [249596c1618ef57e6d800845d0caebe31e748143]
============================================================
--- src/merge_roster.cc 2eadb8046723bafb4a41f36d439abccc68f3f2fd
+++ src/merge_roster.cc 4db179b2bb8e140d9ff9bd49f09306c578348759
@@ -489,6 +489,15 @@ namespace
result.directory_loop_conflicts.push_back(c);
return;
}
+
+ if (result.dropped_modified_conflicts.end() !=
+ find(result.dropped_modified_conflicts.begin(),
+ result.dropped_modified_conflicts.end(),
+ nid))
+ {
+ // conflict already entered, just don't attach
+ return;
+ }
}
// hey, we actually made it. attach the node!
result.roster.attach_node(nid, parent, name);
@@ -577,20 +586,13 @@ roster_merge(roster_t const & left_paren
{
node_t const & left_n = i.left_data();
// we skip nodes that aren't in the result roster (were
- // deleted in the lifecycles step above), or that have
- // dropped_modified conflicts.
+ // deleted in the lifecycles step above)
if (result.roster.has_node(left_n->self))
{
- if (result.dropped_modified_conflicts.end() ==
- find(result.dropped_modified_conflicts.begin(),
- result.dropped_modified_conflicts.end(),
- left_n->self))
- {
- // attach this node from the left roster. this may cause
- // a name collision with the previously attached node from
- // the other side of the merge.
- copy_node_forward(result, new_i->second, left_n, left_side);
- }
+ // attach this node from the left roster. this may cause
+ // a name collision with the previously attached node from
+ // the other side of the merge.
+ copy_node_forward(result, new_i->second, left_n, left_side);
++new_i;
}
++left_mi;
@@ -600,20 +602,13 @@ roster_merge(roster_t const & left_paren
case parallel::in_right:
{
node_t const & right_n = i.right_data();
- // we skip nodes that aren't in the result roster, or that have
- // dropped_modified conflicts.
+ // we skip nodes that aren't in the result roster
if (result.roster.has_node(right_n->self))
{
- if (result.dropped_modified_conflicts.end() ==
- find(result.dropped_modified_conflicts.begin(),
- result.dropped_modified_conflicts.end(),
- right_n->self))
- {
- // attach this node from the right roster. this may cause
- // a name collision with the previously attached node from
- // the other side of the merge.
- copy_node_forward(result, new_i->second, right_n, right_side);
- }
+ // attach this node from the right roster. this may cause
+ // a name collision with the previously attached node from
+ // the other side of the merge.
+ copy_node_forward(result, new_i->second, right_n, right_side);
++new_i;
}
++right_mi;
============================================================
--- test/func/resolve_conflicts_dropped_modified/__driver__.lua bef29a13e2c5cd3b053e3b6905506a8e3341f68b
+++ test/func/resolve_conflicts_dropped_modified/__driver__.lua 939ea819f903966c0d0cf89ceb8375d5f2c40e6c
@@ -5,46 +5,58 @@ mtn_setup()
-- Create conflicts; modify and rename file in one head, drop in
-- other.
--
--- Three conflicts to test the three possible resolutions, and
--- left/right swap.
+-- Six conflicts to test the three possible resolutions, with drop on
+-- both left and right. Number in file name is the node number (helps
+-- in debugging; node 1 is the root directory).
-addfile("foo", "foo base")
-addfile("file_2", "file_2 base")
-addfile("file_3", "file_3 base")
+addfile("file_2", "file_2 base") -- modify/rename left, drop right; drop
+addfile("file_3", "file_3 base") -- drop left, modify/rename right; drop
+addfile("file_4", "file_4 base") -- modify left, drop right; keep
+addfile("file_5", "file_5 base") -- drop left, modify right; keep
+addfile("file_6", "file_6 base") -- modify/rename left, drop right; user
+addfile("file_7", "file_7 base") -- drop left, modify/rename right; user
commit("testbranch", "base")
base = base_revision()
-writefile("foo", "foo left")
-check(mtn("mv", "foo", "bar"), 0, false, false)
+writefile("file_2", "file_2 left")
+check(mtn("mv", "file_2", "file_2_renamed"), 0, false, false)
-writefile("file_2", "file_2 left")
-writefile("file_3", "file_3 left")
+check(mtn("drop", "file_3"), 0, false, false)
+writefile("file_4", "file_4 left")
+
+check(mtn("drop", "file_5"), 0, false, false)
+
+writefile("file_6", "file_6 left")
+check(mtn("mv", "file_6", "file_6_renamed"), 0, false, false)
+
+check(mtn("drop", "file_7"), 0, false, false)
+
commit("testbranch", "left 1")
left_1 = base_revision()
-check(mtn("drop", "file_3"), 0, false, false)
-commit("testbranch", "left 2")
-left_2 = base_revision()
-
revert_to(base)
-writefile("foo", "foo right")
-writefile("file_2", "file_2 right")
+check(mtn("drop", "file_2"), 0, false, false)
+
writefile("file_3", "file_3 right")
+check(mtn("mv", "file_3", "file_3_renamed"), 0, false, false)
-commit("testbranch", "right 1")
-right_1 = base_revision()
+check(mtn("drop", "file_4"), 0, false, false)
-check(mtn("drop", "foo"), 0, false, false)
-check(mtn("drop", "file_2"), 0, false, false)
-commit("testbranch", "right 2")
-right_2 = base_revision()
+writefile("file_5", "file_5 right")
+check(mtn("drop", "file_6"), 0, false, false)
-check(mtn("conflicts", "store", left_2, right_2), 0, nil, true)
+writefile("file_7", "file_7 right")
+check(mtn("mv", "file_7", "file_7_renamed"), 0, false, false)
+
+commit("testbranch", "right 1")
+right_1 = base_revision()
+
+check(mtn("conflicts", "store", left_1, right_1), 0, nil, true)
check(samelines("stderr",
-{"mtn: 3 conflicts with supported resolutions.",
+{"mtn: 6 conflicts with supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
canonicalize("_MTN/conflicts")
@@ -52,7 +64,7 @@ check(samelines("stderr",
check(mtn("conflicts", "show_first"), 0, nil, true)
check(samelines("stderr",
-{"mtn: conflict: file 'file_2'",
+{"mtn: conflict: file 'file_2_renamed'",
"mtn: modified on the left",
"mtn: dropped on the right",
"mtn: possible resolutions:",
@@ -60,15 +72,16 @@ check(samelines("stderr",
"mtn: resolve_first keep",
"mtn: resolve_first user \"name\""}))
-check(mtn("conflicts", "resolve_first", "keep"), 0, nil, true)
+check(mtn("conflicts", "resolve_first", "drop"), 0, nil, true)
--- check for nice error message if not all conflicts are resolved
-check(mtn("merge", "--resolve-conflicts"), 1, nil, true)
+-- check for nice error message if not all dropped_modified conflicts are resolved
+-- we have to use explicit_merge to get left/right to match 'conflicts store'
+check(mtn("explicit_merge", "--resolve-conflicts", left_1, right_1, "testbranch"), 1, nil, true)
check(qgrep("no resolution provided for", "stderr"))
check(mtn("conflicts", "show_first"), 0, nil, true)
check(samelines("stderr",
-{"mtn: conflict: file 'file_3'",
+{"mtn: conflict: file 'file_3_renamed'",
"mtn: dropped on the left",
"mtn: modified on the right",
"mtn: possible resolutions:",
@@ -76,13 +89,11 @@ check(samelines("stderr",
"mtn: resolve_first keep",
"mtn: resolve_first user \"name\""}))
-mkdir("_MTN/resolutions")
-writefile("_MTN/resolutions/file_3_resolved", "file_3 resolved")
-check(mtn("conflicts", "resolve_first", "user", "file_3_resolved"), 0, nil, true)
+check(mtn("conflicts", "resolve_first", "drop"), 0, nil, true)
check(mtn("conflicts", "show_first"), 0, nil, true)
check(samelines("stderr",
-{"mtn: conflict: file 'bar'",
+{"mtn: conflict: file 'file_4'",
"mtn: modified on the left",
"mtn: dropped on the right",
"mtn: possible resolutions:",
@@ -90,15 +101,61 @@ check(samelines("stderr",
"mtn: resolve_first keep",
"mtn: resolve_first user \"name\""}))
-check(mtn("conflicts", "resolve_first", "drop"), 0, nil, true)
+check(mtn("conflicts", "resolve_first", "keep"), 0, nil, true)
+check(mtn("conflicts", "show_first"), 0, nil, true)
+check(samelines("stderr",
+{"mtn: conflict: file 'file_5'",
+ "mtn: dropped on the left",
+ "mtn: modified on the right",
+ "mtn: possible resolutions:",
+ "mtn: resolve_first drop",
+ "mtn: resolve_first keep",
+ "mtn: resolve_first user \"name\""}))
+
+check(mtn("conflicts", "resolve_first", "keep"), 0, nil, true)
+
+check(mtn("conflicts", "show_first"), 0, nil, true)
+check(samelines("stderr",
+{"mtn: conflict: file 'file_6_renamed'",
+ "mtn: modified on the left",
+ "mtn: dropped on the right",
+ "mtn: possible resolutions:",
+ "mtn: resolve_first drop",
+ "mtn: resolve_first keep",
+ "mtn: resolve_first user \"name\""}))
+
+mkdir("_MTN/resolutions")
+writefile("_MTN/resolutions/file_6_resolved", "file_6 resolved")
+check(mtn("conflicts", "resolve_first", "user", "_MTN/resolutions/file_6_resolved"), 0, nil, true)
+
+check(mtn("conflicts", "show_first"), 0, nil, true)
+check(samelines("stderr",
+{"mtn: conflict: file 'file_7_renamed'",
+ "mtn: dropped on the left",
+ "mtn: modified on the right",
+ "mtn: possible resolutions:",
+ "mtn: resolve_first drop",
+ "mtn: resolve_first keep",
+ "mtn: resolve_first user \"name\""}))
+
+mkdir("_MTN/resolutions")
+writefile("_MTN/resolutions/file_7_resolved", "file_7 resolved")
+check(mtn("conflicts", "resolve_first", "user", "_MTN/resolutions/file_7_resolved"), 0, nil, true)
+
canonicalize("_MTN/conflicts")
check(samefilestd("conflicts-resolved", "_MTN/conflicts"))
-check(mtn("merge", "--resolve-conflicts"), 0, nil, true)
-check(qgrep("dropping 'bar'", "stderr"))
-check(qgrep("keeping 'file_2'", "stderr"))
-check(qgrep("replacing 'file_3' with '_MTN/resolutions/file_3_resolved", "stderr"))
+-- we have to use explicit_merge to get left/right to match 'conflicts store'
+check(mtn("explicit_merge", "--resolve-conflicts", left_1, right_1, "testbranch"), 0, nil, true)
+check(qgrep("dropping 'file_2_renamed'", "stderr"))
+check(qgrep("dropping 'file_3_renamed'", "stderr"))
+check(qgrep("keeping 'file_4'", "stderr"))
+check(qgrep("keeping 'file_5'", "stderr"))
+check(qgrep("replacing 'file_6_renamed' with '_MTN/resolutions/file_6_resolved", "stderr"))
+check(qgrep("replacing 'file_7_renamed' with '_MTN/resolutions/file_7_resolved", "stderr"))
+
-- FIXME: add dropped_modified to 'show_conflicts' test (etc?)
+-- better to put those tests here
-- end of file
============================================================
--- test/func/resolve_conflicts_dropped_modified/conflicts b791de2fc74adc9d489666b7ab097bb229dc4b5f
+++ test/func/resolve_conflicts_dropped_modified/conflicts a175b596bc382b62b1646b03e9b8532cf2a19ac4
@@ -1,12 +1,12 @@
- left [2e6a6ed9d74c90369818dd6e8f0c99244243b05d]
- right [c24409a7b849994b403befa5ba9bccb0b0208aa4]
-ancestor [5737187332315f436eab91e5d3fafd966c57c330]
+ left [f675f3440ebd978fffba5d990e8c876ae9470aa3]
+ right [3b44e67a00d6f2ef92279d5fd07b46cc175b3291]
+ancestor [c2fe3623ce72d248154425dc7db2ddcc397c9aca]
conflict dropped_modified
ancestor_name "file_2"
ancestor_file_id [4fd0fa24812427ee6c13a839d2a90bc0c6fc0091]
left_type "modified file"
- left_name "file_2"
+ left_name "file_2_renamed"
left_file_id [afbd804a8c606a93f9d8bc0fdacc1db9f34b4548]
right_type "dropped file"
@@ -15,13 +15,37 @@ ancestor_file_id [311aac8e6f1fb6fca84da5
ancestor_file_id [311aac8e6f1fb6fca84da5153aa6d5a1c6faff79]
left_type "dropped file"
right_type "modified file"
- right_name "file_3"
+ right_name "file_3_renamed"
right_file_id [da7ea65160c9c92f4ed120568229342fe7daa924]
conflict dropped_modified
- ancestor_name "foo"
-ancestor_file_id [b02b6245b4b750465e12f65148d5369536b1b780]
+ ancestor_name "file_4"
+ancestor_file_id [861174e6639f2991d9c065785cd9679be0c774f1]
left_type "modified file"
- left_name "bar"
- left_file_id [abd7d750f84aafa7c0b1f26540e2da28095bc082]
+ left_name "file_4"
+ left_file_id [57f26e8057760f356762c405bdc1f89b0a9bfed2]
right_type "dropped file"
+
+ conflict dropped_modified
+ ancestor_name "file_5"
+ancestor_file_id [d141bda733292622ebce4c231cbb0da44ac59f40]
+ left_type "dropped file"
+ right_type "modified file"
+ right_name "file_5"
+ right_file_id [e7eb31ab48c2e42126f44ef78ffdb27f388333b0]
+
+ conflict dropped_modified
+ ancestor_name "file_6"
+ancestor_file_id [d5531643d3b5aee3e10eceabbdfecf167148a2d9]
+ left_type "modified file"
+ left_name "file_6_renamed"
+ left_file_id [1f62c734b799474943bfdda12b062f61024dc059]
+ right_type "dropped file"
+
+ conflict dropped_modified
+ ancestor_name "file_7"
+ancestor_file_id [1a9d3059360fd5f04d0cec05875c8e376da0eaef]
+ left_type "dropped file"
+ right_type "modified file"
+ right_name "file_7_renamed"
+ right_file_id [9b362e2754ea1f943497d5a31de3899271ee5a8b]
============================================================
--- test/func/resolve_conflicts_dropped_modified/conflicts-resolved 3e6671f4e719c9171bdd0cb9bbe9f4b5db57b2eb
+++ test/func/resolve_conflicts_dropped_modified/conflicts-resolved 249596c1618ef57e6d800845d0caebe31e748143
@@ -1,30 +1,57 @@
- left [2e6a6ed9d74c90369818dd6e8f0c99244243b05d]
- right [c24409a7b849994b403befa5ba9bccb0b0208aa4]
-ancestor [5737187332315f436eab91e5d3fafd966c57c330]
+ left [f675f3440ebd978fffba5d990e8c876ae9470aa3]
+ right [3b44e67a00d6f2ef92279d5fd07b46cc175b3291]
+ancestor [c2fe3623ce72d248154425dc7db2ddcc397c9aca]
conflict dropped_modified
ancestor_name "file_2"
ancestor_file_id [4fd0fa24812427ee6c13a839d2a90bc0c6fc0091]
left_type "modified file"
- left_name "file_2"
+ left_name "file_2_renamed"
left_file_id [afbd804a8c606a93f9d8bc0fdacc1db9f34b4548]
right_type "dropped file"
-resolved_keep_left
+resolved_drop_left
conflict dropped_modified
ancestor_name "file_3"
ancestor_file_id [311aac8e6f1fb6fca84da5153aa6d5a1c6faff79]
left_type "dropped file"
right_type "modified file"
- right_name "file_3"
+ right_name "file_3_renamed"
right_file_id [da7ea65160c9c92f4ed120568229342fe7daa924]
-resolved_user_left "_MTN/resolutions/file_3_resolved"
+resolved_drop_left
conflict dropped_modified
- ancestor_name "foo"
- ancestor_file_id [b02b6245b4b750465e12f65148d5369536b1b780]
+ ancestor_name "file_4"
+ ancestor_file_id [861174e6639f2991d9c065785cd9679be0c774f1]
left_type "modified file"
- left_name "bar"
- left_file_id [abd7d750f84aafa7c0b1f26540e2da28095bc082]
+ left_name "file_4"
+ left_file_id [57f26e8057760f356762c405bdc1f89b0a9bfed2]
right_type "dropped file"
-resolved_drop_left
+resolved_keep_left
+
+ conflict dropped_modified
+ ancestor_name "file_5"
+ ancestor_file_id [d141bda733292622ebce4c231cbb0da44ac59f40]
+ left_type "dropped file"
+ right_type "modified file"
+ right_name "file_5"
+ right_file_id [e7eb31ab48c2e42126f44ef78ffdb27f388333b0]
+resolved_keep_left
+
+ conflict dropped_modified
+ ancestor_name "file_6"
+ ancestor_file_id [d5531643d3b5aee3e10eceabbdfecf167148a2d9]
+ left_type "modified file"
+ left_name "file_6_renamed"
+ left_file_id [1f62c734b799474943bfdda12b062f61024dc059]
+ right_type "dropped file"
+resolved_user_left "_MTN/resolutions/file_6_resolved"
+
+ conflict dropped_modified
+ ancestor_name "file_7"
+ ancestor_file_id [1a9d3059360fd5f04d0cec05875c8e376da0eaef]
+ left_type "dropped file"
+ right_type "modified file"
+ right_name "file_7_renamed"
+ right_file_id [9b362e2754ea1f943497d5a31de3899271ee5a8b]
+resolved_user_left "_MTN/resolutions/file_7_resolved"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone.issue-209: be008714e09af86a72e27ae7044cb85b9e689909,
code <=