diff options
author | Shawn O. Pearce <sop@google.com> | 2008-10-23 16:19:27 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2008-10-23 16:20:14 -0700 |
commit | 5cc6679fb84ec887a09895c53a279df821faad49 (patch) | |
tree | 36c80f9302586c639385084d1970f982b1434006 /manifest.py | |
parent | 632768bc65ae0f1dc9eb9260c9146c42d9965a18 (diff) | |
download | git-repo-5cc6679fb84ec887a09895c53a279df821faad49.tar.gz |
Support user supplied custom .repo/local_manifest.xml filesv1.0.5
By creating a .repo/local_manifest.xml the user can add extra
projects into their client space, without touching the main
manifest script.
For example:
$ cat .repo/local_manifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="android-build"
name="platform/build"
remote="korg"
revision="android-1.0" />
</manifest>
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'manifest.py')
-rw-r--r-- | manifest.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/manifest.py b/manifest.py index 45b0f9a5..89dd5bed 100644 --- a/manifest.py +++ b/manifest.py | |||
@@ -26,6 +26,7 @@ from remote import Remote | |||
26 | from error import ManifestParseError | 26 | from error import ManifestParseError |
27 | 27 | ||
28 | MANIFEST_FILE_NAME = 'manifest.xml' | 28 | MANIFEST_FILE_NAME = 'manifest.xml' |
29 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' | ||
29 | 30 | ||
30 | class _Default(object): | 31 | class _Default(object): |
31 | """Project defaults within the manifest.""" | 32 | """Project defaults within the manifest.""" |
@@ -108,10 +109,20 @@ class Manifest(object): | |||
108 | 109 | ||
109 | def _Load(self): | 110 | def _Load(self): |
110 | if not self._loaded: | 111 | if not self._loaded: |
111 | self._ParseManifest() | 112 | self._ParseManifest(True) |
113 | |||
114 | local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME) | ||
115 | if os.path.exists(local): | ||
116 | try: | ||
117 | real = self.manifestFile | ||
118 | self.manifestFile = local | ||
119 | self._ParseManifest(False) | ||
120 | finally: | ||
121 | self.manifestFile = real | ||
122 | |||
112 | self._loaded = True | 123 | self._loaded = True |
113 | 124 | ||
114 | def _ParseManifest(self): | 125 | def _ParseManifest(self, is_root_file): |
115 | root = xml.dom.minidom.parse(self.manifestFile) | 126 | root = xml.dom.minidom.parse(self.manifestFile) |
116 | if not root or not root.childNodes: | 127 | if not root or not root.childNodes: |
117 | raise ManifestParseError, \ | 128 | raise ManifestParseError, \ |
@@ -124,9 +135,10 @@ class Manifest(object): | |||
124 | "no <manifest> in %s" % \ | 135 | "no <manifest> in %s" % \ |
125 | self.manifestFile | 136 | self.manifestFile |
126 | 137 | ||
127 | self.branch = config.getAttribute('branch') | 138 | if is_root_file: |
128 | if not self.branch: | 139 | self.branch = config.getAttribute('branch') |
129 | self.branch = 'default' | 140 | if not self.branch: |
141 | self.branch = 'default' | ||
130 | 142 | ||
131 | for node in config.childNodes: | 143 | for node in config.childNodes: |
132 | if node.nodeName == 'remote': | 144 | if node.nodeName == 'remote': |