diff options
author | David Pursehouse <dpursehouse@collab.net> | 2018-02-26 06:50:53 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-02-26 06:50:53 +0000 |
commit | 1f365701b32fbf657fc8277d1fee3656f2501383 (patch) | |
tree | e0d1647b204df52d69c42521ebaec0ffc8f154a6 /manifest_xml.py | |
parent | ce7e02601cfb0fdd0d9faa5cc2afa42717b63f1f (diff) | |
parent | a32c92c206ad02f473cfa9558d4eac8f0fc738a8 (diff) | |
download | git-repo-1f365701b32fbf657fc8277d1fee3656f2501383.tar.gz |
Merge "implement optional 'sync-tags' in the manifest file"
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 20 |
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, |