tools/git-sync-deps: handle changing origin

TBR=mtklein@google.com

Review URL: https://codereview.chromium.org/1475513004
This commit is contained in:
halcanary 2015-11-24 13:10:52 -08:00 committed by Commit bot
parent 11a7f7f599
commit 8b6ab36940

View File

@ -142,8 +142,11 @@ def git_checkout_to_directory(git, repo, checkoutable, directory, verbose):
subprocess.check_call([git, 'fetch', '--quiet'], cwd=directory)
subprocess.check_call(
[git, 'checkout', '--quiet', checkoutable], cwd=directory)
if 0 != subprocess.call(
[git, 'checkout', '--quiet', checkoutable], cwd=directory):
subprocess.check_call([git, 'remote', 'set-url', repo], cwd=directory)
subprocess.check_call([git, 'fetch', '--quiet'], cwd=directory)
subprocess.check_call([git, 'checkout', '--quiet'], cwd=directory)
if verbose:
sys.stdout.write('%s\n @ %s\n' % (directory, checkoutable)) # Success.