summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2012-11-15 17:33:11 -0800
committerConley Owens <cco3@android.com>2012-11-15 18:50:11 -0800
commit75ee0570da09abb1d2bbefe0d25f0560727e6b71 (patch)
treec62ab4990212282d9c18c694ec21830ad33481f2 /project.py
parent88b86728a4451b97a2c6dcae2feb98014c077793 (diff)
downloadgit-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.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/project.py b/project.py
index 75c5e5e8..08b27710 100644
--- a/project.py
+++ b/project.py
@@ -30,6 +30,7 @@ from git_command import GitCommand, git_require
30from git_config import GitConfig, IsId, GetSchemeFromUrl, ID_RE 30from git_config import GitConfig, IsId, GetSchemeFromUrl, ID_RE
31from error import GitError, HookError, UploadError 31from error import GitError, HookError, UploadError
32from error import ManifestInvalidRevisionError 32from error import ManifestInvalidRevisionError
33from error import NoManifestException
33from trace import IsTrace, Trace 34from trace import IsTrace, Trace
34 35
35from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M 36from 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: