# HG changeset patch # User Augie Fackler # Date 1527395378 14400 # Node ID 51e105c7f0c6fe1aece28bc06c177b68c0e789f1 # Parent f8ca09a97492b692fdcd78cca43840bb84cbd64e compathacks: deal with removed aliases in mercurial.util diff --git a/hgsubversion/compathacks.py b/hgsubversion/compathacks.py --- a/hgsubversion/compathacks.py +++ b/hgsubversion/compathacks.py @@ -152,3 +152,15 @@ class _funcregistrarbase(object): """Execute exra setup for registered function, if needed """ pass + +try: + binary = util.binary +except AttributeError: + from mercurial.utils import stringutil + binary = stringutil.binary + +try: + datestr = util.datestr +except AttributeError: + from mercurial.utils import dateutil + datestr = dateutil.datestr diff --git a/hgsubversion/pushmod.py b/hgsubversion/pushmod.py --- a/hgsubversion/pushmod.py +++ b/hgsubversion/pushmod.py @@ -1,6 +1,7 @@ from mercurial import error as hgerror from mercurial import util as hgutil +import compathacks import svnwrap import svnexternals import util @@ -123,7 +124,7 @@ def commit(ui, repo, rev_ctx, meta, base props.setdefault(file, {})['svn:executable'] = '*' if 'l' in fctx.flags(): props.setdefault(file, {})['svn:special'] = '*' - isbinary = hgutil.binary(new_data) + isbinary = compathacks.binary(new_data) if isbinary: props.setdefault(file, {})['svn:mime-type'] = 'application/octet-stream' @@ -151,7 +152,7 @@ def commit(ui, repo, rev_ctx, meta, base base_data = 'link ' + base_data if 'l' not in rev_ctx.filectx(file).flags(): props.setdefault(file, {})['svn:special'] = None - if hgutil.binary(base_data) and not isbinary: + if compathacks.binary(base_data) and not isbinary: props.setdefault(file, {})['svn:mime-type'] = None action = 'modify' else: diff --git a/hgsubversion/svncommands.py b/hgsubversion/svncommands.py --- a/hgsubversion/svncommands.py +++ b/hgsubversion/svncommands.py @@ -9,6 +9,7 @@ from mercurial import node from mercurial import util as hgutil from mercurial import error +import compathacks import svnwrap import svnrepo import util @@ -403,8 +404,9 @@ Last Changed Date: %(date)s\n''' % 'author': author, 'revision': r, # TODO I'd like to format this to the user's local TZ if possible - 'date': hgutil.datestr(parent.date(), - '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)') + 'date': compathacks.datestr( + parent.date(), + '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)') })