e16ee632ce6f

Fix compatibility bug for count. `revrange' has been moved into the `scmutil' module since v1.9.
[view raw] [browse files]
author Yujie Wu <yujie.wu2@gmail.com>
date Fri, 10 Feb 2012 19:31:25 -0500
parents 0649e77b06d0
children 661dbd42f386
branches/tags (none)
files prompt.py

Changes

--- a/prompt.py	Fri Jan 27 11:42:53 2012 -0500
+++ b/prompt.py	Fri Feb 10 19:31:25 2012 -0500
@@ -18,6 +18,13 @@
 from mercurial import extensions, commands, cmdutil, help
 from mercurial.node import hex, short
 
+# `revrange' has been moved into module `scmutil' since v1.9.
+try :
+    from mercurial import scmutil
+    revrange = scmutil.revrange
+except :
+    revrange = cmdutil.revrange
+
 CACHE_PATH = ".hg/prompt/cache"
 CACHE_TIMEOUT = timedelta(minutes=15)
 
@@ -132,7 +139,7 @@
     def _count(m):
         g = m.groups()
         query = [g[1][1:]] if g[1] else ['all()']
-        return _with_groups(g, str(len(cmdutil.revrange(repo, query))))
+        return _with_groups(g, str(len(revrange(repo, query))))
 
     def _node(m):
         g = m.groups()