From abb7a3dfecdfe98b30594219f24c5c3d5e11e990 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 3 Jul 2009 16:16:18 -0700 Subject: 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 --- manifest_loader.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'manifest_loader.py') 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 @@ from manifest_xml import XmlManifest -def ParseManifest(repodir): +def ParseManifest(repodir, type=None): + if type: + return type(repodir) return XmlManifest(repodir) _manifest = None -def GetManifest(repodir, reparse=False): +def GetManifest(repodir, reparse=False, type=None): global _manifest - if _manifest is None or reparse: - _manifest = ParseManifest(repodir) + if _manifest is None \ + or reparse \ + or (type and _manifest.__class__ != type): + _manifest = ParseManifest(repodir, type=type) return _manifest -- cgit v1.2.3-54-g00ecf