Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG774cee0e95c6: amend: use cmdutil.check_at_most_one_arg()
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/cmdutil.py (7 lines) | |||
M | tests/test-amend.t (2 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
102665738e10 | b7a09c03927f | Martin von Zweigbergk | Dec 12 2019, 6:10 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 | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
raise error.Abort(_(b'uncommitted changes'), hint=hint) | raise error.Abort(_(b'uncommitted changes'), hint=hint) | ||||
ctx = repo[None] | ctx = repo[None] | ||||
for s in sorted(ctx.substate): | for s in sorted(ctx.substate): | ||||
ctx.sub(s).bailifchanged(hint=hint) | ctx.sub(s).bailifchanged(hint=hint) | ||||
def logmessage(ui, opts): | def logmessage(ui, opts): | ||||
""" get the log message according to -m and -l option """ | """ get the log message according to -m and -l option """ | ||||
check_at_most_one_arg(opts, b'message', b'logfile') | |||||
message = opts.get(b'message') | message = opts.get(b'message') | ||||
logfile = opts.get(b'logfile') | logfile = opts.get(b'logfile') | ||||
if message and logfile: | |||||
raise error.Abort( | |||||
_(b'options --message and --logfile are mutually exclusive') | |||||
) | |||||
if not message and logfile: | if not message and logfile: | ||||
try: | try: | ||||
if isstdiofilename(logfile): | if isstdiofilename(logfile): | ||||
message = ui.fin.read() | message = ui.fin.read() | ||||
else: | else: | ||||
message = b'\n'.join(util.readfile(logfile).splitlines()) | message = b'\n'.join(util.readfile(logfile).splitlines()) | ||||
except IOError as inst: | except IOError as inst: | ||||
raise error.Abort( | raise error.Abort( |
298f085230c3 EDITED: NEWMESSAGE | 298f085230c3 EDITED: NEWMESSAGE | ||||
$ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG | ||||
saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (obsstore-off !) | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (obsstore-off !) | ||||
$ hg log -r . -T '{node|short} {desc}\n' | $ hg log -r . -T '{node|short} {desc}\n' | ||||
974f07f28537 EDITED: MSG | 974f07f28537 EDITED: MSG | ||||
$ echo FOO > $TESTTMP/msg | $ echo FOO > $TESTTMP/msg | ||||
$ hg amend -l $TESTTMP/msg -m BAR | $ hg amend -l $TESTTMP/msg -m BAR | ||||
abort: options --message and --logfile are mutually exclusive | abort: cannot specify both --message and --logfile | ||||
[255] | [255] | ||||
$ hg amend -l $TESTTMP/msg | $ hg amend -l $TESTTMP/msg | ||||
saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (obsstore-off !) | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (obsstore-off !) | ||||
$ hg log -r . -T '{node|short} {desc}\n' | $ hg log -r . -T '{node|short} {desc}\n' | ||||
507be9bdac71 FOO | 507be9bdac71 FOO | ||||
Interactive mode | Interactive mode | ||||