roll-dep: use Middle Out Compression™️ for logs

Trimming at the bottom looses an important datapoint: which is the
oldest commit. To fix this problem, use Middle Out Compression™️ to
creates a better DEPS roll CL description.

Change-Id: I290073d25989b6880a4b608cd2b8f26a300cc3a1
Reviewed-on: https://chromium-review.googlesource.com/c/1415430
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Marc-Antoine Ruel <maruel@chromium.org>
changes/30/1415430/4
Marc-Antoine Ruel 6 years ago committed by Commit Bot
parent edc8925490
commit 6ce18220f4

@ -113,8 +113,10 @@ def generate_commit_message(
# internal -> external rollers. Please do not remove or break it.
if not no_log and should_show_log(upstream_url):
if len(cleaned_lines) > log_limit:
# Keep the first N log entries.
logs = ''.join(logs.splitlines(True)[:log_limit]) + '(...)\n'
# Keep the first N/2 log entries and last N/2 entries.
lines = logs.splitlines(True)
lines = lines[:log_limit/2] + ['(...)\n'] + lines[-log_limit/2:]
logs = ''.join(lines)
log_section += logs
return header + log_section

Loading…
Cancel
Save