[apycotlib] stop using logilab.common.hg (closes #4639284)
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 10 Nov 2014 16:06:08 +0100
changeset 1669 5e6dc151c85f
parent 1571 85eaa0b4425f
child 1670 f6b937183620
[apycotlib] stop using logilab.common.hg (closes #4639284) It was removed in 0.63.0. Use hglib instead, which gives a stable python API to mercurial.
_apycotlib/repositories.py
debian/control
--- a/_apycotlib/repositories.py	Tue Nov 04 14:56:04 2014 +0100
+++ b/_apycotlib/repositories.py	Mon Nov 10 16:06:08 2014 +0100
@@ -183,28 +183,18 @@
         return None
 
     def changeset(self):
-        from logilab.common.hg import get_repository, short
-        repo = get_repository(self.co_path)
-        try: # hg < 1.0 (?)
-            ctx = repo.workingctx()
-        except AttributeError:
-            # hg > 1.0
-            ctx = repo[None]
-        parents = ctx.parents()
+        import hglib
+        with hglib.open(self.co_path) as repo:
+            parents = repo.parents()
         #assert len(parents) == 0 ?
-        return short(parents[0].node())
+        return parents[0].node[:12]
 
     def revision(self):
-        from logilab.common.hg import get_repository
-        repo = get_repository(self.co_path)
-        try: # hg < 1.0 (?)
-            ctx = repo.workingctx()
-        except AttributeError:
-            # hg > 1.0
-            ctx = repo[None]
-        parents = ctx.parents()
+        import hglib
+        with hglib.open(self.co_path) as repo:
+            parents = repo.parents()
         #assert len(parents) == 0 ?
-        return parents[0].rev()
+        return parents[0].rev
 
 register('repository', HGRepository)
 
--- a/debian/control	Tue Nov 04 14:56:04 2014 +0100
+++ b/debian/control	Mon Nov 10 16:06:08 2014 +0100
@@ -36,6 +36,7 @@
  python-unittest2 | python (>= 2.7),
  python-lxml,
  mercurial (>= 2.2),
+ python-hglib,
  ${misc:Depends},
  ${python:Depends},
 Recommends: