diff options
author | Conley Owens <cco3@android.com> | 2012-11-15 17:33:11 -0800 |
---|---|---|
committer | Conley Owens <cco3@android.com> | 2012-11-15 18:50:11 -0800 |
commit | 75ee0570da09abb1d2bbefe0d25f0560727e6b71 (patch) | |
tree | c62ab4990212282d9c18c694ec21830ad33481f2 /project.py | |
parent | 88b86728a4451b97a2c6dcae2feb98014c077793 (diff) | |
download | git-repo-75ee0570da09abb1d2bbefe0d25f0560727e6b71.tar.gz |
Raise a NoManifestException when the manifest DNE
When a command (eg, `repo forall`) expects the manifest project to
exist, but there is no manifest, an IOException gets raised. This
change defines a new Exception type to be raised in these cases and
raises it when project.py fails to read the manifest.
Change-Id: Iac576c293a37f7d8f60cd4f6aa95b2c97f9e7957
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -30,6 +30,7 @@ from git_command import GitCommand, git_require | |||
30 | from git_config import GitConfig, IsId, GetSchemeFromUrl, ID_RE | 30 | from git_config import GitConfig, IsId, GetSchemeFromUrl, ID_RE |
31 | from error import GitError, HookError, UploadError | 31 | from error import GitError, HookError, UploadError |
32 | from error import ManifestInvalidRevisionError | 32 | from error import ManifestInvalidRevisionError |
33 | from error import NoManifestException | ||
33 | from trace import IsTrace, Trace | 34 | from trace import IsTrace, Trace |
34 | 35 | ||
35 | from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M | 36 | from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M |
@@ -1894,7 +1895,10 @@ class Project(object): | |||
1894 | path = os.path.join(self._project.gitdir, HEAD) | 1895 | path = os.path.join(self._project.gitdir, HEAD) |
1895 | else: | 1896 | else: |
1896 | path = os.path.join(self._project.worktree, '.git', HEAD) | 1897 | path = os.path.join(self._project.worktree, '.git', HEAD) |
1897 | fd = open(path, 'rb') | 1898 | try: |
1899 | fd = open(path, 'rb') | ||
1900 | except IOError: | ||
1901 | raise NoManifestException(path) | ||
1898 | try: | 1902 | try: |
1899 | line = fd.read() | 1903 | line = fd.read() |
1900 | finally: | 1904 | finally: |