summaryrefslogtreecommitdiffstats
path: root/manifest_xml.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2011-09-22 17:44:31 -0700
committerShawn O. Pearce <sop@google.com>2011-09-22 18:08:27 -0700
commit6392c879454bd4fa0e770195ee8424e383d17df2 (patch)
treebfbfedb0a1d7f3fbe648deaf09e570ba347feeb0 /manifest_xml.py
parent97d2b2f7a087bfc695536ae9be962406d82152f2 (diff)
downloadgit-repo-6392c879454bd4fa0e770195ee8424e383d17df2.tar.gz
sync: Allow -j to have a default in manifestv1.7.6
This permits manifest authors to suggest a number of parallel fetch operations against a remote server. For example, Gerrit Code Review servers support queuing of requests and processes them in first-in, first-out order. Running concurrent fetches can utilize multiple CPUs on the Gerrit server, but will also decrease overall operation latency by having the request put into the queue ready to execute as soon as a CPU is free. Change-Id: I3d3904acb6f63516bae4b071c510ad57a2afab18 Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r--manifest_xml.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index 0e6421f1..a0252057 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -29,6 +29,7 @@ class _Default(object):
29 29
30 revisionExpr = None 30 revisionExpr = None
31 remote = None 31 remote = None
32 sync_j = 1
32 33
33class _XmlRemote(object): 34class _XmlRemote(object):
34 def __init__(self, 35 def __init__(self,
@@ -133,6 +134,9 @@ class XmlManifest(object):
133 if d.revisionExpr: 134 if d.revisionExpr:
134 have_default = True 135 have_default = True
135 e.setAttribute('revision', d.revisionExpr) 136 e.setAttribute('revision', d.revisionExpr)
137 if d.sync_j > 1:
138 have_default = True
139 e.setAttribute('sync-j', '%d' % d.sync_j)
136 if have_default: 140 if have_default:
137 root.appendChild(e) 141 root.appendChild(e)
138 root.appendChild(doc.createTextNode('')) 142 root.appendChild(doc.createTextNode(''))
@@ -401,6 +405,11 @@ class XmlManifest(object):
401 d.revisionExpr = node.getAttribute('revision') 405 d.revisionExpr = node.getAttribute('revision')
402 if d.revisionExpr == '': 406 if d.revisionExpr == '':
403 d.revisionExpr = None 407 d.revisionExpr = None
408 sync_j = node.getAttribute('sync-j')
409 if sync_j == '' or sync_j is None:
410 d.sync_j = 1
411 else:
412 d.sync_j = int(sync_j)
404 return d 413 return d
405 414
406 def _ParseNotice(self, node): 415 def _ParseNotice(self, node):