tools/git-sync-deps: less verbose when fetch is needed

Change-Id: I0ab76132b9e21544ed3dfb87bd7adc91c4c4e656
Reviewed-on: https://skia-review.googlesource.com/8387
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
Hal Canary 2017-02-13 13:40:56 -05:00 committed by Skia Commit-Bot
parent 320ade43f5
commit 73eae98103

View File

@ -142,12 +142,15 @@ def git_checkout_to_directory(git, repo, checkoutable, directory, verbose):
sys.stdout.write('%s\n SYNC IS DISABLED.\n' % directory)
return
if 0 == subprocess.call(
[git, 'checkout', '--quiet', checkoutable], cwd=directory):
# if this succeeds, skip slow `git fetch`.
if verbose:
status(directory, checkoutable) # Success.
return
with open(os.devnull, 'w') as devnull:
# If this fails, we will fetch before trying again. Don't spam user
# with error infomation.
if 0 == subprocess.call([git, 'checkout', '--quiet', checkoutable],
cwd=directory, stderr=devnull):
# if this succeeds, skip slow `git fetch`.
if verbose:
status(directory, checkoutable) # Success.
return
# If the repo has changed, always force use of the correct repo.
# If origin already points to repo, this is a quick no-op.