merge with hg-stable
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 08 Nov 2009 18:18:46 +0100
changeset 9801 8b7d4ab33b2b
parent 9800 b39f98be96de (current diff)
parent 9797 0c5714a4920f (diff)
child 9802 4ce13d7c6b88
merge with hg-stable
--- a/mercurial/merge.py	Sun Nov 08 18:05:56 2009 +0100
+++ b/mercurial/merge.py	Sun Nov 08 18:18:46 2009 +0100
@@ -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 18:05:56 2009 +0100
+++ b/mercurial/subrepo.py	Sun Nov 08 18:18:46 2009 +0100
@@ -52,13 +52,15 @@
     sa = actx.substate
     sm = {}
 
+    repo.ui.debug("subrepo merge %s %s %s\n" % (wctx, mctx, actx))
+
     def debug(s, msg, r=""):
         if r:
             r = "%s:%s" % r
-        repo.ui.debug(_("  subrepo %s: %s %s\n") % (s, msg, r))
+        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:
@@ -67,7 +69,7 @@
                 sm[s] = l
                 continue
             elif l == a: # other side changed
-                debug(s, _("other changed, get"), r)
+                debug(s, "other changed, get", r)
                 wctx.sub(s).get(r)
                 sm[s] = r
             elif l[0] != r[0]: # sources differ
@@ -76,33 +78,33 @@
                       'use (l)ocal source (%s) or (r)emote source (%s)?')
                       % (s, l[0], r[0]),
                       (_('&Local'), _('&Remote')), 0):
-                    debug(s, _("prompt changed, get"), r)
+                    debug(s, "prompt changed, get", r)
                     wctx.sub(s).get(r)
                     sm[s] = r
             elif l[1] == a[1]: # local side is unchanged
-                debug(s, _("other side changed, get"), r)
+                debug(s, "other side changed, get", r)
                 wctx.sub(s).get(r)
                 sm[s] = r
             else:
-                debug(s, _("both sides changed, merge with"), r)
+                debug(s, "both sides changed, merge with", r)
                 wctx.sub(s).merge(r)
                 sm[s] = l
         elif l == a: # remote removed, local unchanged
-            debug(s, _("remote removed, remove"))
+            debug(s, "remote removed, remove")
             wctx.sub(s).remove()
         else:
             if repo.ui.promptchoice(
                 _(' local changed subrepository %s which remote removed\n'
                   'use (c)hanged version or (d)elete?') % s,
                 (_('&Changed'), _('&Delete')), 0):
-                debug(s, _("prompt remove"))
+                debug(s, "prompt remove")
                 wctx.sub(s).remove()
 
     for s, r in s2.items():
         if s in s1:
             continue
         elif s not in sa:
-            debug(s, _("remote added, get"), r)
+            debug(s, "remote added, get", r)
             wctx.sub(s).get(r)
             sm[s] = r
         elif r != sa[s]:
@@ -110,7 +112,7 @@
                 _(' remote changed subrepository %s which local removed\n'
                   'use (c)hanged version or (d)elete?') % s,
                 (_('&Changed'), _('&Delete')), 0) == 0:
-                debug(s, _("prompt recreate"), r)
+                debug(s, "prompt recreate", r)
                 wctx.sub(s).get(r)
                 sm[s] = r
 
@@ -171,6 +173,7 @@
         return w.dirty() # working directory changed
 
     def commit(self, text, user, date):
+        self._repo.ui.debug("committing subrepo %s\n" % self._path)
         n = self._repo.commit(text, user, date)
         if not n:
             return self._repo['.'].hex() # different version checked out
@@ -196,6 +199,7 @@
     def get(self, state):
         self._get(state)
         source, revision = state
+        self._repo.ui.debug("getting subrepo %s\n" % self._path)
         hg.clean(self._repo, revision, False)
 
     def merge(self, state):
@@ -203,8 +207,10 @@
         cur = self._repo['.']
         dst = self._repo[state[1]]
         if dst.ancestor(cur) == cur:
+            self._repo.ui.debug("updating subrepo %s\n" % self._path)
             hg.update(self._repo, state[1])
         else:
+            self._repo.ui.debug("merging subrepo %s\n" % self._path)
             hg.merge(self._repo, state[1], remind=False)
 
     def push(self, force):
--- a/tests/test-subrepo.out	Sun Nov 08 18:05:56 2009 +0100
+++ b/tests/test-subrepo.out	Sun Nov 08 18:18:46 2009 +0100
@@ -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