From 1e2cb1573bd2a2c847dee2844a5b6750e9270c73 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Ruel Date: Wed, 17 Apr 2019 17:32:52 +0000 Subject: [PATCH] [roll-dep] Ignore chromium-autoroll rolls - It uses a different commit subject than recipe roller. - Switch from looking up for magic strings to use a regexp instead. Document the source of each string, to help keep up when the source diverge. Tested manually. Change-Id: I76fc6b6692508c615a0e76c4b6b403f8c513dd31 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1564938 Commit-Queue: Marc-Antoine Ruel Reviewed-by: Andrii Shyshkalov --- roll_dep.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/roll_dep.py b/roll_dep.py index 174805458..616fb6036 100755 --- a/roll_dep.py +++ b/roll_dep.py @@ -22,6 +22,25 @@ GCLIENT_PATH = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'gclient.py') +# Commit subject that will be considered a roll. In the format generated by the +# git log used, so it's "-- " +_ROLL_SUBJECT = re.compile( + # Date + r'^\d\d\d\d-\d\d-\d\d ' + # Author + r'[^ ]+ ' + # Subject + r'(' + # Generated by + # https://skia.googlesource.com/buildbot/+/master/autoroll/go/repo_manager/deps_repo_manager.go + r'Roll [^ ]+ [a-f0-9]+\.\.[a-f0-9]+ \(\d+ commits\)' + r'|' + # Generated by + # https://chromium.googlesource.com/infra/infra/+/master/recipes/recipe_modules/recipe_autoroller/api.py + r'Roll recipe dependencies \(trivial\)\.' + r')$') + + class Error(Exception): pass @@ -90,10 +109,7 @@ def generate_commit_message( cwd=full_dir).rstrip() logs = re.sub(r'(?m)^(\d\d\d\d-\d\d-\d\d [^@]+)@[^ ]+( .*)$', r'\1\2', logs) lines = logs.splitlines() - cleaned_lines = [ - l for l in lines - if not l.endswith('Roll recipe dependencies (trivial).') - ] + cleaned_lines = [l for l in lines if not _ROLL_SUBJECT.match(l)] logs = '\n'.join(cleaned_lines) + '\n' nb_commits = len(lines)