##// END OF EJS Templates
subrepo: add some debug output to submerge
Matt Mackall -
r9779:58a6f3f4 default
parent child Browse files
Show More
@@ -52,6 +52,11 b' def submerge(repo, wctx, mctx, actx):'
52 sa = actx.substate
52 sa = actx.substate
53 sm = {}
53 sm = {}
54
54
55 def debug(s, msg, r=""):
56 if r:
57 r = "%s:%s" % r
58 repo.ui.debug(_(" subrepo %s: %s %s\n") % (s, msg, r))
59
55 for s, l in s1.items():
60 for s, l in s1.items():
56 a = sa.get(s, nullstate)
61 a = sa.get(s, nullstate)
57 if s in s2:
62 if s in s2:
@@ -60,6 +65,7 b' def submerge(repo, wctx, mctx, actx):'
60 sm[s] = l
65 sm[s] = l
61 continue
66 continue
62 elif l == a: # other side changed
67 elif l == a: # other side changed
68 debug(s, _("other changed, get"), r)
63 wctx.sub(s).get(r)
69 wctx.sub(s).get(r)
64 sm[s] = r
70 sm[s] = r
65 elif l[0] != r[0]: # sources differ
71 elif l[0] != r[0]: # sources differ
@@ -68,27 +74,33 b' def submerge(repo, wctx, mctx, actx):'
68 'use (l)ocal source (%s) or (r)emote source (%s)?')
74 'use (l)ocal source (%s) or (r)emote source (%s)?')
69 % (s, l[0], r[0]),
75 % (s, l[0], r[0]),
70 (_('&Local'), _('&Remote')), 0):
76 (_('&Local'), _('&Remote')), 0):
77 debug(s, _("prompt changed, get"), r)
71 wctx.sub(s).get(r)
78 wctx.sub(s).get(r)
72 sm[s] = r
79 sm[s] = r
73 elif l[1] == a[1]: # local side is unchanged
80 elif l[1] == a[1]: # local side is unchanged
81 debug(s, _("other side changed, get"), r)
74 wctx.sub(s).get(r)
82 wctx.sub(s).get(r)
75 sm[s] = r
83 sm[s] = r
76 else:
84 else:
85 debug(s, _("both sides changed, merge with"), r)
77 wctx.sub(s).merge(r)
86 wctx.sub(s).merge(r)
78 sm[s] = l
87 sm[s] = l
79 elif l == a: # remote removed, local unchanged
88 elif l == a: # remote removed, local unchanged
89 debug(s, _("remote removed, remove"))
80 wctx.sub(s).remove()
90 wctx.sub(s).remove()
81 else:
91 else:
82 if repo.ui.promptchoice(
92 if repo.ui.promptchoice(
83 _(' local changed subrepository %s which remote removed\n'
93 _(' local changed subrepository %s which remote removed\n'
84 'use (c)hanged version or (d)elete?') % s,
94 'use (c)hanged version or (d)elete?') % s,
85 (_('&Changed'), _('&Delete')), 0):
95 (_('&Changed'), _('&Delete')), 0):
96 debug(s, _("prompt remove"))
86 wctx.sub(s).remove()
97 wctx.sub(s).remove()
87
98
88 for s, r in s2.items():
99 for s, r in s2.items():
89 if s in s1:
100 if s in s1:
90 continue
101 continue
91 elif s not in sa:
102 elif s not in sa:
103 debug(s, _("remote added, get"), r)
92 wctx.sub(s).get(r)
104 wctx.sub(s).get(r)
93 sm[s] = r
105 sm[s] = r
94 elif r != sa[s]:
106 elif r != sa[s]:
@@ -96,6 +108,7 b' def submerge(repo, wctx, mctx, actx):'
96 _(' remote changed subrepository %s which local removed\n'
108 _(' remote changed subrepository %s which local removed\n'
97 'use (c)hanged version or (d)elete?') % s,
109 'use (c)hanged version or (d)elete?') % s,
98 (_('&Changed'), _('&Delete')), 0) == 0:
110 (_('&Changed'), _('&Delete')), 0) == 0:
111 debug(s, _("prompt recreate"), r)
99 wctx.sub(s).get(r)
112 wctx.sub(s).get(r)
100 sm[s] = r
113 sm[s] = r
101
114
@@ -198,4 +211,3 b' class hgsubrepo(object):'
198 dsturl = _abssource(self._repo, True)
211 dsturl = _abssource(self._repo, True)
199 other = hg.repository(self._repo.ui, dsturl)
212 other = hg.repository(self._repo.ui, dsturl)
200 self._repo.push(other, force)
213 self._repo.push(other, force)
201
General Comments 0
You need to be logged in to leave comments. Login now