fix use of mercurial API to be compatible with 1.3.1 - this breaks backwards-compability, though...
authorTero Marttila <terom@fixme.fi>
Sun, 13 Sep 2009 00:49:29 +0300
changeset 138 7dbe0ee1a27b
parent 137 a25d1bf758e6
child 139 9c7769850195
fix use of mercurial API to be compatible with 1.3.1 - this breaks backwards-compability, though...
version.py
--- a/version.py	Mon Feb 16 03:25:00 2009 +0200
+++ b/version.py	Sun Sep 13 00:49:29 2009 +0300
@@ -19,17 +19,17 @@
         return _VERSION
 
     # code adapted from mercurial.commands.identify
-    from mercurial import ui, hg, util
+    from mercurial import ui, hg, encoding
     from mercurial.node import short
     
     # open the repo
     repo = hg.repository(ui.ui(), path)
 
     # the working copy change context
-    ctx = repo.workingctx()
+    ctx = repo[None]
 
     # branch
-    branch = util.tolocal(ctx.branch())
+    branch = encoding.tolocal(ctx.branch())
     
     # map default -> None
     if branch == 'default' :
@@ -55,8 +55,13 @@
         Currently, this assumes that the given path points to a local Mercurial repo.
     """
     
-    # get info
-    branch, tags, parents, modified = version_mercurial(path)
+    try :
+        # get info
+        branch, tags, parents, modified = version_mercurial(path)
+
+    except :
+        # XXX: ignore
+        raise
 
     # tags: <tag> [ "-" <tag> [ ... ]]
     if tags :