[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 <maruel@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/roll_dep.py b/roll_dep.py
index 1748054..616fb60 100755
--- a/roll_dep.py
+++ b/roll_dep.py
@@ -22,6 +22,25 @@
     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 "<year>-<month>-<day> <author> <subject>"
+_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 @@
       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)