martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers.
REVISION SUMMARY When both sides of a merge have renamed a file to the same place, we would treat that as a "both created" action in merge.py. That means that we'd use an empty diffbase. It seems better to use the copy source as diffbase. That can be done by simply dropping code that prevented us from doing that. I think I did it that way in 57203e0210f8 <https://phab.mercurial-scm.org/rHG57203e0210f832b34438534770a583de35d0d6c6> (copies: calculate mergecopies() based on pathcopies(), 2019-04-11) only to preserve the existing behavior. I also suspect it was just an accident that it behaved that way before that commit. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D7974 AFFECTED FILES mercurial/copies.py tests/test-rename-merge2.t CHANGE DETAILS diff --git a/tests/test-rename-merge2.t b/tests/test-rename-merge2.t --- a/tests/test-rename-merge2.t +++ b/tests/test-rename-merge2.t @@ -513,7 +513,7 @@ test L:nc a b R:up a b W: - 14 merge b no ancestor -------------- all copies found (* = to merge, ! = divergent, % = renamed and deleted): - src: 'a' -> dst: 'b' + src: 'a' -> dst: 'b' * checking for directory renames resolving manifests branchmerge: True, force: False, partial: False @@ -522,19 +522,15 @@ preserving rev for resolve of rev a: remote is newer -> g getting a - b: both created -> m (premerge) + b: both renamed from a -> m (premerge) picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob) merging b - my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000 + my b@86a2aa42fc76+ other b@8dbce441892a ancestor a@924404dff337 + premerge successful rev: versions differ -> m (premerge) picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob) merging rev my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337 - b: both created -> m (merge) - picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob) - my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000 - launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob) - merge tool returned: 0 rev: versions differ -> m (merge) picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob) my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337 @@ -593,7 +589,7 @@ test L:nc a b R:up a b W: - 16 get a, merge b no ancestor -------------- all copies found (* = to merge, ! = divergent, % = renamed and deleted): - src: 'a' -> dst: 'b' + src: 'a' -> dst: 'b' * checking for directory renames resolving manifests branchmerge: True, force: False, partial: False @@ -602,19 +598,15 @@ preserving rev for resolve of rev a: remote is newer -> g getting a - b: both created -> m (premerge) + b: both renamed from a -> m (premerge) picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob) merging b - my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000 + my b@86a2aa42fc76+ other b@8dbce441892a ancestor a@924404dff337 + premerge successful rev: versions differ -> m (premerge) picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob) merging rev my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337 - b: both created -> m (merge) - picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob) - my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000 - launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob) - merge tool returned: 0 rev: versions differ -> m (merge) picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob) my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337 @@ -633,7 +625,7 @@ test L:up a b R:nc a b W: - 17 keep a, merge b no ancestor -------------- all copies found (* = to merge, ! = divergent, % = renamed and deleted): - src: 'a' -> dst: 'b' + src: 'a' -> dst: 'b' * checking for directory renames resolving manifests branchmerge: True, force: False, partial: False @@ -641,19 +633,15 @@ preserving b for resolve of b preserving rev for resolve of rev starting 4 threads for background file closing (?) - b: both created -> m (premerge) + b: both renamed from a -> m (premerge) picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob) merging b - my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000 + my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor a@924404dff337 + premerge successful rev: versions differ -> m (premerge) picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob) merging rev my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337 - b: both created -> m (merge) - picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob) - my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000 - launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob) - merge tool returned: 0 rev: versions differ -> m (merge) picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob) my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337 @@ -672,7 +660,7 @@ test L:nm a b R:up a b W: - 18 merge b no ancestor -------------- all copies found (* = to merge, ! = divergent, % = renamed and deleted): - src: 'a' -> dst: 'b' + src: 'a' -> dst: 'b' * checking for directory renames resolving manifests branchmerge: True, force: False, partial: False @@ -680,35 +668,24 @@ preserving b for resolve of b preserving rev for resolve of rev starting 4 threads for background file closing (?) - a: prompt deleted/changed -> m (premerge) - picked tool ':prompt' for a (binary False symlink False changedelete True) - file 'a' was deleted in local [working copy] but was modified in other [merge rev]. - You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved. - What do you want to do? u - b: both created -> m (premerge) + b: both renamed from a -> m (premerge) picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob) merging b - my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000 + my b@02963e448370+ other b@8dbce441892a ancestor a@924404dff337 + premerge successful rev: versions differ -> m (premerge) picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob) merging rev my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337 - b: both created -> m (merge) - picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob) - my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000 - launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob) - merge tool returned: 0 rev: versions differ -> m (merge) picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob) my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob) merge tool returned: 0 - 0 files updated, 2 files merged, 0 files removed, 1 files unresolved - use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon + 0 files updated, 2 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) -------------- - M a M b - abort: unresolved merge conflicts (see 'hg help resolve') -------------- $ tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a" @@ -717,44 +694,33 @@ test L:up a b R:nm a b W: - 19 merge b no ancestor, prompt remove a -------------- all copies found (* = to merge, ! = divergent, % = renamed and deleted): - src: 'a' -> dst: 'b' + src: 'a' -> dst: 'b' * checking for directory renames resolving manifests branchmerge: True, force: False, partial: False ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a - preserving a for resolve of a preserving b for resolve of b preserving rev for resolve of rev + b: both renamed from a -> m (premerge) starting 4 threads for background file closing (?) - a: prompt changed/deleted -> m (premerge) - picked tool ':prompt' for a (binary False symlink False changedelete True) - file 'a' was deleted in other [merge rev] but was modified in local [working copy]. - You can use (c)hanged version, (d)elete, or leave (u)nresolved. - What do you want to do? u - b: both created -> m (premerge) picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob) merging b - my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000 + my b@0b76e65c8289+ other b@bdb19105162a ancestor a@924404dff337 + premerge successful rev: versions differ -> m (premerge) picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob) merging rev my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337 - b: both created -> m (merge) - picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob) - my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000 - launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob) - merge tool returned: 0 rev: versions differ -> m (merge) picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob) my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob) merge tool returned: 0 - 0 files updated, 2 files merged, 0 files removed, 1 files unresolved - use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon + 0 files updated, 2 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) -------------- M b C a - abort: unresolved merge conflicts (see 'hg help resolve') -------------- $ tm "up a " "um a b" " " "20 merge a and b to b, remove a" diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -542,10 +542,7 @@ return # modified on side 2 for dst in dsts1: - if dst not in m2: - # dst not added on side 2 (handle as regular - # "both created" case in manifestmerge otherwise) - copy[dst] = src + copy[dst] = src def _fullcopytracing(repo, c1, c2, base): To: martinvonz, #hg-reviewers Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel