# HG changeset patch # User Mads Kiilerich # Date 2014-02-25 19:29:14 # Node ID 3db9e798e004525ff544cffe20c5faa7c7136d46 # Parent 52929dcdd512c266d4e61668e8514894792f70fa copies: when both sides made the same copy, report it as a copy Not used yet ... but shows up in debug output. diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -262,6 +262,18 @@ def mergecopies(repo, c1, c2, ca): else: diverge2.update(fl) # reverse map for below + bothnew = sorted([d for d in m1 if d in m2 and d not in ma]) + if bothnew: + repo.ui.debug(" unmatched files new in both:\n %s\n" + % "\n ".join(bothnew)) + bothdiverge, _copy, _fullcopy = {}, {}, {} + for f in bothnew: + checkcopies(ctx, f, m1, m2, ca, limit, bothdiverge, _copy, _fullcopy) + checkcopies(ctx, f, m2, m1, ca, limit, bothdiverge, _copy, _fullcopy) + for of, fl in bothdiverge.items(): + if len(fl) == 2 and fl[0] == fl[1]: + copy[fl[0]] = of # not actually divergent, just matching renames + if fullcopy: repo.ui.debug(" all copies found (* = to merge, ! = divergent, " "% = renamed and deleted):\n") 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 @@ -335,6 +335,8 @@ args: test L:um a b R:um a b W: - 9 do merge with ancestor in a -------------- searching for copies back to rev 1 + unmatched files new in both: + b resolving manifests branchmerge: True, force: False, partial: False ancestor: 924404dff337, local: 62e7bf090eba+, remote: 49b6d8032493 @@ -403,6 +405,8 @@ m "um a c" "um x c" " " "10 do merg test L:nc a b R:up b W: - 12 merge b no ancestor -------------- searching for copies back to rev 1 + unmatched files new in both: + b resolving manifests branchmerge: True, force: False, partial: False ancestor: 924404dff337, local: 86a2aa42fc76+, remote: af30c7647fc7 @@ -431,6 +435,8 @@ m "um a c" "um x c" " " "10 do merg test L:up b R:nm a b W: - 13 merge b no ancestor -------------- searching for copies back to rev 1 + unmatched files new in both: + b resolving manifests branchmerge: True, force: False, partial: False ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a @@ -461,6 +467,8 @@ m "um a c" "um x c" " " "10 do merg test L:nc a b R:up a b W: - 14 merge b no ancestor -------------- searching for copies back to rev 1 + unmatched files new in both: + b resolving manifests branchmerge: True, force: False, partial: False ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a @@ -492,6 +500,8 @@ m "um a c" "um x c" " " "10 do merg test L:up b R:nm a b W: - 15 merge b no ancestor, remove a -------------- searching for copies back to rev 1 + unmatched files new in both: + b resolving manifests branchmerge: True, force: False, partial: False ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a @@ -522,6 +532,8 @@ m "um a c" "um x c" " " "10 do merg test L:nc a b R:up a b W: - 16 get a, merge b no ancestor -------------- searching for copies back to rev 1 + unmatched files new in both: + b resolving manifests branchmerge: True, force: False, partial: False ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a @@ -553,6 +565,8 @@ m "um a c" "um x c" " " "10 do merg test L:up a b R:nc a b W: - 17 keep a, merge b no ancestor -------------- searching for copies back to rev 1 + unmatched files new in both: + b resolving manifests branchmerge: True, force: False, partial: False ancestor: 924404dff337, local: 0b76e65c8289+, remote: 4ce40f5aca24 @@ -581,6 +595,8 @@ m "um a c" "um x c" " " "10 do merg test L:nm a b R:up a b W: - 18 merge b no ancestor -------------- searching for copies back to rev 1 + unmatched files new in both: + b resolving manifests branchmerge: True, force: False, partial: False ancestor: 924404dff337, local: 02963e448370+, remote: 8dbce441892a @@ -614,6 +630,8 @@ m "um a c" "um x c" " " "10 do merg test L:up a b R:nm a b W: - 19 merge b no ancestor, prompt remove a -------------- searching for copies back to rev 1 + unmatched files new in both: + b resolving manifests branchmerge: True, force: False, partial: False ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a @@ -802,6 +820,9 @@ 8 f (f) f f "remote differs from 3/g 4/g 7/f + unmatched files new in both: + 0/f + 1/g all copies found (* = to merge, ! = divergent, % = renamed and deleted): src: '3/f' -> dst: '3/g' * src: '4/f' -> dst: '4/g' * diff --git a/tests/test-up-local-change.t b/tests/test-up-local-change.t --- a/tests/test-up-local-change.t +++ b/tests/test-up-local-change.t @@ -176,6 +176,8 @@ create a second head [255] $ hg --debug merge -f searching for copies back to rev 1 + unmatched files new in both: + b resolving manifests branchmerge: True, force: True, partial: False ancestor: c19d34741b0a, local: 1e71731e6fbb+, remote: 83c51d0caff4