Fix depot_tools presubmit's local_rietveld script.
This was breaking presubmit because the linked gae_ts_mon subdir was absent.
R=andybons@chromium.org, dsansome@chromium.org, dnj@chromium.org
BUG=608490
Review-Url: https://codereview.chromium.org/1959193002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300511 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/fetch.py b/fetch.py
index cf34404..0fbc378 100755
--- a/fetch.py
+++ b/fetch.py
@@ -231,6 +231,7 @@
Valid options:
-h, --help, help Print this message.
--nohooks Don't run hooks after checkout.
+ --force (dangerous) Don't look for existing .gclient file.
-n, --dry-run Don't run commands, only print them.
--no-history Perform shallow clones, don't fetch the full git history.
@@ -255,6 +256,7 @@
dry_run = False
nohooks = False
no_history = False
+ force = False
while len(argv) >= 2:
arg = argv[1]
if not arg.startswith('-'):
@@ -266,6 +268,8 @@
nohooks = True
elif arg == '--no-history':
no_history = True
+ elif arg == '--force':
+ force = True
else:
usage('Invalid option %s.' % arg)
@@ -279,8 +283,11 @@
config = argv[1]
props = argv[2:]
return (
- optparse.Values(
- {'dry_run':dry_run, 'nohooks':nohooks, 'no_history': no_history }),
+ optparse.Values({
+ 'dry_run': dry_run,
+ 'nohooks': nohooks,
+ 'no_history': no_history,
+ 'force': force}),
config,
props)
@@ -324,7 +331,7 @@
checkout = CheckoutFactory(checkout_type, options, checkout_spec, root)
except KeyError:
return 1
- if checkout.exists():
+ if not options.force and checkout.exists():
print 'Your current directory appears to already contain, or be part of, '
print 'a checkout. "fetch" is used only to get new checkouts. Use '
print '"gclient sync" to update existing checkouts.'