summaryrefslogtreecommitdiffstats
path: root/manifest_xml.py
diff options
context:
space:
mode:
authorLaMont Jones <lamontjones@google.com>2022-04-07 16:49:06 +0000
committerLaMont Jones <lamontjones@google.com>2022-04-08 19:52:04 +0000
commita2ff20dd209fe3eb091cdf1bddd4672f86b76bd8 (patch)
treebbddbe26a54504a9cc97d3dd67c7efedcacff2ca /manifest_xml.py
parent55ee304304a0d83bfa23984c45e46eebdd184124 (diff)
downloadgit-repo-a2ff20dd209fe3eb091cdf1bddd4672f86b76bd8.tar.gz
manifest_xml: Add Load and Unload methods
- do not call the internal method from subcmds/sync.py. - use the correct default groups for submanifests. - only sync the superproject when we are told to. Change-Id: I81e4025058f1ee564732b9e17aecc522f6b5f626 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334639 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: LaMont Jones <lamontjones@google.com>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r--manifest_xml.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index 02f09db9..8718dc54 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -376,7 +376,7 @@ class XmlManifest(object):
376 if os.path.exists(mp.gitdir) and mp.use_worktree: 376 if os.path.exists(mp.gitdir) and mp.use_worktree:
377 mp.use_git_worktrees = True 377 mp.use_git_worktrees = True
378 378
379 self._Unload() 379 self.Unload()
380 380
381 def Override(self, name, load_local_manifests=True): 381 def Override(self, name, load_local_manifests=True):
382 """Use a different manifest, just for the current instantiation. 382 """Use a different manifest, just for the current instantiation.
@@ -399,7 +399,7 @@ class XmlManifest(object):
399 try: 399 try:
400 self._load_local_manifests = load_local_manifests 400 self._load_local_manifests = load_local_manifests
401 self.manifestFile = path 401 self.manifestFile = path
402 self._Unload() 402 self.Unload()
403 self._Load() 403 self._Load()
404 finally: 404 finally:
405 self.manifestFile = old 405 self.manifestFile = old
@@ -970,7 +970,13 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
970 groups = self.GetDefaultGroupsStr() 970 groups = self.GetDefaultGroupsStr()
971 return groups 971 return groups
972 972
973 def _Unload(self): 973 def Unload(self):
974 """Unload the manifest.
975
976 If the manifest files have been changed since Load() was called, this will
977 cause the new/updated manifest to be used.
978
979 """
974 self._loaded = False 980 self._loaded = False
975 self._projects = {} 981 self._projects = {}
976 self._paths = {} 982 self._paths = {}
@@ -984,6 +990,11 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
984 self.branch = None 990 self.branch = None
985 self._manifest_server = None 991 self._manifest_server = None
986 992
993 def Load(self):
994 """Read the manifest into memory."""
995 # Do not expose internal arguments.
996 self._Load()
997
987 def _Load(self, initial_client=None, submanifest_depth=0): 998 def _Load(self, initial_client=None, submanifest_depth=0):
988 if submanifest_depth > MAX_SUBMANIFEST_DEPTH: 999 if submanifest_depth > MAX_SUBMANIFEST_DEPTH:
989 raise ManifestParseError('maximum submanifest depth %d exceeded.' % 1000 raise ManifestParseError('maximum submanifest depth %d exceeded.' %
@@ -1030,7 +1041,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
1030 except ManifestParseError as e: 1041 except ManifestParseError as e:
1031 # There was a problem parsing, unload ourselves in case they catch 1042 # There was a problem parsing, unload ourselves in case they catch
1032 # this error and try again later, we will show the correct error 1043 # this error and try again later, we will show the correct error
1033 self._Unload() 1044 self.Unload()
1034 raise e 1045 raise e
1035 1046
1036 if self.IsMirror: 1047 if self.IsMirror: