diff options
| author | Nasser Grainawi <nasser@codeaurora.org> | 2018-05-04 12:53:29 -0600 |
|---|---|---|
| committer | Nasser Grainawi <nasser@codeaurora.org> | 2018-05-09 14:58:18 -0600 |
| commit | da40341a3e6e2e45877426aaefb97b3f0735a776 (patch) | |
| tree | df0fbf8ce59f58160d72367d3baf64debdcdc2a6 /manifest_xml.py | |
| parent | 8d4b106642d0725f7f649ca5f407b2f8791483ef (diff) | |
| download | git-repo-da40341a3e6e2e45877426aaefb97b3f0735a776.tar.gz | |
manifest: Support a default upstream value
It's convenient to set upstream for all projects in a manifest instead of
repeating the same value for each project.
Change-Id: I946b1de4efb01b351c332dfad108fa7d4f443cba
Diffstat (limited to 'manifest_xml.py')
| -rw-r--r-- | manifest_xml.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 60d61168..d0211eaf 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -59,6 +59,7 @@ class _Default(object): | |||
| 59 | 59 | ||
| 60 | revisionExpr = None | 60 | revisionExpr = None |
| 61 | destBranchExpr = None | 61 | destBranchExpr = None |
| 62 | upstreamExpr = None | ||
| 62 | remote = None | 63 | remote = None |
| 63 | sync_j = 1 | 64 | sync_j = 1 |
| 64 | sync_c = False | 65 | sync_c = False |
| @@ -230,6 +231,9 @@ class XmlManifest(object): | |||
| 230 | if d.destBranchExpr: | 231 | if d.destBranchExpr: |
| 231 | have_default = True | 232 | have_default = True |
| 232 | e.setAttribute('dest-branch', d.destBranchExpr) | 233 | e.setAttribute('dest-branch', d.destBranchExpr) |
| 234 | if d.upstreamExpr: | ||
| 235 | have_default = True | ||
| 236 | e.setAttribute('upstream', d.upstreamExpr) | ||
| 233 | if d.sync_j > 1: | 237 | if d.sync_j > 1: |
| 234 | have_default = True | 238 | have_default = True |
| 235 | e.setAttribute('sync-j', '%d' % d.sync_j) | 239 | e.setAttribute('sync-j', '%d' % d.sync_j) |
| @@ -295,7 +299,8 @@ class XmlManifest(object): | |||
| 295 | revision = self.remotes[p.remote.orig_name].revision or d.revisionExpr | 299 | revision = self.remotes[p.remote.orig_name].revision or d.revisionExpr |
| 296 | if not revision or revision != p.revisionExpr: | 300 | if not revision or revision != p.revisionExpr: |
| 297 | e.setAttribute('revision', p.revisionExpr) | 301 | e.setAttribute('revision', p.revisionExpr) |
| 298 | if p.upstream and p.upstream != p.revisionExpr: | 302 | if (p.upstream and (p.upstream != p.revisionExpr or |
| 303 | p.upstream != d.upstreamExpr)): | ||
| 299 | e.setAttribute('upstream', p.upstream) | 304 | e.setAttribute('upstream', p.upstream) |
| 300 | 305 | ||
| 301 | if p.dest_branch and p.dest_branch != d.destBranchExpr: | 306 | if p.dest_branch and p.dest_branch != d.destBranchExpr: |
| @@ -694,6 +699,7 @@ class XmlManifest(object): | |||
| 694 | d.revisionExpr = None | 699 | d.revisionExpr = None |
| 695 | 700 | ||
| 696 | d.destBranchExpr = node.getAttribute('dest-branch') or None | 701 | d.destBranchExpr = node.getAttribute('dest-branch') or None |
| 702 | d.upstreamExpr = node.getAttribute('upstream') or None | ||
| 697 | 703 | ||
| 698 | sync_j = node.getAttribute('sync-j') | 704 | sync_j = node.getAttribute('sync-j') |
| 699 | if sync_j == '' or sync_j is None: | 705 | if sync_j == '' or sync_j is None: |
| @@ -830,7 +836,7 @@ class XmlManifest(object): | |||
| 830 | 836 | ||
| 831 | dest_branch = node.getAttribute('dest-branch') or self._default.destBranchExpr | 837 | dest_branch = node.getAttribute('dest-branch') or self._default.destBranchExpr |
| 832 | 838 | ||
| 833 | upstream = node.getAttribute('upstream') | 839 | upstream = node.getAttribute('upstream') or self._default.upstreamExpr |
| 834 | 840 | ||
| 835 | groups = '' | 841 | groups = '' |
| 836 | if node.hasAttribute('groups'): | 842 | if node.hasAttribute('groups'): |
