Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG2e672ccc2220: commit: 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 (6 lines) | |||
M | tests/test-amend.t (2 lines) | |||
M | tests/test-graft.t (4 lines) | |||
M | tests/test-uncommit.t (4 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
74d25ad3c391 | a14d396682f7 | Martin von Zweigbergk | Dec 12 2019, 5:54 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 |
def resolvecommitoptions(ui, opts): | def resolvecommitoptions(ui, opts): | ||||
"""modify commit options dict to handle related options | """modify commit options dict to handle related options | ||||
The return value indicates that ``rewrite.update-timestamp`` is the reason | The return value indicates that ``rewrite.update-timestamp`` is the reason | ||||
the ``date`` option is set. | the ``date`` option is set. | ||||
""" | """ | ||||
if opts.get(b'date') and opts.get(b'currentdate'): | check_unique_argument(opts, b'date', b'currentdate') | ||||
raise error.Abort(_(b'--date and --currentdate are mutually exclusive')) | check_unique_argument(opts, b'user', b'currentuser') | ||||
if opts.get(b'user') and opts.get(b'currentuser'): | |||||
raise error.Abort(_(b'--user and --currentuser are mutually exclusive')) | |||||
datemaydiffer = False # date-only change should be ignored? | datemaydiffer = False # date-only change should be ignored? | ||||
if opts.get(b'currentdate'): | if opts.get(b'currentdate'): | ||||
opts[b'date'] = b'%d %d' % dateutil.makedate() | opts[b'date'] = b'%d %d' % dateutil.makedate() | ||||
elif ( | elif ( | ||||
not opts.get(b'date') | not opts.get(b'date') | ||||
and ui.configbool(b'rewrite', b'update-timestamp') | and ui.configbool(b'rewrite', b'update-timestamp') |
$ hg log --limit 1 | $ hg log --limit 1 | ||||
user: baz | user: baz | ||||
date: Thu Jan 01 00:00:05 1970 +0000 | date: Thu Jan 01 00:00:05 1970 +0000 | ||||
summary: commit 1 | summary: commit 1 | ||||
Bad combination of date options: | Bad combination of date options: | ||||
$ hg amend -D --date '0 0' | $ hg amend -D --date '0 0' | ||||
abort: --date and --currentdate are mutually exclusive | abort: cannot specify both --date and --currentdate | ||||
[255] | [255] | ||||
Close branch | Close branch | ||||
$ hg amend --secret --close-branch | $ hg amend --secret --close-branch | ||||
$ hg log --limit 1 -T 'close={get(extras, "close")}\nphase={phase}\n' | $ hg log --limit 1 -T 'close={get(extras, "close")}\nphase={phase}\n' | ||||
close=1 | close=1 | ||||
phase=secret | phase=secret |
skipping ancestor revision 2:5c095ad7e90f | skipping ancestor revision 2:5c095ad7e90f | ||||
skipping ancestor revision 1:5d205f8b35b6 | skipping ancestor revision 1:5d205f8b35b6 | ||||
[255] | [255] | ||||
Conflicting date/user options: | Conflicting date/user options: | ||||
$ hg up -q 0 | $ hg up -q 0 | ||||
$ hg graft -U --user foo 2 | $ hg graft -U --user foo 2 | ||||
abort: --user and --currentuser are mutually exclusive | abort: cannot specify both --user and --currentuser | ||||
[255] | [255] | ||||
$ hg graft -D --date '0 0' 2 | $ hg graft -D --date '0 0' 2 | ||||
abort: --date and --currentdate are mutually exclusive | abort: cannot specify both --date and --currentdate | ||||
[255] | [255] | ||||
Can't graft with dirty wd: | Can't graft with dirty wd: | ||||
$ hg up -q 0 | $ hg up -q 0 | ||||
$ echo foo > a | $ echo foo > a | ||||
$ hg graft 1 | $ hg graft 1 | ||||
abort: uncommitted changes | abort: uncommitted changes |
user: different user | user: different user | ||||
date: Mon Jun 30 12:12:12 1980 +0000 | date: Mon Jun 30 12:12:12 1980 +0000 | ||||
summary: uncommit with message | summary: uncommit with message | ||||
Bad option combinations | Bad option combinations | ||||
$ hg rollback -q --config ui.rollback=True | $ hg rollback -q --config ui.rollback=True | ||||
$ hg uncommit -U --user 'user' | $ hg uncommit -U --user 'user' | ||||
abort: --user and --currentuser are mutually exclusive | abort: cannot specify both --user and --currentuser | ||||
[255] | [255] | ||||
$ hg uncommit -D --date today | $ hg uncommit -D --date today | ||||
abort: --date and --currentdate are mutually exclusive | abort: cannot specify both --date and --currentdate | ||||
[255] | [255] | ||||
`uncommit <dir>` and `cd <dir> && uncommit .` behave the same... | `uncommit <dir>` and `cd <dir> && uncommit .` behave the same... | ||||
$ echo 2 > dir/file2.txt | $ echo 2 > dir/file2.txt | ||||
$ hg ci -Aqm 'add file2 in directory' | $ hg ci -Aqm 'add file2 in directory' | ||||
$ hg uncommit dir | $ hg uncommit dir | ||||
note: keeping empty commit | note: keeping empty commit |