Patchwork D5483: amend:Added rewrite.updatetimestamp config option(issue5828)

login
register
mail settings
Submitter phabricator
Date Dec. 26, 2018, 2:02 p.m.
Message ID <8cf4c0a5397feb324456e941064827f2@localhost.localdomain>
Download mbox | patch
Permalink /patch/37350/
State Not Applicable
Headers show

Comments

phabricator - Dec. 26, 2018, 2:02 p.m.
taapas1128 updated this revision to Diff 12979.
taapas1128 retitled this revision from "amend:Added current time update config option(issue5828)" to "amend:Added  rewrite.updatetimestamp config option(issue5828)".

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5483?vs=12977&id=12979

REVISION DETAIL
  https://phab.mercurial-scm.org/D5483

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/configitems.py
  tests/test-amend.t

CHANGE DETAILS




To: taapas1128, #hg-reviewers
Cc: yuja, mercurial-devel
Yuya Nishihara - Dec. 27, 2018, 12:04 p.m.
> +$ hg amend --config rewrite.updatetimestamp=True
> +$ hg log --limit 2
> +changeset:   40473:e64479cbaf37

Okay, so these tests don't run because these lines don't start with `  $`.

> +coreconfigitem('rewrite', 'updatetimestamp',

Need dash per https://www.mercurial-scm.org/wiki/UIGuideline#config

And please update mercurial/help/config.txt as well.

> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -2545,6 +2545,10 @@
>          pureextra = extra.copy()
>          extra['amend_source'] = old.hex()
>  
> +        updatetime = ui.configbool('rewrite','updatetimestamp')
> +        if updatetime==True:

`if updatetime:` (or simply `if ui.configbool(...):`)
phabricator - Dec. 27, 2018, 12:12 p.m.
yuja added a comment.


  > +$ hg amend --config rewrite.updatetimestamp=True
  >  +$ hg log --limit 2
  >  +changeset:   40473:e64479cbaf37
  
  Okay, so these tests don't run because these lines don't start with `  $`.
  
  > +coreconfigitem('rewrite', 'updatetimestamp',
  
  Need dash per https://www.mercurial-scm.org/wiki/UIGuideline#config
  
  And please update mercurial/help/config.txt as well.
  
  > diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
  > 
  > - a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2545,6 +2545,10 @@ pureextra = extra.copy() extra['amend_source'] = old.hex()
  > 
  >   +        updatetime = ui.configbool('rewrite','updatetimestamp') +        if updatetime==True:
  
  `if updatetime:` (or simply `if ui.configbool(...):`)

REVISION DETAIL
  https://phab.mercurial-scm.org/D5483

To: taapas1128, #hg-reviewers
Cc: yuja, mercurial-devel

Patch

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@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@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.updatetimestamp=True
+$ hg log --limit 2
+changeset:   40473:e64479cbaf37
+branch:      stable
+bookmark:    @
+tag:         tip
+parent:      40406:7b48c616431d
+user:        Taapas Agrawal<taapas2897@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@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/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', 'updatetimestamp',
+    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,10 @@ 
         pureextra = extra.copy()
         extra['amend_source'] = old.hex()
 
+        updatetime = ui.configbool('rewrite','updatetimestamp')
+        if updatetime==True:
+             date = dateutil.makedate()
+        
         new = context.memctx(repo,
                              parents=[base.node(), old.p2().node()],
                              text=message,