Mercurial > evolve
changeset 3675:1dccccde82bb
compat: access datestr in a way compatible with verison prior to 4.6
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 17 Apr 2018 19:42:46 +0200 |
parents | 51adc7e6a617 |
children | cded30ad25e4 |
files | hgext3rd/evolve/cmdrewrite.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py Tue Apr 17 19:42:26 2018 +0200 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Apr 17 19:42:46 2018 +0200 @@ -34,7 +34,10 @@ from mercurial.i18n import _ -from mercurial.utils import dateutil +try: + from mercurial.utils.dateutil import datestr +except ImportError: # hg <= 4.5 + from mercurial.util import datestr from . import ( compat, @@ -277,7 +280,7 @@ fp.write("# HG changeset patch\n") fp.write("# User %s\n" % ctx.user()) fp.write("# Date %d %d\n" % ctx.date()) - fp.write("# %s\n" % dateutil.datestr(ctx.date())) + fp.write("# %s\n" % datestr(ctx.date())) if branch and branch != 'default': fp.write("# Branch %s\n" % branch) fp.write("# Node ID %s\n" % node.hex(nodeval))