diff options
author | Shawn O. Pearce <sop@google.com> | 2009-03-02 12:56:08 -0800 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-03-02 12:56:08 -0800 |
commit | 559b846b17a5b720c1247d07e292150466f27f96 (patch) | |
tree | 1b0c5ed818859db0ef13b943dc005af4fbdd3289 /project.py | |
parent | 7c6c64d463d3baa361ef7bef8ff3149134819c96 (diff) | |
download | git-repo-559b846b17a5b720c1247d07e292150466f27f96.tar.gz |
Report better errors when a project revision is invalid
If a manifest specifies an invalid revision property, give the
user a better error message detaling the problem, instead of an
ugly Python traceback with a strange Git error message.
Bug: REPO-2
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -25,6 +25,7 @@ from color import Coloring | |||
25 | from git_command import GitCommand | 25 | from git_command import GitCommand |
26 | from git_config import GitConfig, IsId | 26 | from git_config import GitConfig, IsId |
27 | from error import GitError, ImportError, UploadError | 27 | from error import GitError, ImportError, UploadError |
28 | from error import ManifestInvalidRevisionError | ||
28 | from remote import Remote | 29 | from remote import Remote |
29 | 30 | ||
30 | HEAD = 'HEAD' | 31 | HEAD = 'HEAD' |
@@ -582,6 +583,12 @@ class Project(object): | |||
582 | 583 | ||
583 | rem = self.GetRemote(self.remote.name) | 584 | rem = self.GetRemote(self.remote.name) |
584 | rev = rem.ToLocal(self.revision) | 585 | rev = rem.ToLocal(self.revision) |
586 | try: | ||
587 | self.bare_git.rev_parse('--verify', '%s^0' % rev) | ||
588 | except GitError: | ||
589 | raise ManifestInvalidRevisionError( | ||
590 | 'revision %s in %s not found' % (self.revision, self.name)) | ||
591 | |||
585 | branch = self.CurrentBranch | 592 | branch = self.CurrentBranch |
586 | 593 | ||
587 | if branch is None: | 594 | if branch is None: |