D5554: histedit: added rewrite.update-timestamp to fold and mess

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Sat Jan 12 20:55:37 EST 2019


yuja added a comment.


  > +  $ cat >> testmocks.py << EOF
  >  +  > # mock out util.makedate() to supply testable values
  >  +  > import os
  >  +  > from mercurial import pycompat, util
  >  +  > from mercurial.utils import dateutil
  >  +  > 
  >  +  > def mockmakedate():
  >  +  >     filename = os.path.join(os.environ['TESTTMP'], 'testtime')
  >  +  >     try:
  >  +  >         with open(filename, 'rb') as timef:
  >  +  >             time = float(timef.read()) + 1
  >  +  >     except IOError:
  >  +  >         time = 0.0
  >  +  >     with open(filename, 'wb') as timef:
  >  +  >         timef.write(pycompat.bytestr(time))
  >  +  >     return (time, 0)
  >  +  > 
  >  +  > dateutil.makedate = mockmakedate
  >  +  > EOF
  
  Perhaps, it's time to extract the mockmakedate extension to
  `tests/mockmakedate.py`.
  
  > @@ -519,9 +520,12 @@
  > 
  >   editor = self.commiteditor()
  >   commit = commitfuncfor(repo, rulectx)
  > 
  > - +        if repo.ui.configbool('rewrite','update-timestamp'):
  
  Style nit: insert space after comma.
  
  > +            date = dateutil.makedate()
  >  +        else :
  
  and no space after `else`.
  
  >   def commiteditor(self):
  >       """The editor to be used to edit the commit message."""
  > 
  > @@ -800,6 +804,8 @@
  > 
  > 1. date if self.firstdate(): commitopts['date'] = ctx.date() +        elif ui.configbool('rewrite','update-timestamp'): +            commitopts['date'] = dateutil.makedate() else: commitopts['date'] = max(ctx.date(), oldctx.date())
  
  I'm not pretty sure, but shouldn't we always update the date if update-timestamp
  is on?

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list