summaryrefslogtreecommitdiffstats
path: root/manifest_xml.py
diff options
context:
space:
mode:
authorYOUNG HO CHA <ganadist@gmail.com>2018-02-14 16:57:31 +0900
committerYOUNG HO CHA <ganadist@gmail.com>2018-02-14 16:57:41 +0900
commita32c92c206ad02f473cfa9558d4eac8f0fc738a8 (patch)
tree64e14a141835c22da1585425d62d84ca3cf573f3 /manifest_xml.py
parent685320b000c0683421a460d1c9a33ae9d73cc706 (diff)
downloadgit-repo-a32c92c206ad02f473cfa9558d4eac8f0fc738a8.tar.gz
implement optional 'sync-tags' in the manifest file
Allow the 'default' and 'project' element in the manifest file to apply "--no-tags" option equivalent. Change-Id: I7e0f8c17a0e25cca744d45df049076d203c52ff5 Signed-off-by: YOUNG HO CHA <ganadist@gmail.com>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r--manifest_xml.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index 9b5d7847..0654222e 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -63,6 +63,7 @@ class _Default(object):
63 sync_j = 1 63 sync_j = 1
64 sync_c = False 64 sync_c = False
65 sync_s = False 65 sync_s = False
66 sync_tags = True
66 67
67 def __eq__(self, other): 68 def __eq__(self, other):
68 return self.__dict__ == other.__dict__ 69 return self.__dict__ == other.__dict__
@@ -238,6 +239,9 @@ class XmlManifest(object):
238 if d.sync_s: 239 if d.sync_s:
239 have_default = True 240 have_default = True
240 e.setAttribute('sync-s', 'true') 241 e.setAttribute('sync-s', 'true')
242 if not d.sync_tags:
243 have_default = True
244 e.setAttribute('sync-tags', 'false')
241 if have_default: 245 if have_default:
242 root.appendChild(e) 246 root.appendChild(e)
243 root.appendChild(doc.createTextNode('')) 247 root.appendChild(doc.createTextNode(''))
@@ -327,6 +331,9 @@ class XmlManifest(object):
327 if p.sync_s: 331 if p.sync_s:
328 e.setAttribute('sync-s', 'true') 332 e.setAttribute('sync-s', 'true')
329 333
334 if not p.sync_tags:
335 e.setAttribute('sync-tags', 'false')
336
330 if p.clone_depth: 337 if p.clone_depth:
331 e.setAttribute('clone-depth', str(p.clone_depth)) 338 e.setAttribute('clone-depth', str(p.clone_depth))
332 339
@@ -702,6 +709,12 @@ class XmlManifest(object):
702 d.sync_s = False 709 d.sync_s = False
703 else: 710 else:
704 d.sync_s = sync_s.lower() in ("yes", "true", "1") 711 d.sync_s = sync_s.lower() in ("yes", "true", "1")
712
713 sync_tags = node.getAttribute('sync-tags')
714 if not sync_tags:
715 d.sync_tags = True
716 else:
717 d.sync_tags = sync_tags.lower() in ("yes", "true", "1")
705 return d 718 return d
706 719
707 def _ParseNotice(self, node): 720 def _ParseNotice(self, node):
@@ -796,6 +809,12 @@ class XmlManifest(object):
796 else: 809 else:
797 sync_s = sync_s.lower() in ("yes", "true", "1") 810 sync_s = sync_s.lower() in ("yes", "true", "1")
798 811
812 sync_tags = node.getAttribute('sync-tags')
813 if not sync_tags:
814 sync_tags = self._default.sync_tags
815 else:
816 sync_tags = sync_tags.lower() in ("yes", "true", "1")
817
799 clone_depth = node.getAttribute('clone-depth') 818 clone_depth = node.getAttribute('clone-depth')
800 if clone_depth: 819 if clone_depth:
801 try: 820 try:
@@ -841,6 +860,7 @@ class XmlManifest(object):
841 groups = groups, 860 groups = groups,
842 sync_c = sync_c, 861 sync_c = sync_c,
843 sync_s = sync_s, 862 sync_s = sync_s,
863 sync_tags = sync_tags,
844 clone_depth = clone_depth, 864 clone_depth = clone_depth,
845 upstream = upstream, 865 upstream = upstream,
846 parent = parent, 866 parent = parent,