merge: pretend ancestor is local to simplify backwards and overwrite
authorMatt Mackall <mpm@selenic.com>
Mon, 08 Jun 2009 18:14:44 -0500
changeset 8734 60fa3371aa75
parent 8733 f8be48c6b08c
child 8735 ff8519c437c6
merge: pretend ancestor is local to simplify backwards and overwrite
mercurial/merge.py
tests/test-up-local-change.out
tests/test-update-reverse.out
--- a/mercurial/merge.py	Mon Jun 08 18:14:44 2009 -0500
+++ b/mercurial/merge.py	Mon Jun 08 18:14:44 2009 -0500
@@ -133,6 +133,10 @@
     m2 = p2.manifest()
     ma = pa.manifest()
     backwards = (pa == p2)
+
+    if backwards or overwrite:
+        ma = m1
+
     action = []
     copy, copied, diverge = {}, {}, {}
 
@@ -209,7 +213,7 @@
             else: # case 4,21 A/B/B
                 act("local moved to " + f2, "m",
                     f, f2, f, fmerge(f, f2, f2), False)
-        elif f in ma:
+        elif f in ma and not n[20:]:
             if n != ma[f] and not overwrite:
                 if repo.ui.prompt(
                     _(" local changed %s which remote deleted\n"
--- a/tests/test-up-local-change.out	Mon Jun 08 18:14:44 2009 -0500
+++ b/tests/test-up-local-change.out	Mon Jun 08 18:14:44 2009 -0500
@@ -38,7 +38,7 @@
 resolving manifests
  overwrite False partial False
  ancestor 33aaa84a386b local 802f095af299+ remote 33aaa84a386b
- b: remote deleted -> r
+ b: other deleted -> r
 removing b
 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 changeset:   0:33aaa84a386b
--- a/tests/test-update-reverse.out	Mon Jun 08 18:14:44 2009 -0500
+++ b/tests/test-update-reverse.out	Mon Jun 08 18:14:44 2009 -0500
@@ -43,8 +43,8 @@
 resolving manifests
  overwrite True partial False
  ancestor 537353581d3d local ded32b0db104+ remote 221226fb2bd8
- side2: remote deleted -> r
- side1: remote deleted -> r
+ side2: other deleted -> r
+ side1: other deleted -> r
  main: remote created -> g
 removing side1
 removing side2