Patchwork D7632: graft: reuse cmdutl.resolvecommitoptions()

login
register
mail settings
Submitter phabricator
Date Dec. 13, 2019, 7:56 a.m.
Message ID <differential-rev-PHID-DREV-24wfog5d7ht3szblbnf4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43778/
State Superseded
Headers show

Comments

phabricator - Dec. 13, 2019, 7:56 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7632

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 16, 2019, 5:46 a.m.
This revision is now accepted and ready to land.
pulkit added a comment.
pulkit accepted this revision.


  After this, if both `--currentuser` and `--user` are passed, `--currentuser` takes precedence, which is not the behavior right now. But the new behavior is better and consistent with other commands.

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7632/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7632

To: martinvonz, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2971,14 +2971,7 @@ 
     # list of new nodes created by ongoing graft
     statedata[b'newnodes'] = []
 
-    if opts.get(b'user') and opts.get(b'currentuser'):
-        raise error.Abort(_(b'--user and --currentuser are mutually exclusive'))
-    if opts.get(b'date') and opts.get(b'currentdate'):
-        raise error.Abort(_(b'--date and --currentdate are mutually exclusive'))
-    if not opts.get(b'user') and opts.get(b'currentuser'):
-        opts[b'user'] = ui.username()
-    if not opts.get(b'date') and opts.get(b'currentdate'):
-        opts[b'date'] = b"%d %d" % dateutil.makedate()
+    cmdutil.resolvecommitoptions(ui, opts)
 
     editor = cmdutil.getcommiteditor(
         editform=b'graft', **pycompat.strkwargs(opts)