Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 34546:e4cf957bf7ce
commands: update the resolve command to handle path conflicts
The resolve command must support displaying path conflicts and marking
them as resolved or unresolved.
Differential Revision: https://phab.mercurial-scm.org/D775
author | Mark Thomas <mbthomas@fb.com> |
---|---|
date | Mon, 02 Oct 2017 14:05:30 -0700 |
parents | 884b595f5195 |
children | eddeedbde866 |
comparison
equal
deleted
inserted
replaced
34545:1913162854f2 | 34546:e4cf957bf7ce |
---|---|
4273 ms = mergemod.mergestate.read(repo) | 4273 ms = mergemod.mergestate.read(repo) |
4274 m = scmutil.match(repo[None], pats, opts) | 4274 m = scmutil.match(repo[None], pats, opts) |
4275 for f in ms: | 4275 for f in ms: |
4276 if not m(f): | 4276 if not m(f): |
4277 continue | 4277 continue |
4278 | |
4279 # Set label based on merge state. | |
4278 l = 'resolve.' + {'u': 'unresolved', 'r': 'resolved', | 4280 l = 'resolve.' + {'u': 'unresolved', 'r': 'resolved', |
4281 'pu': 'unresolved', 'pr': 'resolved', | |
4279 'd': 'driverresolved'}[ms[f]] | 4282 'd': 'driverresolved'}[ms[f]] |
4283 | |
4284 # Set key based on merge state. Unresolved path conflicts show | |
4285 # as 'P'. Resolved path conflicts show as 'R', the same as normal | |
4286 # resolved conflicts. | |
4287 key = {'pu': 'P', 'pr': 'R'}.get(ms[f], ms[f].upper()) | |
4288 | |
4280 fm.startitem() | 4289 fm.startitem() |
4281 fm.condwrite(not nostatus, 'status', '%s ', ms[f].upper(), label=l) | 4290 fm.condwrite(not nostatus, 'status', '%s ', key, label=l) |
4282 fm.write('path', '%s\n', f, label=l) | 4291 fm.write('path', '%s\n', f, label=l) |
4283 fm.end() | 4292 fm.end() |
4284 return 0 | 4293 return 0 |
4285 | 4294 |
4286 with repo.wlock(): | 4295 with repo.wlock(): |
4323 if exact: | 4332 if exact: |
4324 ui.warn(_('not unmarking %s as it is driver-resolved\n') | 4333 ui.warn(_('not unmarking %s as it is driver-resolved\n') |
4325 % f) | 4334 % f) |
4326 else: | 4335 else: |
4327 runconclude = True | 4336 runconclude = True |
4337 continue | |
4338 | |
4339 # path conflicts must be resolved manually | |
4340 if ms[f] in ("pu", "pr"): | |
4341 if mark: | |
4342 ms.mark(f, "pr") | |
4343 elif unmark: | |
4344 ms.mark(f, "pu") | |
4345 elif ms[f] == "pu": | |
4346 ui.warn(_('%s: path conflict must be resolved manually\n') | |
4347 % f) | |
4328 continue | 4348 continue |
4329 | 4349 |
4330 if mark: | 4350 if mark: |
4331 ms.mark(f, "r") | 4351 ms.mark(f, "r") |
4332 elif unmark: | 4352 elif unmark: |