Mercurial > evolve
changeset 5178:61e49d2654cc
compat: directly use function from dateutil
Since support for 4.5 have been dropped we no longer needs this indirection.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 10 Mar 2020 11:07:34 +0100 |
parents | 9f3ad17b62ef |
children | 7c41a1ebcf7f |
files | hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py hgext3rd/evolve/rewind.py |
diffstat | 3 files changed, 8 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py Wed Mar 04 16:14:03 2020 +0100 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Mar 10 11:07:34 2020 +0100 @@ -33,6 +33,8 @@ util, ) +from mercurial.utils import dateutil + from mercurial.i18n import _ from . import ( @@ -74,7 +76,7 @@ """ # N.B. this is extremely similar to setupheaderopts() in mq.py if not opts.get('date') and opts.get('current_date'): - opts['date'] = b'%d %d' % compat.makedate() + opts['date'] = b'%d %d' % dateutil.makedate() if not opts.get('user') and opts.get('current_user'): opts['user'] = ui.username() @@ -267,7 +269,7 @@ fp.write(b"# HG changeset patch\n") fp.write(b"# User %s\n" % ctx.user()) fp.write(b"# Date %d %d\n" % ctx.date()) - fp.write(b"# %s\n" % compat.datestr(ctx.date())) + fp.write(b"# %s\n" % dateutil.datestr(ctx.date())) if branch and branch != b'default': fp.write(b"# Branch %s\n" % branch) fp.write(b"# Node ID %s\n" % node.hex(nodeval)) @@ -970,7 +972,7 @@ date = opts.get('date') user = opts.get('user') if date: - metadata[b'date'] = b'%i %i' % compat.parsedate(date) + metadata[b'date'] = b'%i %i' % dateutil.parsedate(date) if user: metadata[b'user'] = user return metadata
--- a/hgext3rd/evolve/compat.py Wed Mar 04 16:14:03 2020 +0100 +++ b/hgext3rd/evolve/compat.py Tue Mar 10 11:07:34 2020 +0100 @@ -126,20 +126,6 @@ return mdiff.unidiff(*args) -# date related - -# hg <= 4.5 (c6061cadb400) -try: - import mercurial.utils.dateutil - datestr = mercurial.utils.dateutil.datestr - makedate = mercurial.utils.dateutil.makedate - parsedate = mercurial.utils.dateutil.parsedate -except ImportError: - import mercurial.util - datestr = mercurial.util.datestr # pytype: disable=module-attr - makedate = mercurial.util.makedate # pytype: disable=module-attr - parsedate = mercurial.util.parsedate # pytype: disable=module-attr - def wireprotocommand(exthelper, name, args=b'', permission=b'pull'): try: # Since b4d85bc1
--- a/hgext3rd/evolve/rewind.py Wed Mar 04 16:14:03 2020 +0100 +++ b/hgext3rd/evolve/rewind.py Tue Mar 10 11:07:34 2020 +0100 @@ -12,6 +12,8 @@ scmutil, ) +from mercurial.utils import dateutil + from mercurial.i18n import _ from . import ( @@ -194,7 +196,7 @@ user = unfi.ui.username() date = unfi.ui.configdate(b'devel', b'default-date') if date is None: - date = compat.makedate() + date = dateutil.makedate() noise = b"%s\0%s\0%d\0%d" % (ctx.node(), user, date[0], date[1]) extra[b'__rewind-hash__'] = hashlib.sha256(noise).hexdigest()