changeset 9783:ee00ef6f9be7

submerge: properly deal with overwrites also pull .hgsubstate check out of inner loop
author Matt Mackall <mpm@selenic.com>
date Sun, 08 Nov 2009 10:29:52 -0600
parents c1c40511c276
children 0c5714a4920f
files mercurial/merge.py mercurial/subrepo.py tests/test-subrepo.out
diffstat 3 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Sun Nov 08 10:24:18 2009 -0600
+++ b/mercurial/merge.py	Sun Nov 08 10:29:52 2009 -0600
@@ -167,14 +167,15 @@
     m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest()
     copied = set(copy.values())
 
+    if not overwrite and '.hgsubstate' in m1:
+        # check whether sub state is modified
+        for s in p1.substate:
+            if p1.sub(s).dirty():
+                m1['.hgsubstate'] += "+"
+                break
+
     # Compare manifests
     for f, n in m1.iteritems():
-        if f == '.hgsubstate':
-            # check whether sub state is modified
-            for s in p1.substate:
-                if p1.sub(s).dirty():
-                    n += "+"
-                    break
         if partial and not partial(f):
             continue
         if f in m2:
--- a/mercurial/subrepo.py	Sun Nov 08 10:24:18 2009 -0600
+++ b/mercurial/subrepo.py	Sun Nov 08 10:29:52 2009 -0600
@@ -60,7 +60,7 @@
         repo.ui.debug("  subrepo %s: %s %s\n" % (s, msg, r))
 
     for s, l in s1.items():
-        if wctx.sub(s).dirty():
+        if wctx != actx and wctx.sub(s).dirty():
             l = (l[0], l[1] + "+")
         a = sa.get(s, nullstate)
         if s in s2:
--- a/tests/test-subrepo.out	Sun Nov 08 10:24:18 2009 -0600
+++ b/tests/test-subrepo.out	Sun Nov 08 10:29:52 2009 -0600
@@ -56,6 +56,9 @@
  overwrite None partial False
  ancestor 1f14a2e2d3ec local f0d2028bf86d+ remote 1831e14459c4
  .hgsubstate: versions differ -> m
+subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
+  subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad
+getting subrepo t
 resolving manifests
  overwrite True partial False
  ancestor 60ca1237c194+ local 60ca1237c194+ remote 6747d179aa9a
@@ -75,6 +78,9 @@
  overwrite None partial False
  ancestor 1831e14459c4 local e45c8b14af55+ remote f94576341bcf
  .hgsubstate: versions differ -> m
+subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
+  subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4
+merging subrepo t
   searching for copies back to rev 2
 resolving manifests
  overwrite None partial False