diff options
author | Shawn O. Pearce <sop@google.com> | 2009-07-03 16:16:18 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-07-03 20:03:38 -0700 |
commit | abb7a3dfecdfe98b30594219f24c5c3d5e11e990 (patch) | |
tree | eeec9afdd3f3b42101d436d21e1e802b419c5e74 /manifest_loader.py | |
parent | cc6c79643e1cafad565424caabe581e7b548bf6f (diff) | |
download | git-repo-abb7a3dfecdfe98b30594219f24c5c3d5e11e990.tar.gz |
Allow callers to request a specific type of manifest
If the caller knows exactly what the manifest type must be we
can now ask the loader to directly construct that type, rather
than guessing it from the working directory.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'manifest_loader.py')
-rw-r--r-- | manifest_loader.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/manifest_loader.py b/manifest_loader.py index 85ad3ea1..1ce1c1f3 100644 --- a/manifest_loader.py +++ b/manifest_loader.py | |||
@@ -15,13 +15,17 @@ | |||
15 | 15 | ||
16 | from manifest_xml import XmlManifest | 16 | from manifest_xml import XmlManifest |
17 | 17 | ||
18 | def ParseManifest(repodir): | 18 | def ParseManifest(repodir, type=None): |
19 | if type: | ||
20 | return type(repodir) | ||
19 | return XmlManifest(repodir) | 21 | return XmlManifest(repodir) |
20 | 22 | ||
21 | _manifest = None | 23 | _manifest = None |
22 | 24 | ||
23 | def GetManifest(repodir, reparse=False): | 25 | def GetManifest(repodir, reparse=False, type=None): |
24 | global _manifest | 26 | global _manifest |
25 | if _manifest is None or reparse: | 27 | if _manifest is None \ |
26 | _manifest = ParseManifest(repodir) | 28 | or reparse \ |
29 | or (type and _manifest.__class__ != type): | ||
30 | _manifest = ParseManifest(repodir, type=type) | ||
27 | return _manifest | 31 | return _manifest |