git-cl: Recognize Bug: when reading change descriptions

When git-cl doesn’t see a BUG= line, it introduces a new one. The
eventual goal is to switch away from THIS=TYPE of metadata to the footer
field style that’s more natural to git and, most importantly, Gerrit.
With this change, git-cl will treat an existing Bug: line identically to
a BUG= line, and not introduce a new BUG= line if either are present.
This stops short of switching the default format to Bug:, but it allows
projects that wish to switch to the new format now to not be pestered by
git-cl introducing BUG= every time it edits a change description.

This is similar to the bug line parsing done by Bugdroid, which already
undersatnds the Bug: format. See
https://chromium.googlesource.com/infra/infra/+/ba095768d776/infra/services/bugdroid/log_parser.py.

BUG=616753

Change-Id: I23faa55c8275de44b71b031e603f2f55778d7f25
Reviewed-on: https://chromium-review.googlesource.com/451123
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
changes/23/451123/3
Mark Mentovai 8 years ago committed by Commit Bot
parent 0293956dab
commit 600d309d6c

@ -3034,7 +3034,7 @@ class ChangeDescription(object):
"""Contains a parsed form of the change description.""" """Contains a parsed form of the change description."""
R_LINE = r'^[ \t]*(TBR|R)[ \t]*=[ \t]*(.*?)[ \t]*$' R_LINE = r'^[ \t]*(TBR|R)[ \t]*=[ \t]*(.*?)[ \t]*$'
CC_LINE = r'^[ \t]*(CC)[ \t]*=[ \t]*(.*?)[ \t]*$' CC_LINE = r'^[ \t]*(CC)[ \t]*=[ \t]*(.*?)[ \t]*$'
BUG_LINE = r'^[ \t]*(BUG)[ \t]*=[ \t]*(.*?)[ \t]*$' BUG_LINE = r'^[ \t]*(BUGS?|Bugs?)[ \t]*[:=][ \t]*(.*?)[ \t]*$'
CHERRY_PICK_LINE = r'^\(cherry picked from commit [a-fA-F0-9]{40}\)$' CHERRY_PICK_LINE = r'^\(cherry picked from commit [a-fA-F0-9]{40}\)$'
def __init__(self, description): def __init__(self, description):

Loading…
Cancel
Save