summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-03-02 12:56:08 -0800
committerShawn O. Pearce <sop@google.com>2009-03-02 12:56:08 -0800
commit559b846b17a5b720c1247d07e292150466f27f96 (patch)
tree1b0c5ed818859db0ef13b943dc005af4fbdd3289 /project.py
parent7c6c64d463d3baa361ef7bef8ff3149134819c96 (diff)
downloadgit-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.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/project.py b/project.py
index 4780316c..8cdb8b19 100644
--- a/project.py
+++ b/project.py
@@ -25,6 +25,7 @@ from color import Coloring
25from git_command import GitCommand 25from git_command import GitCommand
26from git_config import GitConfig, IsId 26from git_config import GitConfig, IsId
27from error import GitError, ImportError, UploadError 27from error import GitError, ImportError, UploadError
28from error import ManifestInvalidRevisionError
28from remote import Remote 29from remote import Remote
29 30
30HEAD = 'HEAD' 31HEAD = '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: