Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG3c7c13e75663: status: use context-returning revpair()
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/commands.py (14 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
if revs and change: | if revs and change: | ||||
msg = _('cannot specify --rev and --change at the same time') | msg = _('cannot specify --rev and --change at the same time') | ||||
raise error.Abort(msg) | raise error.Abort(msg) | ||||
elif revs and terse: | elif revs and terse: | ||||
msg = _('cannot use --terse with --rev') | msg = _('cannot use --terse with --rev') | ||||
raise error.Abort(msg) | raise error.Abort(msg) | ||||
elif change: | elif change: | ||||
repo = scmutil.unhidehashlikerevs(repo, [change], 'nowarn') | repo = scmutil.unhidehashlikerevs(repo, [change], 'nowarn') | ||||
node2 = scmutil.revsingle(repo, change, None).node() | ctx2 = scmutil.revsingle(repo, change, None) | ||||
node1 = repo[node2].p1().node() | ctx1 = ctx2.p1() | ||||
else: | else: | ||||
repo = scmutil.unhidehashlikerevs(repo, revs, 'nowarn') | repo = scmutil.unhidehashlikerevs(repo, revs, 'nowarn') | ||||
node1, node2 = scmutil.revpairnodes(repo, revs) | ctx1, ctx2 = scmutil.revpair(repo, revs) | ||||
if pats or ui.configbool('commands', 'status.relative'): | if pats or ui.configbool('commands', 'status.relative'): | ||||
cwd = repo.getcwd() | cwd = repo.getcwd() | ||||
else: | else: | ||||
cwd = '' | cwd = '' | ||||
if opts.get('print0'): | if opts.get('print0'): | ||||
end = '\0' | end = '\0' | ||||
else: | else: | ||||
end = '\n' | end = '\n' | ||||
copy = {} | copy = {} | ||||
states = 'modified added removed deleted unknown ignored clean'.split() | states = 'modified added removed deleted unknown ignored clean'.split() | ||||
show = [k for k in states if opts.get(k)] | show = [k for k in states if opts.get(k)] | ||||
if opts.get('all'): | if opts.get('all'): | ||||
show += ui.quiet and (states[:4] + ['clean']) or states | show += ui.quiet and (states[:4] + ['clean']) or states | ||||
if not show: | if not show: | ||||
if ui.quiet: | if ui.quiet: | ||||
show = states[:4] | show = states[:4] | ||||
else: | else: | ||||
show = states[:5] | show = states[:5] | ||||
m = scmutil.match(repo[node2], pats, opts) | m = scmutil.match(ctx2, pats, opts) | ||||
if terse: | if terse: | ||||
# we need to compute clean and unknown to terse | # we need to compute clean and unknown to terse | ||||
stat = repo.status(node1, node2, m, | stat = repo.status(ctx1.node(), ctx2.node(), m, | ||||
'ignored' in show or 'i' in terse, | 'ignored' in show or 'i' in terse, | ||||
True, True, opts.get('subrepos')) | True, True, opts.get('subrepos')) | ||||
stat = cmdutil.tersedir(stat, terse) | stat = cmdutil.tersedir(stat, terse) | ||||
else: | else: | ||||
stat = repo.status(node1, node2, m, | stat = repo.status(ctx1.node(), ctx2.node(), m, | ||||
'ignored' in show, 'clean' in show, | 'ignored' in show, 'clean' in show, | ||||
'unknown' in show, opts.get('subrepos')) | 'unknown' in show, opts.get('subrepos')) | ||||
changestates = zip(states, pycompat.iterbytestr('MAR!?IC'), stat) | changestates = zip(states, pycompat.iterbytestr('MAR!?IC'), stat) | ||||
if (opts.get('all') or opts.get('copies') | if (opts.get('all') or opts.get('copies') | ||||
or ui.configbool('ui', 'statuscopies')) and not opts.get('no_status'): | or ui.configbool('ui', 'statuscopies')) and not opts.get('no_status'): | ||||
copy = copies.pathcopies(repo[node1], repo[node2], m) | copy = copies.pathcopies(ctx1, ctx2, m) | ||||
ui.pager('status') | ui.pager('status') | ||||
fm = ui.formatter('status', opts) | fm = ui.formatter('status', opts) | ||||
fmt = '%s' + end | fmt = '%s' + end | ||||
showchar = not opts.get('no_status') | showchar = not opts.get('no_status') | ||||
for state, char, files in changestates: | for state, char, files in changestates: | ||||
if state in show: | if state in show: |