hgext/evolve.py
changeset 976 bed842762447
parent 962 d04a52f40f41
child 982 1c7b73739a0d
--- a/hgext/evolve.py	Thu Jun 05 21:27:28 2014 -0400
+++ b/hgext/evolve.py	Fri Jun 06 17:43:45 2014 -0400
@@ -325,6 +325,21 @@
 ### experimental behavior                                         ###
 #####################################################################
 
+commitopts3 = [
+    ('D', 'current-date', None,
+     _('record the current date as commit date')),
+]
+
+def _resolveoptions(opts):
+    """modify commit options dict to handle related options
+
+    For now, all it does is figure out the commit date: respect -D unless
+    -d was supplied.
+    """
+    # N.B. this is extremely similar to setupheaderopts() in mq.py
+    if not opts.get('date') and opts.get('current_date'):
+        opts['date'] = '%d %d' % util.makedate()
+
 @eh.wrapfunction(mercurial.obsolete, 'createmarkers')
 def _createmarkers(orig, repo, relations, *args, **kwargs):
     """register parent information at prune time"""
@@ -1795,7 +1810,7 @@
     ('', 'close-branch', None,
      _('mark a branch as closed, hiding it from the branch list')),
     ('s', 'secret', None, _('use the secret phase for committing')),
-    ] + walkopts + commitopts + commitopts2,
+    ] + walkopts + commitopts + commitopts2 + commitopts3,
     _('[OPTION]... [FILE]...'))
 def amend(ui, repo, *pats, **opts):
     """combine a changeset with updates and replace it with a new one
@@ -1820,6 +1835,7 @@
     opts['amend'] = True
     if not (edit or opts['message']):
         opts['message'] = repo['.'].description()
+    _resolveoptions(opts)
     _alias, commitcmd = cmdutil.findcmd('commit', commands.table)
     return commitcmd[0](ui, repo, *pats, **opts)