diff -r ff1ff2aae132 -r 66048f6b5d0d mercurial/cmdutil.py --- a/mercurial/cmdutil.py Sat Sep 07 13:44:29 2019 -0400 +++ b/mercurial/cmdutil.py Sat Sep 07 23:20:11 2019 -0400 @@ -100,6 +100,13 @@ _('record the specified user as committer'), _('USER')), ] +commitopts3 = [ + (b'D', b'current-date', None, + _(b'record the current date as commit date')), + (b'U', b'current-user', None, + _(b'record the current user as committer')), +] + formatteropts = [ ('T', 'template', '', _('display with template'), _('TEMPLATE')), @@ -175,6 +182,15 @@ # editor text _linebelow = "^HG: ------------------------ >8 ------------------------$" +def resolvecommitoptions(ui, opts): + """modify commit options dict to handle related options + """ + # N.B. this is extremely similar to setupheaderopts() in mq.py + if not opts.get(b'date') and opts.get(b'current_date'): + opts[b'date'] = b'%d %d' % dateutil.makedate() + if not opts.get(b'user') and opts.get(b'current_user'): + opts[b'user'] = ui.username() + def ishunk(x): hunkclasses = (crecordmod.uihunk, patch.recordhunk) return isinstance(x, hunkclasses)