diff options
author | Anatol Pomazau <anatol@google.com> | 2012-03-29 18:06:43 -0700 |
---|---|---|
committer | Anatol Pomazau <anatol@google.com> | 2012-04-23 11:09:17 -0700 |
commit | b962a1f5e0daad323bdd66fad93f00a3738cc255 (patch) | |
tree | aa93a22bdec6f982cfee5c3ab5d1f5361f7bd9e9 | |
parent | 5acde75e5d70b323197ffb2c9d4fdea3612098f5 (diff) | |
download | git-repo-b962a1f5e0daad323bdd66fad93f00a3738cc255.tar.gz |
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
-rw-r--r-- | project.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1396,9 +1396,11 @@ class Project(object): | |||
1396 | 1396 | ||
1397 | if is_sha1 or tag_name is not None: | 1397 | if is_sha1 or tag_name is not None: |
1398 | try: | 1398 | try: |
1399 | self.GetRevisionId() | 1399 | # if revision (sha or tag) is not present then following function |
1400 | # throws an error. | ||
1401 | self.bare_git.rev_parse('--verify', '%s^0' % self.revisionExpr) | ||
1400 | return True | 1402 | return True |
1401 | except ManifestInvalidRevisionError: | 1403 | except GitError: |
1402 | # There is no such persistent revision. We have to fetch it. | 1404 | # There is no such persistent revision. We have to fetch it. |
1403 | pass | 1405 | pass |
1404 | 1406 | ||