roll_util: Truncate long lists of commits

Change-Id: Ibfb44f14c7dac07f6cc90c8911eb2771e7f0731f
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/97400
Reviewed-by: Oliver Newman <olivernewman@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
diff --git a/recipe_modules/roll_util/api.py b/recipe_modules/roll_util/api.py
index f685722..ac74465 100644
--- a/recipe_modules/roll_util/api.py
+++ b/recipe_modules/roll_util/api.py
@@ -412,10 +412,17 @@
         ]
 
         num_commits = len(roll.commits)
+
         if not _is_hash(roll.old_revision):
             num_commits = 'multiple'
             one_liners.append('...')
 
+        if len(one_liners) > 100:
+            one_liners = one_liners[0:5] + ['...'] + one_liners[-5:]
+            # In case both this and the previous condition match.
+            if one_liners[-1] == '...':
+                one_liners.pop()  # pragma: no cover
+
         kwargs = {
             'project_name': roll.project_name,
             'remote': roll.remote,