> + $ 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 @@ > # 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? _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel