D5483: amend:added rewrite.updatetimestamp config option(issue5828)
taapas1128 (Taapas Agrawal)
phabricator at mercurial-scm.org
Thu Dec 27 08:47:08 EST 2018
taapas1128 updated this revision to Diff 12987.
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5483?vs=12979&id=12987
REVISION DETAIL
https://phab.mercurial-scm.org/D5483
AFFECTED FILES
mercurial/cmdutil.py
mercurial/configitems.py
mercurial/help/config.txt
tests/test-amend.t
CHANGE DETAILS
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,41 @@
$ hg amend
#endif
+
+# When updatetimestamp is False
+
+ $ hg amend --date '1997-1-1 0:1'
+ $ hg log --limit 2
+changeset: 40473:c07936668d6f
+branch: stable
+bookmark: @
+tag: tip
+parent: 40406:7b48c616431d
+user: Taapas Agrawal<taapas2897 at gmail.com>
+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 <yuya at tcha.org>
+date: Tue Dec 11 22:34:07 2018 +0900
+summary: worker: do not swallow exception occurred in main process
+
+# When updatetimestamp is True
+
+ $ hg amend --config rewrite.update-timestamp=True
+ $ hg log --limit 2
+changeset: 40473:e64479cbaf37
+branch: stable
+bookmark: @
+tag: tip
+parent: 40406:7b48c616431d
+user: Taapas Agrawal<taapas2897 at gmail.com>
+date: Wed Dec 26 19:11:08 2018 +0530
+summary: amend:Added current time update config option(issue5828)
+
+changeset: 40472:03f7d0822ec1
+branch: stable
+user: Yuya Nishihara <yuya at tcha.org>
+date: Tue Dec 11 22:34:07 2018 +0900
+summary: worker: do not swallow exception occurred in main process
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -1806,6 +1806,13 @@
Alias definitions for revsets. See :hg:`help revsets` for details.
+``rewrite``
+-----------
+
+``update-timestamp``
+ If true updates the date and time of the changeset to current.It is only
+ applicable for hg amend in current version.
+
``storage``
-----------
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -961,6 +961,9 @@
coreconfigitem('push', 'pushvars.server',
default=False,
)
+coreconfigitem('rewrite', 'update-timestamp',
+ default=False,
+)
coreconfigitem('storage', 'new-repo-backend',
default='revlogv1',
)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2545,6 +2545,9 @@
pureextra = extra.copy()
extra['amend_source'] = old.hex()
+ if ui.configbool('rewrite','update-timestamp')==True:
+ date = dateutil.makedate()
+
new = context.memctx(repo,
parents=[base.node(), old.p2().node()],
text=message,
To: taapas1128, #hg-reviewers
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list