Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: fetch.py

Issue 440273002: Reland: Add --no-history option to fetch and gclient for shallow clones. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: ensure_value -> hasattr Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gclient.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fetch.py
diff --git a/fetch.py b/fetch.py
index d3bcacd793195438a658cee1e03c7e83fbc70f93..897356f299c5aaaeff22b71f44c9259b3b24f867 100755
--- a/fetch.py
+++ b/fetch.py
@@ -114,6 +114,8 @@ class GclientGitCheckout(GclientCheckout, GitCheckout):
sync_cmd = ['sync']
if self.options.nohooks:
sync_cmd.append('--nohooks')
+ if self.options.no_history:
+ sync_cmd.append('--no-history')
if self.spec.get('with_branch_heads', False):
sync_cmd.append('--with_branch_heads')
self.run_gclient(*sync_cmd)
@@ -207,6 +209,7 @@ Valid options:
-h, --help, help Print this message.
--nohooks Don't run hooks after checkout.
-n, --dry-run Don't run commands, only print them.
+ --no-history Perform shallow clones, don't fetch the full git history.
""" % os.path.basename(sys.argv[0]))
sys.exit(bool(msg))
@@ -220,6 +223,7 @@ def handle_args(argv):
dry_run = False
nohooks = False
+ no_history = False
while len(argv) >= 2:
arg = argv[1]
if not arg.startswith('-'):
@@ -229,6 +233,8 @@ def handle_args(argv):
dry_run = True
elif arg == '--nohooks':
nohooks = True
+ elif arg == '--no-history':
+ no_history = True
else:
usage('Invalid option %s.' % arg)
@@ -241,7 +247,11 @@ def handle_args(argv):
recipe = argv[1]
props = argv[2:]
- return optparse.Values({'dry_run':dry_run, 'nohooks':nohooks }), recipe, props
+ return (
+ optparse.Values(
+ {'dry_run':dry_run, 'nohooks':nohooks, 'no_history': no_history }),
+ recipe,
+ props)
def run_recipe_fetch(recipe, props, aliased=False):
« no previous file with comments | « no previous file | gclient.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698