Mercurial > public > mercurial-scm > hg
comparison mercurial/subrepo.py @ 31516:2915cc1d3429 stable
subrepo: move prompts out of the if (issue5505)
Prompts weren't available in the else clause
author | Simon Farnsworth <simonfar@fb.com> |
---|---|
date | Mon, 20 Mar 2017 04:36:55 -0700 |
parents | 0fbb3a5c188e |
children | f97e90fa5ad7 |
comparison
equal
deleted
inserted
replaced
31474:10c0ee338535 | 31516:2915cc1d3429 |
---|---|
192 def debug(s, msg, r=""): | 192 def debug(s, msg, r=""): |
193 if r: | 193 if r: |
194 r = "%s:%s:%s" % r | 194 r = "%s:%s:%s" % r |
195 repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) | 195 repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) |
196 | 196 |
197 promptssrc = filemerge.partextras(labels) | |
197 for s, l in sorted(s1.iteritems()): | 198 for s, l in sorted(s1.iteritems()): |
199 prompts = None | |
198 a = sa.get(s, nullstate) | 200 a = sa.get(s, nullstate) |
199 ld = l # local state with possible dirty flag for compares | 201 ld = l # local state with possible dirty flag for compares |
200 if wctx.sub(s).dirty(): | 202 if wctx.sub(s).dirty(): |
201 ld = (l[0], l[1] + "+") | 203 ld = (l[0], l[1] + "+") |
202 if wctx == actx: # overwrite | 204 if wctx == actx: # overwrite |
203 a = ld | 205 a = ld |
204 | 206 |
207 prompts = promptssrc.copy() | |
208 prompts['s'] = s | |
205 if s in s2: | 209 if s in s2: |
206 prompts = filemerge.partextras(labels) | |
207 prompts['s'] = s | |
208 r = s2[s] | 210 r = s2[s] |
209 if ld == r or r == a: # no change or local is newer | 211 if ld == r or r == a: # no change or local is newer |
210 sm[s] = l | 212 sm[s] = l |
211 continue | 213 continue |
212 elif ld == a: # other side changed | 214 elif ld == a: # other side changed |
265 '$$ &Changed $$ &Delete') % prompts, 0): | 267 '$$ &Changed $$ &Delete') % prompts, 0): |
266 debug(s, "prompt remove") | 268 debug(s, "prompt remove") |
267 wctx.sub(s).remove() | 269 wctx.sub(s).remove() |
268 | 270 |
269 for s, r in sorted(s2.items()): | 271 for s, r in sorted(s2.items()): |
272 prompts = None | |
270 if s in s1: | 273 if s in s1: |
271 continue | 274 continue |
272 elif s not in sa: | 275 elif s not in sa: |
273 debug(s, "remote added, get", r) | 276 debug(s, "remote added, get", r) |
274 mctx.sub(s).get(r) | 277 mctx.sub(s).get(r) |
275 sm[s] = r | 278 sm[s] = r |
276 elif r != sa[s]: | 279 elif r != sa[s]: |
280 prompts = promptssrc.copy() | |
281 prompts['s'] = s | |
277 if repo.ui.promptchoice( | 282 if repo.ui.promptchoice( |
278 _(' remote%(o)s changed subrepository %(s)s' | 283 _(' remote%(o)s changed subrepository %(s)s' |
279 ' which local%(l)s removed\n' | 284 ' which local%(l)s removed\n' |
280 'use (c)hanged version or (d)elete?' | 285 'use (c)hanged version or (d)elete?' |
281 '$$ &Changed $$ &Delete') % prompts, 0) == 0: | 286 '$$ &Changed $$ &Delete') % prompts, 0) == 0: |