diff --git a/hggit/compat.py b/hggit/compat.py
index bec3bd68f01127284b44716f6c116484fc1a4d03_aGdnaXQvY29tcGF0LnB5..650eadb49d73f9e322a1669ff9679a816df8eb0b_aGdnaXQvY29tcGF0LnB5 100644
--- 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