Commit c1a06c1a authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI CQ

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/+/3360904Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
parent 35061445
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
"""Rolls DEPS controlled dependency. """Rolls DEPS controlled dependency.
Works only with git checkout and git dependencies. Currently this Works only with git checkout and git dependencies. Currently this script will
script will always roll to the tip of to origin/main or origin/master. always roll to the tip of to origin/main.
""" """
from __future__ import print_function from __future__ import print_function
...@@ -72,22 +72,13 @@ def return_code(*args, **kwargs): ...@@ -72,22 +72,13 @@ def return_code(*args, **kwargs):
def is_pristine(root): def is_pristine(root):
"""Returns True if a git checkout is pristine.""" """Returns True if a git checkout is pristine."""
# Check both origin/master and origin/main since many projects are # `git rev-parse --verify` has a non-zero return code if the revision
# transitioning to origin/main. # doesn't exist.
for branch in ('origin/main', 'origin/master'): diff_cmd = ['git', 'diff', '--ignore-submodules', 'origin/main']
# `git rev-parse --verify` has a non-zero return code if the revision return (not check_output(diff_cmd, cwd=root).strip() and
# doesn't exist. not check_output(diff_cmd + ['--cached'], cwd=root).strip())
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')
def get_log_url(upstream_url, head, tot): def get_log_url(upstream_url, head, tot):
"""Returns an URL to read logs via a Web UI if applicable.""" """Returns an URL to read logs via a Web UI if applicable."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment