Mercurial > hg
changeset 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 | 1913162854f2 |
children | 81aebcc73beb |
files | mercurial/commands.py |
diffstat | 1 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Oct 02 14:05:30 2017 -0700 +++ b/mercurial/commands.py Mon Oct 02 14:05:30 2017 -0700 @@ -4275,10 +4275,19 @@ for f in ms: if not m(f): continue + + # Set label based on merge state. l = 'resolve.' + {'u': 'unresolved', 'r': 'resolved', + 'pu': 'unresolved', 'pr': 'resolved', 'd': 'driverresolved'}[ms[f]] + + # Set key based on merge state. Unresolved path conflicts show + # as 'P'. Resolved path conflicts show as 'R', the same as normal + # resolved conflicts. + key = {'pu': 'P', 'pr': 'R'}.get(ms[f], ms[f].upper()) + fm.startitem() - fm.condwrite(not nostatus, 'status', '%s ', ms[f].upper(), label=l) + fm.condwrite(not nostatus, 'status', '%s ', key, label=l) fm.write('path', '%s\n', f, label=l) fm.end() return 0 @@ -4327,6 +4336,17 @@ runconclude = True continue + # path conflicts must be resolved manually + if ms[f] in ("pu", "pr"): + if mark: + ms.mark(f, "pr") + elif unmark: + ms.mark(f, "pu") + elif ms[f] == "pu": + ui.warn(_('%s: path conflict must be resolved manually\n') + % f) + continue + if mark: ms.mark(f, "r") elif unmark: