comparison mercurial/subrepo.py @ 11463:f0ea93557133 stable

subrepo: fix recording of + in .hgsubstate (issue2217)
author Matt Mackall <mpm@selenic.com>
date Tue, 29 Jun 2010 17:30:42 -0500
parents 3827728b54e2
children 34e33d50c26b
comparison
equal deleted inserted replaced
11462:1b82a26635d7 11463:f0ea93557133
65 if r: 65 if r:
66 r = "%s:%s:%s" % r 66 r = "%s:%s:%s" % r
67 repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) 67 repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r))
68 68
69 for s, l in s1.items(): 69 for s, l in s1.items():
70 ld = l # local state with possible dirty flag for compares
70 if wctx != actx and wctx.sub(s).dirty(): 71 if wctx != actx and wctx.sub(s).dirty():
71 l = (l[0], l[1] + "+") 72 ld = (l[0], l[1] + "+")
73
72 a = sa.get(s, nullstate) 74 a = sa.get(s, nullstate)
73 if s in s2: 75 if s in s2:
74 r = s2[s] 76 r = s2[s]
75 if l == r or r == a: # no change or local is newer 77 if ld == r or r == a: # no change or local is newer
76 sm[s] = l 78 sm[s] = l
77 continue 79 continue
78 elif l == a: # other side changed 80 elif ld == a: # other side changed
79 debug(s, "other changed, get", r) 81 debug(s, "other changed, get", r)
80 wctx.sub(s).get(r) 82 wctx.sub(s).get(r)
81 sm[s] = r 83 sm[s] = r
82 elif l[0] != r[0]: # sources differ 84 elif ld[0] != r[0]: # sources differ
83 if repo.ui.promptchoice( 85 if repo.ui.promptchoice(
84 _(' subrepository sources for %s differ\n' 86 _(' subrepository sources for %s differ\n'
85 'use (l)ocal source (%s) or (r)emote source (%s)?') 87 'use (l)ocal source (%s) or (r)emote source (%s)?')
86 % (s, l[0], r[0]), 88 % (s, l[0], r[0]),
87 (_('&Local'), _('&Remote')), 0): 89 (_('&Local'), _('&Remote')), 0):
88 debug(s, "prompt changed, get", r) 90 debug(s, "prompt changed, get", r)
89 wctx.sub(s).get(r) 91 wctx.sub(s).get(r)
90 sm[s] = r 92 sm[s] = r
91 elif l[1] == a[1]: # local side is unchanged 93 elif ld[1] == a[1]: # local side is unchanged
92 debug(s, "other side changed, get", r) 94 debug(s, "other side changed, get", r)
93 wctx.sub(s).get(r) 95 wctx.sub(s).get(r)
94 sm[s] = r 96 sm[s] = r
95 else: 97 else:
96 debug(s, "both sides changed, merge with", r) 98 debug(s, "both sides changed, merge with", r)
97 wctx.sub(s).merge(r) 99 wctx.sub(s).merge(r)
98 sm[s] = l 100 sm[s] = l
99 elif l == a: # remote removed, local unchanged 101 elif ld == a: # remote removed, local unchanged
100 debug(s, "remote removed, remove") 102 debug(s, "remote removed, remove")
101 wctx.sub(s).remove() 103 wctx.sub(s).remove()
102 else: 104 else:
103 if repo.ui.promptchoice( 105 if repo.ui.promptchoice(
104 _(' local changed subrepository %s which remote removed\n' 106 _(' local changed subrepository %s which remote removed\n'