aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/hg.py
diff options
context:
space:
mode:
Diffstat (limited to 'libbe/hg.py')
-rw-r--r--libbe/hg.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/libbe/hg.py b/libbe/hg.py
index a20eeb5..31df1d0 100644
--- a/libbe/hg.py
+++ b/libbe/hg.py
@@ -80,14 +80,17 @@ class Hg(RCS):
strings = ["nothing changed"]
if self._u_any_in_string(strings, output) == True:
raise rcs.EmptyCommit()
- status,output,error = self._u_invoke_client('identify')
- revision = None
- revline = re.compile("(.*) tip")
- match = revline.search(output)
- assert match != None, output+error
- assert len(match.groups()) == 1
- revision = match.groups()[0]
- return revision
+ return self._rcs_revision_id(-1)
+ def _rcs_revision_id(self, index, style="id"):
+ args = ["identify", "--rev", str(int(index)), "--%s" % style]
+ kwargs = {"expect": (0,255)}
+ status,output,error = self._u_invoke_client(*args, **kwargs)
+ if status == 0:
+ id = output.strip()
+ if id == '000000000000':
+ return None # before initial commit.
+ return id
+ return None
rcs.make_rcs_testcase_subclasses(Hg, sys.modules[__name__])