subrepo: add some debug output to submerge
authorMatt Mackall <mpm@selenic.com>
Sat, 07 Nov 2009 16:29:49 -0600
changeset 9779 58a6f3f4d553
parent 9778 6cb1808e5ae7
child 9780 1ee085511b89
subrepo: add some debug output to submerge
mercurial/subrepo.py
--- a/mercurial/subrepo.py	Sat Nov 07 14:13:15 2009 -0600
+++ b/mercurial/subrepo.py	Sat Nov 07 16:29:49 2009 -0600
@@ -52,6 +52,11 @@
     sa = actx.substate
     sm = {}
 
+    def debug(s, msg, r=""):
+        if r:
+            r = "%s:%s" % r
+        repo.ui.debug(_("  subrepo %s: %s %s\n") % (s, msg, r))
+
     for s, l in s1.items():
         a = sa.get(s, nullstate)
         if s in s2:
@@ -60,6 +65,7 @@
                 sm[s] = l
                 continue
             elif l == a: # other side changed
+                debug(s, _("other changed, get"), r)
                 wctx.sub(s).get(r)
                 sm[s] = r
             elif l[0] != r[0]: # sources differ
@@ -68,27 +74,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)
                     wctx.sub(s).get(r)
                     sm[s] = r
             elif l[1] == a[1]: # local side is unchanged
+                debug(s, _("other side changed, get"), r)
                 wctx.sub(s).get(r)
                 sm[s] = r
             else:
+                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"))
             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"))
                 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)
             wctx.sub(s).get(r)
             sm[s] = r
         elif r != sa[s]:
@@ -96,6 +108,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)
                 wctx.sub(s).get(r)
                 sm[s] = r
 
@@ -198,4 +211,3 @@
         dsturl = _abssource(self._repo, True)
         other = hg.repository(self._repo.ui, dsturl)
         self._repo.push(other, force)
-