From b962a1f5e0daad323bdd66fad93f00a3738cc255 Mon Sep 17 00:00:00 2001 From: Anatol Pomazau Date: Thu, 29 Mar 2012 18:06:43 -0700 Subject: [PATCH] Check if SHA1 presents in repository Previously repo had incorrect code that did not really check if sha1 presents in a project. It worked for tags though. Check if a revision (either tag or sha1) is present by using 'git rev_parse' functionality. Change-Id: I1787f3348573948573948753987394839487572b --- project.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/project.py b/project.py index b2eaa878..49fef2f7 100644 --- a/project.py +++ b/project.py @@ -1396,9 +1396,11 @@ class Project(object): if is_sha1 or tag_name is not None: try: - self.GetRevisionId() + # if revision (sha or tag) is not present then following function + # throws an error. + self.bare_git.rev_parse('--verify', '%s^0' % self.revisionExpr) return True - except ManifestInvalidRevisionError: + except GitError: # There is no such persistent revision. We have to fetch it. pass