diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -10,6 +10,7 @@ import errno import os import re +import datetime from .i18n import _ from .node import ( @@ -2545,6 +2546,10 @@ pureextra = extra.copy() extra['amend_source'] = old.hex() + update = ui.configbool('experimental','updatetime') + if update==True: + date=dateutil.parsedate(datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")) + new = context.memctx(repo, parents=[base.node(), old.p2().node()], text=message, diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -440,6 +440,9 @@ coreconfigitem('email', 'to', default=None, ) +coreconfigitem('experimental', 'updatetime', + default=False, +) coreconfigitem('experimental', 'archivemetatemplate', default=dynamicdefault, ) diff --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -365,3 +365,37 @@ $ hg amend #endif + +#if updatetime option is turned on + $ hg amend --date '1997-1-1 0:1' + $ hg log --limit 2 + # changeset: 40473:a092f9df5a43 + # branch: stable + # bookmark: @ + # tag: tip + # parent: 40406:7b48c616431d + # user: Taapas Agrawal + # date: Wed Jan 01 00:01:00 1997 +0530 + # summary: amend:Added current time update config option(issue5828) + # + # changeset: 40472:03f7d0822ec1 + # branch: stable + # user: Yuya Nishihara + # date: Tue Dec 11 22:34:07 2018 +0900 + # summary: worker: do not swallow exception occurred in main process + $ hg amend --config experimental.updatetime=True + $ hg log --limit 2 + # changeset: 40473:1cfd775235f0 + # branch: stable + # bookmark: @ + # tag: tip + # parent: 40406:7b48c616431d + # user: Taapas Agrawal + # date: Tue Dec 25 18:58:20 2018 +0530 + # summary: amend:Added current time update config option(issue5828) + # + # changeset: 40472:03f7d0822ec1 + # branch: stable + # user: Yuya Nishihara + # date: Tue Dec 11 22:34:07 2018 +0900 + # summary: worker: do not swallow exception occurred in main process \ No newline at end of file