diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2558,13 +2558,17 @@ if ((not changes) and newdesc == old.description() and user == old.user() - and date == old.date() and pureextra == old.extra()): - # nothing changed. continuing here would create a new node - # anyway because of the amend_source noise. - # - # This not what we expect from amend. - return old.node() + + # If the date is same or + # the user doesn't want to create a date only change amend + if date == old.date() or ui.configbool('experimental', + 'amend.dateonly'): + # nothing changed. continuing here would create a new node + # anyway because of the amend_source noise. + # + # This not what we expect from amend. + return old.node() commitphase = None if opts.get('secret'): diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -437,6 +437,9 @@ coreconfigitem('email', 'to', default=None, ) +coreconfigitem('experimental', 'amend.dateonly', + 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,40 @@ $ hg amend #endif + + $ hg status + $ hg diff + $ hg amend --date '1980-1-1 0:1' + $ hg export + # HG changeset patch + # User test + # Date 315532860 0 + # Tue Jan 01 00:01:00 1980 +0000 + # Node ID 67c8ed970566d909b4759ad6db6048ea9080743b + # Parent cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b + b + + diff --git a/b b/b + new file mode 100644 + --- /dev/null + +++ b/b + @@ -0,0 +1,1 @@ + +fixed + $ hg amend --date '1990-1-1 0:1' --config experimental.amend.dateonly=True + nothing changed + [1] + $ hg export + # HG changeset patch + # User test + # Date 315532860 0 + # Tue Jan 01 00:01:00 1980 +0000 + # Node ID 67c8ed970566d909b4759ad6db6048ea9080743b + # Parent cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b + b + + diff --git a/b b/b + new file mode 100644 + --- /dev/null + +++ b/b + @@ -0,0 +1,1 @@ + +fixed