diff options
-rw-r--r-- | error.py | 4 | ||||
-rwxr-xr-x | main.py | 4 | ||||
-rw-r--r-- | project.py | 7 |
3 files changed, 15 insertions, 0 deletions
@@ -17,6 +17,10 @@ class ManifestParseError(Exception): | |||
17 | """Failed to parse the manifest file. | 17 | """Failed to parse the manifest file. |
18 | """ | 18 | """ |
19 | 19 | ||
20 | class ManifestInvalidRevisionError(Exception): | ||
21 | """The revision value in a project is incorrect. | ||
22 | """ | ||
23 | |||
20 | class EditorError(Exception): | 24 | class EditorError(Exception): |
21 | """Unspecified error from the user's text editor. | 25 | """Unspecified error from the user's text editor. |
22 | """ | 26 | """ |
@@ -29,6 +29,7 @@ import sys | |||
29 | 29 | ||
30 | from command import InteractiveCommand, PagedCommand | 30 | from command import InteractiveCommand, PagedCommand |
31 | from editor import Editor | 31 | from editor import Editor |
32 | from error import ManifestInvalidRevisionError | ||
32 | from error import NoSuchProjectError | 33 | from error import NoSuchProjectError |
33 | from error import RepoChangedException | 34 | from error import RepoChangedException |
34 | from manifest import Manifest | 35 | from manifest import Manifest |
@@ -94,6 +95,9 @@ class _Repo(object): | |||
94 | copts, cargs = cmd.OptionParser.parse_args(argv) | 95 | copts, cargs = cmd.OptionParser.parse_args(argv) |
95 | try: | 96 | try: |
96 | cmd.Execute(copts, cargs) | 97 | cmd.Execute(copts, cargs) |
98 | except ManifestInvalidRevisionError, e: | ||
99 | print >>sys.stderr, 'error: %s' % str(e) | ||
100 | sys.exit(1) | ||
97 | except NoSuchProjectError, e: | 101 | except NoSuchProjectError, e: |
98 | if e.name: | 102 | if e.name: |
99 | print >>sys.stderr, 'error: project %s not found' % e.name | 103 | print >>sys.stderr, 'error: project %s not found' % e.name |
@@ -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: |