diff mercurial/cmdutil.py @ 41128:126101284e04

amend: add -D/--currentdate option It bumps the date field even if there's no other change. The help text is copied from commands.graft(). Unlike graft, --date with --currentdate is disallowed, which I think is saner behavior.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 07 Jan 2019 21:43:06 +0900
parents cffa8e0ba77a
children 4145fd3569c3
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon Jan 07 21:39:35 2019 +0900
+++ b/mercurial/cmdutil.py	Mon Jan 07 21:43:06 2019 +0900
@@ -2443,8 +2443,13 @@
         user = opts.get('user') or old.user()
 
         datemaydiffer = False  # date-only change should be ignored?
+        if opts.get('date') and opts.get('currentdate'):
+            raise error.Abort(_('--date and --currentdate are mutually '
+                                'exclusive'))
         if opts.get('date'):
             date = dateutil.parsedate(opts.get('date'))
+        elif opts.get('currentdate'):
+            date = dateutil.makedate()
         elif ui.configbool('rewrite', 'update-timestamp'):
             date = dateutil.makedate()
             datemaydiffer = True