Handle non-int args to VCS.revision_id at the VCS level.
authorW. Trevor King <wking@drexel.edu>
Sun, 13 Dec 2009 13:12:47 +0000 (08:12 -0500)
committerW. Trevor King <wking@drexel.edu>
Sun, 13 Dec 2009 13:12:47 +0000 (08:12 -0500)
libbe/storage/vcs/base.py
libbe/storage/vcs/hg.py

index fffabf8110cdacacb19b7a48e072a846bf9531b7..fc3427a75df0508a1a2ea23b4e24976dc1e9bd8b 100644 (file)
@@ -755,6 +755,11 @@ os.listdir(self.get_path("bugs")):
     def revision_id(self, index=None):
         if index == None:
             return None
+        try:
+            if int(index) != index:
+                raise InvalidRevision(index)
+        except ValueError:
+            raise InvalidRevision(index)
         revid = self._vcs_revision_id(index)
         if revid == None:
             raise libbe.storage.base.InvalidRevision(index)
index 260f0c44dfc98bcdf7e9b192e1decad15dd3c4e9..f1a7eefc2b021faedd6d281f38fa9b8888a870ad 100644 (file)
@@ -100,10 +100,6 @@ 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)