From 2c9dbb89fbb6b551f455107a3f28c7b633353d41 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Thu, 28 Jan 2021 21:21:14 +0000 Subject: [PATCH] Revert "Add previous_got_revision and previous_got_revision_cp to output" This reverts commit 6d0c0ffef52928a9c35402604505e3a985627857. Reason for revert: this appears to break builders if reference is a commit hash: git log --format=%B -n1 HEAD failed with code 128 Original change's description: > Add previous_got_revision and previous_got_revision_cp to output > > As chrome browser infra works to improve CQ times, we would like to > easily glance at builds and see how many new commits were checked out. > Currently you have to open up bot_update stdout to see the previous > HEAD revision and go from there. Having this conveniently outputted > would be very convenient. > > If the bot has previously checked out the repo, output which revision > and commit position were checked out. > > example LED build showing new output: https://ci.chromium.org/swarming/task/51592e46d6a70e10?server=chromium-swarm.appspot.com > > Change-Id: Ib8a6f152a593446ce4082477bc9ada44f1fd1fc3 > Bug: 1170568 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2644829 > Reviewed-by: Josip Sokcevic > Commit-Queue: Stephanie Kim TBR=infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com,kimstephanie@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 1170568 Change-Id: I50d6ef6802c2eb1614cca804391c7826a79a2cf9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2657023 Reviewed-by: Josip Sokcevic Commit-Queue: Josip Sokcevic --- .../bot_update/resources/bot_update.py | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/recipes/recipe_modules/bot_update/resources/bot_update.py b/recipes/recipe_modules/bot_update/resources/bot_update.py index 62137149c..9d0250601 100755 --- a/recipes/recipe_modules/bot_update/resources/bot_update.py +++ b/recipes/recipe_modules/bot_update/resources/bot_update.py @@ -839,8 +839,7 @@ def get_commit_position(git_path, revision='HEAD'): return None -def parse_got_revision(gclient_output, got_revision_mapping, - prev_checkout_info): +def parse_got_revision(gclient_output, got_revision_mapping): """Translate git gclient revision mapping to build properties.""" properties = {} solutions_output = { @@ -863,16 +862,9 @@ def parse_got_revision(gclient_output, got_revision_mapping, revision = git('rev-parse', 'HEAD', cwd=dir_name).strip() commit_position = get_commit_position(dir_name) - prev_revision, prev_cp = prev_checkout_info.get(dir_name.rstrip('/'), - (None, None)) - properties[property_name] = revision - if prev_revision: - properties['prev_%s' % property_name] = prev_revision if commit_position: properties['%s_cp' % property_name] = commit_position - if prev_cp: - properties['prev_%s_cp' % property_name] = prev_cp return properties @@ -1113,16 +1105,6 @@ def prepare(options, git_slns, active): print('Fetching Git checkout at %s@%s' % (first_sln, revisions[first_sln])) return revisions, step_text -def current_checkout_info(solutions): - r = {} - build_dir = os.getcwd() - - for sln in solutions: - sln_dir = path.join(build_dir, sln['name']) - if path.isdir(sln_dir) and not is_broken_repo_dir(sln_dir): - r[sln['name']] = (git('rev-parse', 'HEAD', cwd=sln_dir).strip(), - get_commit_position(sln_dir)) - return r def checkout(options, git_slns, specs, revisions, step_text): print('Using Python version: %s' % (sys.version,)) @@ -1146,8 +1128,6 @@ def checkout(options, git_slns, specs, revisions, step_text): # create file, no content pass - prev_checkout_info = current_checkout_info(git_slns) - should_delete_dirty_file = False try: @@ -1221,8 +1201,7 @@ def checkout(options, git_slns, specs, revisions, step_text): if not revision_mapping: revision_mapping['got_revision'] = first_sln - got_revisions = parse_got_revision(gclient_output, revision_mapping, - prev_checkout_info) + got_revisions = parse_got_revision(gclient_output, revision_mapping) if not got_revisions: # TODO(hinoka): We should probably bail out here, but in the interest