From: W. Trevor King Date: Sun, 13 Dec 2009 13:12:47 +0000 (-0500) Subject: Handle non-int args to VCS.revision_id at the VCS level. X-Git-Tag: 1.0.0~59^2~52^2~75 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9fa977a31982a2eda08c2c18ade73bd114f477b1;p=be.git Handle non-int args to VCS.revision_id at the VCS level. --- diff --git a/libbe/storage/vcs/base.py b/libbe/storage/vcs/base.py index fffabf8..fc3427a 100644 --- a/libbe/storage/vcs/base.py +++ b/libbe/storage/vcs/base.py @@ -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) diff --git a/libbe/storage/vcs/hg.py b/libbe/storage/vcs/hg.py index 260f0c4..f1a7eef 100644 --- a/libbe/storage/vcs/hg.py +++ b/libbe/storage/vcs/hg.py @@ -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)