summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2012-11-27 22:25:30 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2013-04-10 09:17:50 +0900
commitede7f12d4a0f7362aaccd2c825a83765b9b9d968 (patch)
treee2b1683926292028a8e32ce32419228517d60d56 /project.py
parent04d84a23fd04c9e1dd15341eb7dd28a0d8ce99c6 (diff)
downloadgit-repo-ede7f12d4a0f7362aaccd2c825a83765b9b9d968.tar.gz
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
Diffstat (limited to 'project.py')
-rw-r--r--project.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/project.py b/project.py
index 901a2831..20bf866c 100644
--- a/project.py
+++ b/project.py
@@ -488,6 +488,7 @@ class Project(object):
488 groups = None, 488 groups = None,
489 sync_c = False, 489 sync_c = False,
490 sync_s = False, 490 sync_s = False,
491 clone_depth = None,
491 upstream = None, 492 upstream = None,
492 parent = None, 493 parent = None,
493 is_derived = False): 494 is_derived = False):
@@ -533,6 +534,7 @@ class Project(object):
533 self.groups = groups 534 self.groups = groups
534 self.sync_c = sync_c 535 self.sync_c = sync_c
535 self.sync_s = sync_s 536 self.sync_s = sync_s
537 self.clone_depth = clone_depth
536 self.upstream = upstream 538 self.upstream = upstream
537 self.parent = parent 539 self.parent = parent
538 self.is_derived = is_derived 540 self.is_derived = is_derived
@@ -1645,7 +1647,10 @@ class Project(object):
1645 1647
1646 # The --depth option only affects the initial fetch; after that we'll do 1648 # The --depth option only affects the initial fetch; after that we'll do
1647 # full fetches of changes. 1649 # full fetches of changes.
1648 depth = self.manifest.manifestProject.config.GetString('repo.depth') 1650 if self.clone_depth:
1651 depth = self.clone_depth
1652 else:
1653 depth = self.manifest.manifestProject.config.GetString('repo.depth')
1649 if depth and initial: 1654 if depth and initial:
1650 cmd.append('--depth=%s' % depth) 1655 cmd.append('--depth=%s' % depth)
1651 1656
@@ -1705,7 +1710,7 @@ class Project(object):
1705 return ok 1710 return ok
1706 1711
1707 def _ApplyCloneBundle(self, initial=False, quiet=False): 1712 def _ApplyCloneBundle(self, initial=False, quiet=False):
1708 if initial and self.manifest.manifestProject.config.GetString('repo.depth'): 1713 if initial and (self.manifest.manifestProject.config.GetString('repo.depth') or self.clone_depth):
1709 return False 1714 return False
1710 1715
1711 remote = self.GetRemote(self.remote.name) 1716 remote = self.GetRemote(self.remote.name)