From 0f09f97100cd600e525181584e7416432f524e52 Mon Sep 17 00:00:00 2001 From: Emma Date: Mon, 25 Sep 2017 11:49:45 +0200 Subject: [PATCH] Adds progress argument option to fetch for git checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug:768229 Change-Id: If6988e3a75e66beb2900360b10d63560b4c0b345 Recipe-Nontrivial-Roll: build_limited_scripts_slave Recipe-Nontrivial-Roll: skia Recipe-Nontrivial-Roll: release_scripts Recipe-Nontrivial-Roll: infra Recipe-Nontrivial-Roll: build Reviewed-on: https://chromium-review.googlesource.com/681194 Commit-Queue: Emma Söderberg Reviewed-by: Paweł Hajdan Jr. --- recipes/README.recipes.md | 15 ++++++++------- recipes/recipe_modules/git/api.py | 6 +++++- .../git/examples/full.expected/basic.json | 3 ++- .../git/examples/full.expected/basic_branch.json | 3 ++- .../examples/full.expected/basic_file_name.json | 3 ++- .../git/examples/full.expected/basic_hash.json | 3 ++- .../git/examples/full.expected/basic_ref.json | 3 ++- .../basic_submodule_update_force.json | 3 ++- .../examples/full.expected/can_fail_build.json | 3 ++- .../examples/full.expected/cannot_fail_build.json | 3 ++- .../git/examples/full.expected/cat-file_test.json | 3 ++- .../full.expected/count-objects_delta.json | 3 ++- .../full.expected/count-objects_failed.json | 3 ++- .../count-objects_with_bad_output.json | 3 ++- ...count-objects_with_bad_output_fails_build.json | 3 ++- .../examples/full.expected/curl_trace_file.json | 3 ++- .../full.expected/git-cache-checkout.json | 3 ++- .../git/examples/full.expected/platform_win.json | 3 ++- .../git/examples/full.expected/rebase_failed.json | 3 ++- .../examples/full.expected/remote_not_origin.json | 3 ++- .../examples/full.expected/set_got_revision.json | 3 ++- 21 files changed, 51 insertions(+), 27 deletions(-) diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index a7359fb409..263c7b535f 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -370,7 +370,7 @@ Returns: Return a git command step. -— **def [bundle\_create](/recipes/recipe_modules/git/api.py#366)(self, bundle_path, rev_list_args=None, \*\*kwargs):** +— **def [bundle\_create](/recipes/recipe_modules/git/api.py#370)(self, bundle_path, rev_list_args=None, \*\*kwargs):** Run 'git bundle create' on a Git repository. @@ -384,7 +384,7 @@ Args: Outputs the contents of a file at a given revision. -— **def [checkout](/recipes/recipe_modules/git/api.py#110)(self, url, ref=None, dir_path=None, recursive=False, submodules=True, submodule_update_force=False, keep_paths=None, step_suffix=None, curl_trace_file=None, can_fail_build=True, set_got_revision=False, remote_name=None, display_fetch_size=None, file_name=None, submodule_update_recursive=True, use_git_cache=False):** +— **def [checkout](/recipes/recipe_modules/git/api.py#110)(self, url, ref=None, dir_path=None, recursive=False, submodules=True, submodule_update_force=False, keep_paths=None, step_suffix=None, curl_trace_file=None, can_fail_build=True, set_got_revision=False, remote_name=None, display_fetch_size=None, file_name=None, submodule_update_recursive=True, use_git_cache=False, progress=True):** Performs a full git checkout and returns sha1 of checked out revision. @@ -417,11 +417,12 @@ Args: to a local path, may cause problem with scripts that do "git fetch origin" or "git push origin". * arbitrary refs such refs/whatever/not-fetched-by-default-to-cache + progress (bool): wether to show progress for fetch or not Returns: If the checkout was successful, this returns the commit hash of the checked-out-repo. Otherwise this returns None. -— **def [config\_get](/recipes/recipe_modules/git/api.py#339)(self, prop_name, \*\*kwargs):** +— **def [config\_get](/recipes/recipe_modules/git/api.py#343)(self, prop_name, \*\*kwargs):** Returns: (str) The Git config output, or None if no output was generated. @@ -446,7 +447,7 @@ Returns: Fetches all tags from the remote. -— **def [get\_remote\_url](/recipes/recipe_modules/git/api.py#356)(self, remote_name=None, \*\*kwargs):** +— **def [get\_remote\_url](/recipes/recipe_modules/git/api.py#360)(self, remote_name=None, \*\*kwargs):** Returns: (str) The URL of the remote Git repository, or None. @@ -454,11 +455,11 @@ Args: remote_name: (str) The name of the remote to query, defaults to 'origin'. kwargs: Forwarded to '__call__'. -— **def [get\_timestamp](/recipes/recipe_modules/git/api.py#311)(self, commit='HEAD', test_data=None, \*\*kwargs):** +— **def [get\_timestamp](/recipes/recipe_modules/git/api.py#315)(self, commit='HEAD', test_data=None, \*\*kwargs):** Find and return the timestamp of the given commit. -— **def [new\_branch](/recipes/recipe_modules/git/api.py#379)(self, branch, name=None, upstream=None, \*\*kwargs):** +— **def [new\_branch](/recipes/recipe_modules/git/api.py#383)(self, branch, name=None, upstream=None, \*\*kwargs):** Runs git new-branch on a Git repository, to be used before git cl upload. @@ -468,7 +469,7 @@ Args: upstream (str): to origin/master. kwargs: Forwarded to '__call__'. -— **def [rebase](/recipes/recipe_modules/git/api.py#320)(self, name_prefix, branch, dir_path, remote_name=None, \*\*kwargs):** +— **def [rebase](/recipes/recipe_modules/git/api.py#324)(self, name_prefix, branch, dir_path, remote_name=None, \*\*kwargs):** Run rebase HEAD onto branch Args: diff --git a/recipes/recipe_modules/git/api.py b/recipes/recipe_modules/git/api.py index 5f7b707350..9a9eee23d7 100644 --- a/recipes/recipe_modules/git/api.py +++ b/recipes/recipe_modules/git/api.py @@ -114,7 +114,7 @@ class GitApi(recipe_api.RecipeApi): set_got_revision=False, remote_name=None, display_fetch_size=None, file_name=None, submodule_update_recursive=True, - use_git_cache=False): + use_git_cache=False, progress=True): """Performs a full git checkout and returns sha1 of checked out revision. Args: @@ -146,6 +146,7 @@ class GitApi(recipe_api.RecipeApi): to a local path, may cause problem with scripts that do "git fetch origin" or "git push origin". * arbitrary refs such refs/whatever/not-fetched-by-default-to-cache + progress (bool): wether to show progress for fetch or not Returns: If the checkout was successful, this returns the commit hash of the checked-out-repo. Otherwise this returns None. @@ -238,6 +239,9 @@ class GitApi(recipe_api.RecipeApi): if recursive: fetch_args.append('--recurse-submodules') + if progress: + fetch_args.append('--progress') + fetch_env = {'PATH': path} fetch_stderr = None if curl_trace_file: diff --git a/recipes/recipe_modules/git/examples/full.expected/basic.json b/recipes/recipe_modules/git/examples/full.expected/basic.json index 03e452709c..a5052d7c30 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_branch.json b/recipes/recipe_modules/git/examples/full.expected/basic_branch.json index 1c7ad5d16f..f685ec5ddd 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_branch.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_branch.json @@ -18,7 +18,8 @@ "fetch", "origin", "testing", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json b/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json index ef6470e2c4..dcfae04984 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_hash.json b/recipes/recipe_modules/git/examples/full.expected/basic_hash.json index 9f4d6bf879..3dbc24f9fb 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_hash.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_hash.json @@ -17,7 +17,8 @@ "retry", "fetch", "origin", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_ref.json b/recipes/recipe_modules/git/examples/full.expected/basic_ref.json index ef81e0b582..d8c74956df 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_ref.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_ref.json @@ -18,7 +18,8 @@ "fetch", "origin", "refs/foo/bar", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json b/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json index feddabb248..deea2d4435 100644 --- a/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json +++ b/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json b/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json index 34cd4b67d5..f267a936cb 100644 --- a/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json +++ b/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json b/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json index 52d23f9739..85f4043ee5 100644 --- a/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json +++ b/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json b/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json index ffedc87be4..da7f31b759 100644 --- a/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json +++ b/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json @@ -18,7 +18,8 @@ "fetch", "origin", "abcdef12345", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json b/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json index feefeba9e8..d4efc8c35b 100644 --- a/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json +++ b/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json @@ -40,7 +40,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json b/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json index f63069b8b5..161941c9ea 100644 --- a/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json +++ b/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json b/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json index 34c68f1d2f..1cf5f6ddb5 100644 --- a/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json +++ b/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json b/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json index 04c00880f3..1fee290e24 100644 --- a/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json +++ b/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json b/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json index 60481e8ecb..93ba4cb5b5 100644 --- a/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json +++ b/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json @@ -18,7 +18,8 @@ "fetch", "origin", "refs/foo/bar", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json b/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json index 7c066f2e2e..3c6cc006e9 100644 --- a/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json +++ b/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json @@ -68,7 +68,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/platform_win.json b/recipes/recipe_modules/git/examples/full.expected/platform_win.json index 167757047f..301a8c0490 100644 --- a/recipes/recipe_modules/git/examples/full.expected/platform_win.json +++ b/recipes/recipe_modules/git/examples/full.expected/platform_win.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]\\src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json b/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json index 714f731ef9..fa43ce85e8 100644 --- a/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json +++ b/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json b/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json index 4a788dc7ce..32fed3d8b3 100644 --- a/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json +++ b/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json @@ -20,7 +20,8 @@ "fetch", "not_origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": { diff --git a/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json b/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json index d4eee5ef48..a5ba4f25f7 100644 --- a/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json +++ b/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json @@ -18,7 +18,8 @@ "fetch", "origin", "master", - "--recurse-submodules" + "--recurse-submodules", + "--progress" ], "cwd": "[START_DIR]/src", "env": {