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

Unified Diff: recipe_modules/bot_update/resources/bot_update.py

Issue 1837453002: Add --gerrit_no_reset for who need to use FETCH_HEAD revision. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 9 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 | « recipe_modules/bot_update/example.expected/no_reset_soft.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/bot_update/resources/bot_update.py
diff --git a/recipe_modules/bot_update/resources/bot_update.py b/recipe_modules/bot_update/resources/bot_update.py
index 39c4bf61d7868be0ac5d80162527447fdc8b1cff..c00e773c765c2bc0fdd3ffcf401e84830046f340 100755
--- a/recipe_modules/bot_update/resources/bot_update.py
+++ b/recipe_modules/bot_update/resources/bot_update.py
@@ -1130,14 +1130,15 @@ def apply_rietveld_issue(issue, patchset, root, server, _rev_map, _revision,
except SubprocessFailed as e:
raise PatchFailed(e.message, e.code, e.output)
-def apply_gerrit_ref(gerrit_repo, gerrit_ref, root):
+def apply_gerrit_ref(gerrit_repo, gerrit_ref, root, reset_soft):
gerrit_repo = gerrit_repo or 'origin'
assert gerrit_ref
try:
base_rev = git('rev-parse', 'HEAD', cwd=root).strip()
git('retry', 'fetch', gerrit_repo, gerrit_ref, cwd=root, tries=1)
git('checkout', 'FETCH_HEAD', cwd=root)
- git('reset', '--soft', base_rev, cwd=root)
+ if not reset_soft:
hinoka 2016/03/25 12:48:17 if reset_soft:
Yoshisato Yanagisawa 2016/03/28 02:00:52 good catch ;p
+ git('reset', '--soft', base_rev, cwd=root)
except SubprocessFailed as e:
raise PatchFailed(e.message, e.code, e.output)
@@ -1295,7 +1296,8 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
patch_root, issue, patchset, patch_url, rietveld_server,
gerrit_repo, gerrit_ref, revision_mapping,
apply_issue_email_file, apply_issue_key_file, buildspec,
- gyp_env, shallow, runhooks, refs, git_cache_dir):
+ gyp_env, shallow, runhooks, refs, git_cache_dir,
+ reset_soft):
# Get a checkout of each solution, without DEPS or hooks.
# Calling git directly because there is no way to run Gclient without
# invoking DEPS.
@@ -1361,7 +1363,7 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
revision_mapping, git_ref, apply_issue_email_file,
apply_issue_key_file, blacklist=already_patched)
elif gerrit_ref:
- apply_gerrit_ref(gerrit_repo, gerrit_ref, patch_root)
+ apply_gerrit_ref(gerrit_repo, gerrit_ref, patch_root, reset_soft)
# Reset the deps_file point in the solutions so that hooks get run properly.
for sln in solutions:
@@ -1491,6 +1493,8 @@ def parse_args():
'does the same thing as --refs +refs/branch-heads/*')
parse.add_option('--git-cache-dir', default=path.join(SLAVE_DIR, 'cache_dir'),
help='Path to git cache directory.')
+ parse.add_option('--no_reset_soft', action='store_true',
+ help='Bypass calling reset --soft after git fetch.')
hinoka 2016/03/25 12:48:17 I think the name "--gerrit_no_reset" is better, si
Yoshisato Yanagisawa 2016/03/28 02:00:52 Done.
options, args = parse.parse_args()
@@ -1609,7 +1613,8 @@ def checkout(options, git_slns, specs, buildspec, master,
# Finally, extra configurations such as shallowness of the clone.
shallow=options.shallow,
refs=options.refs,
- git_cache_dir=options.git_cache_dir)
+ git_cache_dir=options.git_cache_dir,
+ reset_soft=not options.no_reset_soft)
gclient_output = ensure_checkout(**checkout_parameters)
except GclientSyncFailed:
print 'We failed gclient sync, lets delete the checkout and retry.'
« no previous file with comments | « recipe_modules/bot_update/example.expected/no_reset_soft.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698