Make the mapping from merge state to label and display key explicit, and move
construction of the dict out of the loop.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Make the mapping from merge state to label and display key explicit, and move
construction of the dict out of the loop.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/commands.py (27 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas | ||
Closed | mbthomas |
raise error.Abort(_('no files or directories specified'), | raise error.Abort(_('no files or directories specified'), | ||||
hint=('use --all to re-merge all unresolved files')) | hint=('use --all to re-merge all unresolved files')) | ||||
if show: | if show: | ||||
ui.pager('resolve') | ui.pager('resolve') | ||||
fm = ui.formatter('resolve', opts) | fm = ui.formatter('resolve', opts) | ||||
ms = mergemod.mergestate.read(repo) | ms = mergemod.mergestate.read(repo) | ||||
m = scmutil.match(repo[None], pats, opts) | m = scmutil.match(repo[None], pats, opts) | ||||
for f in ms: | |||||
if not m(f): | |||||
continue | |||||
# Set label based on merge state. | # Labels and keys based on merge state. Unresolved path conflicts show | ||||
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 | # as 'P'. Resolved path conflicts show as 'R', the same as normal | ||||
# resolved conflicts. | # resolved conflicts. | ||||
key = {'pu': 'P', 'pr': 'R'}.get(ms[f], ms[f].upper()) | mergestateinfo = { | ||||
'u': ('resolve.unresolved', 'U'), | |||||
'r': ('resolve.resolved', 'R'), | |||||
'pu': ('resolve.unresolved', 'P'), | |||||
'pr': ('resolve.resolved', 'R'), | |||||
'd': ('resolve.driverresolved', 'D'), | |||||
} | |||||
for f in ms: | |||||
if not m(f): | |||||
continue | |||||
label, key = mergestateinfo[ms[f]] | |||||
fm.startitem() | fm.startitem() | ||||
fm.condwrite(not nostatus, 'status', '%s ', key, label=l) | fm.condwrite(not nostatus, 'status', '%s ', key, label=label) | ||||
fm.write('path', '%s\n', f, label=l) | fm.write('path', '%s\n', f, label=label) | ||||
fm.end() | fm.end() | ||||
return 0 | return 0 | ||||
with repo.wlock(): | with repo.wlock(): | ||||
ms = mergemod.mergestate.read(repo) | ms = mergemod.mergestate.read(repo) | ||||
if not (ms.active() or repo.dirstate.p2() != nullid): | if not (ms.active() or repo.dirstate.p2() != nullid): | ||||
raise error.Abort( | raise error.Abort( |