diff mercurial/cmdutil.py @ 42921:4690902850df

uncommit: make -D/--date and -U/--user mutually exclusive This is how amend and graft work (but not MQ). I'm not sure why this didn't work for me when I first tried it. Differential Revision: https://phab.mercurial-scm.org/D6842
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 10 Sep 2019 22:52:04 -0400
parents a50661567f83
children e4803231f538
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Sep 10 22:04:22 2019 -0400
+++ b/mercurial/cmdutil.py	Tue Sep 10 22:52:04 2019 -0400
@@ -185,10 +185,17 @@
 def resolvecommitoptions(ui, opts):
     """modify commit options dict to handle related options
     """
+    if opts.get('date') and opts.get('currentdate'):
+        raise error.Abort(_('--date and --currentdate are mutually '
+                            'exclusive'))
+    if opts.get(b'user') and opts.get(b'currentuser'):
+        raise error.Abort(_('--user and --currentuser are mutually '
+                            'exclusive'))
+
     # N.B. this is extremely similar to setupheaderopts() in mq.py
-    if not opts.get(b'date') and opts.get(b'currentdate'):
+    if opts.get(b'currentdate'):
         opts[b'date'] = b'%d %d' % dateutil.makedate()
-    if not opts.get(b'user') and opts.get(b'currentuser'):
+    if opts.get(b'currentuser'):
         opts[b'user'] = ui.username()
 
 def ishunk(x):