From 51104fec0306a2b7e210e4e8608e3829e3c7b066 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Ruel Date: Wed, 1 Mar 2017 17:57:41 -0500 Subject: [PATCH] Update roll-dep to skip trivial recipe roll Otherwise it can make the log overwhelming when the number of rolls is higher than the number of meaningful commits. R=iannucci@chromium.org BUG=620765 Change-Id: Iec0b41304d50091498d43abc4883e522b8cc9a2c Reviewed-on: https://chromium-review.googlesource.com/448676 Commit-Queue: Marc-Antoine Ruel Reviewed-by: Robbie Iannucci --- roll_dep.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/roll_dep.py b/roll_dep.py index 350db7bf25..96e1ad550c 100755 --- a/roll_dep.py +++ b/roll_dep.py @@ -124,15 +124,23 @@ def roll(root, deps_dir, roll_to, key, reviewers, bug, no_log, log_limit, ] logs = check_output( cmd + ['--format=%ad %ae %s'], # Args with '=' are automatically quoted. - cwd=full_dir) + cwd=full_dir).rstrip() logs = re.sub(r'(?m)^(\d\d\d\d-\d\d-\d\d [^@]+)@[^ ]+( .*)$', r'\1\2', logs) - nb_commits = logs.count('\n') + lines = logs.splitlines() + cleaned_lines = [ + l for l in lines + if not l.endswith('recipe-roller Roll recipe dependencies (trivial).') + ] + logs = '\n'.join(cleaned_lines) + '\n' + nb_commits = len(lines) + rolls = nb_commits - len(cleaned_lines) - header = 'Roll %s/ %s (%d commit%s).\n\n' % ( + header = 'Roll %s/ %s (%d commit%s%s)\n\n' % ( deps_dir, commit_range, nb_commits, - 's' if nb_commits > 1 else '') + 's' if nb_commits > 1 else '', + ('; %s trivial rolls' % rolls) if rolls else '') log_section = '' if log_url: @@ -140,7 +148,7 @@ def roll(root, deps_dir, roll_to, key, reviewers, bug, no_log, log_limit, log_section += '$ %s ' % ' '.join(cmd) log_section += '--format=\'%ad %ae %s\'\n' if not no_log and should_show_log(upstream_url): - if logs.count('\n') > log_limit: + if len(cleaned_lines) > log_limit: # Keep the first N log entries. logs = ''.join(logs.splitlines(True)[:log_limit]) + '(...)\n' log_section += logs