Commit 1e509c54 authored by Sean McAllister's avatar Sean McAllister Committed by LUCI CQ

presubmits: Modify bug parsing to support FIX.* fields from gitwatch

Gitwatch supports closing bugs with a FIX(ES|ED|ING)? tag in the
commit message, but we only check BUG to ensure a bug is
specified, add the fix fields to BugsFromDescription so that presubmits
will still pass if only eg: FIXES=b:1234 is given.

Gitwatch reference:
  http://shortn/_LGPgBjgi3A

FIXED=b:203812728
TEST=presubmit_unittest.py doesn't fail more than it already does

Change-Id: I6afc38c786e281dcefb4d359bb9212ebe5980ed6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3237598
Auto-Submit: Sean McAllister <smcallis@google.com>
Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
parent 2b8a99b1
...@@ -1175,7 +1175,14 @@ class Change(object): ...@@ -1175,7 +1175,14 @@ class Change(object):
def BugsFromDescription(self): def BugsFromDescription(self):
"""Returns all bugs referenced in the commit description.""" """Returns all bugs referenced in the commit description."""
tags = [b.strip() for b in self.tags.get('BUG', '').split(',') if b.strip()] bug_tags = ['BUG', 'FIXED']
tags = []
for tag in bug_tags:
values = self.tags.get(tag)
if values:
tags += [value.strip() for value in values.split(',')]
footers = [] footers = []
parsed = self.GitFootersFromDescription() parsed = self.GitFootersFromDescription()
unsplit_footers = parsed.get('Bug', []) + parsed.get('Fixed', []) unsplit_footers = parsed.get('Bug', []) + parsed.get('Fixed', [])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment