[jhbuild] Add "shallow_clone" option



commit 40b70d75563f783cf41c403e7c797ab683803c52
Author: Colin Walters <walters verbum org>
Date:   Thu Apr 11 12:08:14 2013 -0400

    Add "shallow_clone" option
    
    This just maps to --depth=1 for git at the moment; I didn't
    bother with other version control systems because to be honest
    they're basically irrelevant.
    
    Using this option is a *lot* faster to just get an initial
    build going.  gdk-pixbuf's git repo is an 100MB download, but only
    1.8 currently with depth 1.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697818

 jhbuild/config.py             |    2 +-
 jhbuild/versioncontrol/git.py |   13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/jhbuild/config.py b/jhbuild/config.py
index 521cb32..c4f5cf1 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -59,7 +59,7 @@ _known_keys = [ 'moduleset', 'modules', 'skip', 'tags', 'prefix',
                 'jhbuildbot_dir', 'jhbuildbot_mastercfg',
                 'use_local_modulesets', 'ignore_suggests', 'modulesets_dir',
                 'mirror_policy', 'module_mirror_policy', 'dvcs_mirror_dir',
-                'build_targets', 'cmakeargs', 'module_cmakeargs',
+                'shallow_clone', 'build_targets', 'cmakeargs', 'module_cmakeargs',
                 'print_command_pattern', 'static_analyzer',
                 'module_static_analyzer', 'static_analyzer_template',
                 'static_analyzer_outputdir', 'check_sysdeps', 'system_prefix',
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index d5820bb..1880f93 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -391,17 +391,22 @@ class GitBranch(Branch):
 
     def _checkout(self, buildscript, copydir=None):
 
+        extra_opts = []
         if self.config.quiet_mode:
-            quiet = ['-q']
-        else:
-            quiet = []
+            extra_opts.append('-q')
+
+        if self.config.shallow_clone:
+            extra_opts.append('--depth=1')
 
         self.update_dvcs_mirror(buildscript)
 
-        cmd = ['git', 'clone'] + quiet + [self.module]
+        cmd = ['git', 'clone'] + extra_opts + [self.module]
         if self.checkoutdir:
             cmd.append(self.checkoutdir)
 
+        if self.branch is not None:
+            cmd.extend(['-b', self.branch])
+
         if copydir:
             buildscript.execute(cmd, cwd=copydir, extra_env=get_git_extra_env())
         else:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]