aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'libbe/git.py')
-rw-r--r--libbe/git.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/libbe/git.py b/libbe/git.py
index 2f9ffa9..f7e9646 100644
--- a/libbe/git.py
+++ b/libbe/git.py
@@ -111,7 +111,23 @@ class Git(RCS):
assert match != None, output+error
assert len(match.groups()) == 3
revision = match.groups()[1]
- return revision
+ full_revision = self._rcs_revision_id(-1)
+ assert full_revision.startswith(revision), \
+ "Mismatched revisions:\n%s\n%s" % (revision, full_revision)
+ return full_revision
+ def _rcs_revision_id(self, index):
+ args = ["rev-list", "--first-parent", "--reverse", "HEAD"]
+ kwargs = {"expect":(0,128)}
+ status,output,error = self._u_invoke_client(*args, **kwargs)
+ if status == 128:
+ if error.startswith("fatal: ambiguous argument 'HEAD': unknown "):
+ return None
+ raise rcs.CommandError(args, status, error)
+ commits = output.splitlines()
+ try:
+ return commits[index]
+ except IndexError:
+ return None
rcs.make_rcs_testcase_subclasses(Git, sys.modules[__name__])