aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/storage/vcs
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2010-01-20 09:27:16 -0500
committerW. Trevor King <wking@drexel.edu>2010-01-20 09:27:16 -0500
commitd91aae83516d0326a0c4d19153f18d675674cc4c (patch)
tree7fdb1fd763c63b96ec436e9a17ca22bd489652db /libbe/storage/vcs
parent4437e500b4ad6bf7c007d8207928b3b1b0c01d3c (diff)
downloadbugseverywhere-d91aae83516d0326a0c4d19153f18d675674cc4c.tar.gz
Adjust to modern mercurial version definition.
hg-stable$ hg log --patch mercurial/util.py ... changeset: 7640:9626819b2e3d user: Matt Mackall <mpm@selenic.com> date: Sat Jan 10 18:02:38 2009 -0600 summary: refactor version code diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -142,6 +142,14 @@ """Find the length in characters of a local string""" return len(s.decode(_encoding, "replace")) +def version(): + """Return version information if available.""" + try: + import __version__ + return __version__.version + except ImportError: + return 'unknown' + # used by parsedate ... hg-stable$ hg tags ... 1.2 7823:11efa41037e2 1.1.2 7497:11a4eb81fb4f ...
Diffstat (limited to 'libbe/storage/vcs')
-rw-r--r--libbe/storage/vcs/hg.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/libbe/storage/vcs/hg.py b/libbe/storage/vcs/hg.py
index 076943a..4993233 100644
--- a/libbe/storage/vcs/hg.py
+++ b/libbe/storage/vcs/hg.py
@@ -23,11 +23,21 @@ Mercurial (hg) backend.
try:
import mercurial
- import mercurial.version
import mercurial.dispatch
import mercurial.ui
except ImportError:
mercurial = None
+
+try:
+ # mercurial >= 1.2
+ from mercurial.util import version
+except ImportError:
+ try:
+ # mercurial <= 1.1.2
+ from mercurial.version import version
+ except ImportError:
+ version = None
+
import os
import os.path
import re
@@ -57,9 +67,9 @@ class Hg(base.VCS):
self.__updated = [] # work around http://mercurial.selenic.com/bts/issue618
def _vcs_version(self):
- if mercurial == None:
+ if version == None:
return None
- return mercurial.version.get_version()
+ return version()
def _u_invoke_client(self, *args, **kwargs):
if 'cwd' not in kwargs: