From ede7f12d4a0f7362aaccd2c825a83765b9b9d968 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 27 Nov 2012 22:25:30 +0900 Subject: Allow clone depth to be specified per project If the clone-depth attribute is set on a project, its value will be used to set the depth when fetching the git. The value, if given, must be a positive integer. The value in the clone-depth attribute overrides any value given to repo init via the --depth command line option. Change-Id: I273015b3724213600b63e40cca4cafaa9f782ddf --- manifest_xml.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'manifest_xml.py') diff --git a/manifest_xml.py b/manifest_xml.py index 92ef7859..4eef748f 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -665,6 +665,16 @@ class XmlManifest(object): else: sync_s = sync_s.lower() in ("yes", "true", "1") + clone_depth = node.getAttribute('clone-depth') + if clone_depth: + try: + clone_depth = int(clone_depth) + if clone_depth <= 0: + raise ValueError() + except ValueError: + raise ManifestParseError('invalid clone-depth %s in %s' % + (clone_depth, self.manifestFile)) + upstream = node.getAttribute('upstream') groups = '' @@ -692,6 +702,7 @@ class XmlManifest(object): groups = groups, sync_c = sync_c, sync_s = sync_s, + clone_depth = clone_depth, upstream = upstream, parent = parent) -- cgit v1.2.3-54-g00ecf