changeset 20641:3db9e798e004

copies: when both sides made the same copy, report it as a copy Not used yet ... but shows up in debug output.
author Mads Kiilerich <madski@unity3d.com>
date Tue, 25 Feb 2014 20:29:14 +0100
parents 52929dcdd512
children 0dc7a50345c2
files mercurial/copies.py tests/test-rename-merge2.t tests/test-up-local-change.t
diffstat 3 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Sun Mar 02 18:36:02 2014 +0100
+++ b/mercurial/copies.py	Tue Feb 25 20:29:14 2014 +0100
@@ -262,6 +262,18 @@
         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")
--- a/tests/test-rename-merge2.t	Sun Mar 02 18:36:02 2014 +0100
+++ b/tests/test-rename-merge2.t	Tue Feb 25 20:29:14 2014 +0100
@@ -335,6 +335,8 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
      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' *
--- a/tests/test-up-local-change.t	Sun Mar 02 18:36:02 2014 +0100
+++ b/tests/test-up-local-change.t	Tue Feb 25 20:29:14 2014 +0100
@@ -176,6 +176,8 @@
   [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