# HG changeset patch # User Sean Farley # Date 1527153975 -7200 # Node ID 80664524802b966be41e8dfac94b2eab5ae8f735 # Parent 5edabf9db7485a274662fb77863bcdcb33b3f6c7 compat: add compatibility for 4.6 mercurial.utils diff -r 5edabf9db748 -r 80664524802b hggit/_ssh.py --- a/hggit/_ssh.py Thu May 24 09:50:04 2018 +0200 +++ b/hggit/_ssh.py Thu May 24 11:26:15 2018 +0200 @@ -1,9 +1,6 @@ from dulwich.client import SubprocessWrapper import subprocess - -from mercurial import ( - util, -) +import compat class SSHVendor(object): @@ -27,11 +24,11 @@ # expects (e.g. "command 'arg1 arg2'") command = ["%s '%s'" % (command[0], ' '.join(command[1:]))] sshcmd = ui.config("ui", "ssh", "ssh") - args = util.sshargs(sshcmd, host, username, port) + args = compat.sshargs(sshcmd, host, username, port) cmd = '%s %s %s' % (sshcmd, args, - util.shellquote(' '.join(command))) + compat.shellquote(' '.join(command))) ui.debug('calling ssh: %s\n' % cmd) - proc = subprocess.Popen(util.quotecommand(cmd), shell=True, + proc = subprocess.Popen(compat.quotecommand(cmd), shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) return SubprocessWrapper(proc) diff -r 5edabf9db748 -r 80664524802b hggit/compat.py --- a/hggit/compat.py Thu May 24 09:50:04 2018 +0200 +++ b/hggit/compat.py Thu May 24 11:26:15 2018 +0200 @@ -37,6 +37,19 @@ from mercurial import scmutil hgvfs = scmutil.vfs +try: + from mercurial.utils import procutil, stringutil + sshargs = procutil.sshargs + shellquote = procutil.shellquote + quotecommand = procutil.quotecommand + binary = stringutil.binary +except ImportError: + # these were moved in 4.6 + sshargs = hgutil.sshargs + shellquote = hgutil.shellquote + quotecommand = hgutil.quotecommand + binary = hgutil.binary + def gitvfs(repo): """return a vfs suitable to read git related data""" diff -r 5edabf9db748 -r 80664524802b hggit/overlay.py --- a/hggit/overlay.py Thu May 24 09:50:04 2018 +0200 +++ b/hggit/overlay.py Thu May 24 11:26:15 2018 +0200 @@ -14,6 +14,7 @@ ) from mercurial.node import bin, hex, nullid +import compat def _maybehex(n): if len(n) == 20: @@ -207,7 +208,7 @@ return blob.data def isbinary(self): - return util.binary(self.data()) + return compat.binary(self.data()) class overlaychangectx(context.changectx):