From 6392c879454bd4fa0e770195ee8424e383d17df2 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 22 Sep 2011 17:44:31 -0700 Subject: sync: Allow -j to have a default in manifest 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 --- manifest_xml.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'manifest_xml.py') 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): revisionExpr = None remote = None + sync_j = 1 class _XmlRemote(object): def __init__(self, @@ -133,6 +134,9 @@ class XmlManifest(object): if d.revisionExpr: have_default = True e.setAttribute('revision', d.revisionExpr) + if d.sync_j > 1: + have_default = True + e.setAttribute('sync-j', '%d' % d.sync_j) if have_default: root.appendChild(e) root.appendChild(doc.createTextNode('')) @@ -401,6 +405,11 @@ class XmlManifest(object): d.revisionExpr = node.getAttribute('revision') if d.revisionExpr == '': d.revisionExpr = None + sync_j = node.getAttribute('sync-j') + if sync_j == '' or sync_j is None: + d.sync_j = 1 + else: + d.sync_j = int(sync_j) return d def _ParseNotice(self, node): -- cgit v1.2.3-54-g00ecf