Adjust Hg._vcs_revision_id to bail cleanly on non-int revids
authorW. Trevor King <wking@drexel.edu>
Sun, 13 Dec 2009 13:03:58 +0000 (08:03 -0500)
committerW. Trevor King <wking@drexel.edu>
Sun, 13 Dec 2009 13:03:58 +0000 (08:03 -0500)
libbe/storage/vcs/base.py
libbe/storage/vcs/hg.py

index 7d17b56db4a574169bfb08d0ea06a319211b2da6..fffabf8110cdacacb19b7a48e072a846bf9531b7 100644 (file)
@@ -36,6 +36,7 @@ import tempfile
 import libbe
 import libbe.storage.base
 import libbe.util.encoding
+from libbe.storage.base import EmptyCommit, InvalidRevision
 from libbe.util.utility import Dir, search_parent_directories
 from libbe.util.subproc import CommandError, invoke
 from libbe.util.plugin import import_by_name
index f1a7eefc2b021faedd6d281f38fa9b8888a870ad..260f0c44dfc98bcdf7e9b192e1decad15dd3c4e9 100644 (file)
@@ -100,6 +100,10 @@ class Hg(base.VCS):
         return self._vcs_revision_id(-1)
 
     def _vcs_revision_id(self, index, style='id'):
+        try:
+            index = str(int(index))
+        except ValueError:
+            return None
         args = ['identify', '--rev', str(int(index)), '--%s' % style]
         kwargs = {'expect': (0,255)}
         status,output,error = self._u_invoke_client(*args, **kwargs)