[PATCH] merge: make 'diverging renames' diagnostic more helpful

Dan Villiom Podlaski Christiansen danchr at gmail.com
Sun Oct 10 11:22:20 CDT 2010


# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1286722225 18000
# Node ID aa8cc44039059829012b8d80422b238372037e7e
# Parent  6312574dece08bceda8cc75dac8c3de0857cb7b0
merge: make 'diverging renames' diagnostic more helpful.

See the Hg Book on why we actually want to detect this case:
http://hgbook.red-bean.com/read/mercurial-in-daily-use.html#id364290

Before:

$ hg up deadbeef
warning: detected divergent renames of X to:
...

After:

$ hg up deadbeef
warning: possible conflict - X was renamed multiple times to:
...

No functionality change.

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -354,7 +354,8 @@ def applyupdates(repo, action, wctx, mct
             updated += 1
         elif m == "dr": # divergent renames
             fl = a[2]
-            repo.ui.warn(_("warning: detected divergent renames of %s to:\n") % f)
+            repo.ui.warn(_("warning: possible conflict - %s was renamed "
+                           "multiple times to:\n") % f)
             for nf in fl:
                 repo.ui.warn(" %s\n" % nf)
         elif m == "e": # exec
diff --git a/tests/test-bundle-r.t b/tests/test-bundle-r.t
--- a/tests/test-bundle-r.t
+++ b/tests/test-bundle-r.t
@@ -340,7 +340,7 @@ revision 4
 
   $ cd ../test
   $ hg merge 7
-  warning: detected divergent renames of afile to:
+  warning: possible conflict - afile was renamed multiple times to:
    anotherfile
    adifferentfile
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-issue1175.t b/tests/test-issue1175.t
--- a/tests/test-issue1175.t
+++ b/tests/test-issue1175.t
@@ -13,7 +13,7 @@ http://mercurial.selenic.com/bts/issue11
 
   $ hg mv a a2
   $ hg up
-  warning: detected divergent renames of a to:
+  warning: possible conflict - a was renamed multiple times to:
    a2
    a1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-rename-merge1.t b/tests/test-rename-merge1.t
--- a/tests/test-rename-merge1.t
+++ b/tests/test-rename-merge1.t
@@ -47,7 +47,7 @@
   my b at 044f8520aeeb+ other b at 85c198ef2f6c ancestor a at af1939970a1c
    premerge successful
   updating: a2 2/3 files (66.67%)
-  warning: detected divergent renames of a2 to:
+  warning: possible conflict - a2 was renamed multiple times to:
    c2
    b2
   updating: b2 3/3 files (100.00%)
@@ -95,7 +95,7 @@ We'd rather not warn on divergent rename
   $ hg up c761c6948de0
   1 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg up
-  warning: detected divergent renames of b to:
+  warning: possible conflict - b was renamed multiple times to:
    b3
    b4
   2 files updated, 0 files merged, 1 files removed, 0 files unresolved
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
@@ -383,7 +383,7 @@ m "um a c" "um x c" "      " "10 do merg
    c: remote created -> g
   preserving rev for resolve of rev
   updating: a 1/3 files (33.33%)
-  warning: detected divergent renames of a to:
+  warning: possible conflict - a was renamed multiple times to:
    b
    c
   updating: c 2/3 files (66.67%)


More information about the Mercurial-devel mailing list