From c1a06c1ae06f8e9ec0cc0a877d58b263e1dd1a5e Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Wed, 12 Jan 2022 00:44:14 +0000 Subject: [PATCH] Drop support for master branch in roll_dep R=gavinmak@google.com Fixed: 1118447 Change-Id: I733c7f345a3a8e1dd4bf3a9935306ba43b1584c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3360904 Reviewed-by: Gavin Mak Commit-Queue: Josip Sokcevic --- roll_dep.py | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/roll_dep.py b/roll_dep.py index e1fbbdcc3..ace0399a1 100755 --- a/roll_dep.py +++ b/roll_dep.py @@ -5,8 +5,8 @@ """Rolls DEPS controlled dependency. -Works only with git checkout and git dependencies. Currently this -script will always roll to the tip of to origin/main or origin/master. +Works only with git checkout and git dependencies. Currently this script will +always roll to the tip of to origin/main. """ from __future__ import print_function @@ -72,22 +72,13 @@ def return_code(*args, **kwargs): def is_pristine(root): """Returns True if a git checkout is pristine.""" - # Check both origin/master and origin/main since many projects are - # transitioning to origin/main. - for branch in ('origin/main', 'origin/master'): - # `git rev-parse --verify` has a non-zero return code if the revision - # doesn't exist. - rev_cmd = ['git', 'rev-parse', '--verify', '--quiet', - 'refs/remotes/' + branch] - if return_code(rev_cmd, cwd=root) != 0: - continue - - diff_cmd = ['git', 'diff', '--ignore-submodules', branch] - return (not check_output(diff_cmd, cwd=root).strip() and - not check_output(diff_cmd + ['--cached'], cwd=root).strip()) - - - raise Error('Couldn\'t find any of origin/main or origin/master') + # `git rev-parse --verify` has a non-zero return code if the revision + # doesn't exist. + diff_cmd = ['git', 'diff', '--ignore-submodules', 'origin/main'] + return (not check_output(diff_cmd, cwd=root).strip() and + not check_output(diff_cmd + ['--cached'], cwd=root).strip()) + + def get_log_url(upstream_url, head, tot): """Returns an URL to read logs via a Web UI if applicable."""