# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1592007709 -7200
#      Sat Jun 13 02:21:49 2020 +0200
# Node ID 650eadb49d73f9e322a1669ff9679a816df8eb0b
# Parent  bec3bd68f01127284b44716f6c116484fc1a4d03
compat: add case for removed procutil.quotecommand() in Mercurial

diff --git a/hggit/compat.py b/hggit/compat.py
--- a/hggit/compat.py
+++ b/hggit/compat.py
@@ -1,5 +1,7 @@
 from __future__ import absolute_import, print_function
 
+import sys
+
 from mercurial import (
     context,
     pycompat,
@@ -21,7 +23,14 @@
     from mercurial.utils import procutil, stringutil
     sshargs = procutil.sshargs
     shellquote = procutil.shellquote
-    quotecommand = procutil.quotecommand
+    try:
+        quotecommand = procutil.quotecommand
+    except AttributeError:
+        # procutil.quotecommand() returned the argument unchanged on Python
+        # >= 2.7.1 and was removed after Mercurial raised the minimum
+        # Python version to 2.7.4.
+        assert sys.version_info[:3] >= (2, 7, 1)
+        quotecommand = pycompat.identity
     binary = stringutil.binary
 except ImportError:
     # these were moved in 4.6