Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG3ee036c6f834: commit: keep opts dict str-keyed a bit longer
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
pulkit |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/commands.py (15 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
04d6d593effb | d75f0a1df682 | Martin von Zweigbergk | Jun 10 2021, 5:47 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
opts.pop('interactive') | opts.pop('interactive') | ||||
ret = cmdutil.dorecord( | ret = cmdutil.dorecord( | ||||
ui, repo, commit, None, False, cmdutil.recordfilter, *pats, **opts | ui, repo, commit, None, False, cmdutil.recordfilter, *pats, **opts | ||||
) | ) | ||||
# ret can be 0 (no changes to record) or the value returned by | # ret can be 0 (no changes to record) or the value returned by | ||||
# commit(), 1 if nothing changed or None on success. | # commit(), 1 if nothing changed or None on success. | ||||
return 1 if ret == 0 else ret | return 1 if ret == 0 else ret | ||||
opts = pycompat.byteskwargs(opts) | if opts.get('subrepos'): | ||||
if opts.get(b'subrepos'): | cmdutil.check_incompatible_arguments(opts, 'subrepos', ['amend']) | ||||
cmdutil.check_incompatible_arguments(opts, b'subrepos', [b'amend']) | |||||
# Let --subrepos on the command line override config setting. | # Let --subrepos on the command line override config setting. | ||||
ui.setconfig(b'ui', b'commitsubrepos', True, b'commit') | ui.setconfig(b'ui', b'commitsubrepos', True, b'commit') | ||||
cmdutil.checkunfinished(repo, commit=True) | cmdutil.checkunfinished(repo, commit=True) | ||||
branch = repo[None].branch() | branch = repo[None].branch() | ||||
bheads = repo.branchheads(branch) | bheads = repo.branchheads(branch) | ||||
tip = repo.changelog.tip() | tip = repo.changelog.tip() | ||||
extra = {} | extra = {} | ||||
if opts.get(b'close_branch') or opts.get(b'force_close_branch'): | if opts.get('close_branch') or opts.get('force_close_branch'): | ||||
extra[b'close'] = b'1' | extra[b'close'] = b'1' | ||||
if repo[b'.'].closesbranch(): | if repo[b'.'].closesbranch(): | ||||
raise error.InputError( | raise error.InputError( | ||||
_(b'current revision is already a branch closing head') | _(b'current revision is already a branch closing head') | ||||
) | ) | ||||
elif not bheads: | elif not bheads: | ||||
raise error.InputError( | raise error.InputError( | ||||
_(b'branch "%s" has no heads to close') % branch | _(b'branch "%s" has no heads to close') % branch | ||||
) | ) | ||||
elif ( | elif ( | ||||
branch == repo[b'.'].branch() | branch == repo[b'.'].branch() | ||||
and repo[b'.'].node() not in bheads | and repo[b'.'].node() not in bheads | ||||
and not opts.get(b'force_close_branch') | and not opts.get('force_close_branch') | ||||
): | ): | ||||
hint = _( | hint = _( | ||||
b'use --force-close-branch to close branch from a non-head' | b'use --force-close-branch to close branch from a non-head' | ||||
b' changeset' | b' changeset' | ||||
) | ) | ||||
raise error.InputError(_(b'can only close branch heads'), hint=hint) | raise error.InputError(_(b'can only close branch heads'), hint=hint) | ||||
elif opts.get(b'amend'): | elif opts.get('amend'): | ||||
if ( | if ( | ||||
repo[b'.'].p1().branch() != branch | repo[b'.'].p1().branch() != branch | ||||
and repo[b'.'].p2().branch() != branch | and repo[b'.'].p2().branch() != branch | ||||
): | ): | ||||
raise error.InputError(_(b'can only close branch heads')) | raise error.InputError(_(b'can only close branch heads')) | ||||
if opts.get(b'amend'): | if opts.get('amend'): | ||||
if ui.configbool(b'ui', b'commitsubrepos'): | if ui.configbool(b'ui', b'commitsubrepos'): | ||||
raise error.InputError( | raise error.InputError( | ||||
_(b'cannot amend with ui.commitsubrepos enabled') | _(b'cannot amend with ui.commitsubrepos enabled') | ||||
) | ) | ||||
old = repo[b'.'] | old = repo[b'.'] | ||||
rewriteutil.precheck(repo, [old.rev()], b'amend') | rewriteutil.precheck(repo, [old.rev()], b'amend') | ||||
# Currently histedit gets confused if an amend happens while histedit | # Currently histedit gets confused if an amend happens while histedit | ||||
# is in progress. Since we have a checkunfinished command, we are | # is in progress. Since we have a checkunfinished command, we are | ||||
# temporarily honoring it. | # temporarily honoring it. | ||||
# | # | ||||
# Note: eventually this guard will be removed. Please do not expect | # Note: eventually this guard will be removed. Please do not expect | ||||
# this behavior to remain. | # this behavior to remain. | ||||
if not obsolete.isenabled(repo, obsolete.createmarkersopt): | if not obsolete.isenabled(repo, obsolete.createmarkersopt): | ||||
cmdutil.checkunfinished(repo) | cmdutil.checkunfinished(repo) | ||||
opts = pycompat.byteskwargs(opts) | |||||
node = cmdutil.amend(ui, repo, old, extra, pats, opts) | node = cmdutil.amend(ui, repo, old, extra, pats, opts) | ||||
if node == old.node(): | if node == old.node(): | ||||
ui.status(_(b"nothing changed\n")) | ui.status(_(b"nothing changed\n")) | ||||
return 1 | return 1 | ||||
else: | else: | ||||
def commitfunc(ui, repo, message, match, opts): | def commitfunc(ui, repo, message, match, opts): | ||||
overrides = {} | overrides = {} | ||||
message, | message, | ||||
opts.get(b'user'), | opts.get(b'user'), | ||||
opts.get(b'date'), | opts.get(b'date'), | ||||
match, | match, | ||||
editor=editor, | editor=editor, | ||||
extra=extra, | extra=extra, | ||||
) | ) | ||||
opts = pycompat.byteskwargs(opts) | |||||
node = cmdutil.commit(ui, repo, commitfunc, pats, opts) | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) | ||||
if not node: | if not node: | ||||
stat = cmdutil.postcommitstatus(repo, pats, opts) | stat = cmdutil.postcommitstatus(repo, pats, opts) | ||||
if stat.deleted: | if stat.deleted: | ||||
ui.status( | ui.status( | ||||
_( | _( | ||||
b"nothing changed (%d missing files, see " | b"nothing changed (%d missing files, see " |