summaryrefslogtreecommitdiffstats
path: root/manifest_loader.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-07-03 16:16:18 -0700
committerShawn O. Pearce <sop@google.com>2009-07-03 20:03:38 -0700
commitabb7a3dfecdfe98b30594219f24c5c3d5e11e990 (patch)
treeeeec9afdd3f3b42101d436d21e1e802b419c5e74 /manifest_loader.py
parentcc6c79643e1cafad565424caabe581e7b548bf6f (diff)
downloadgit-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.py12
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
16from manifest_xml import XmlManifest 16from manifest_xml import XmlManifest
17 17
18def ParseManifest(repodir): 18def 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
23def GetManifest(repodir, reparse=False): 25def 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