Using Change.BugsFromDescription to read CL bugs in PRESUBMIT checks.
Since we migrated to Gerrit recently we cannot rely on the BUG= format
for this check because:
* it is deprecated: https://cs.chromium.org/chromium/tools/depot_tools/presubmit_support.py?l=908&rcl=94652a37677488738626b96ff504fc07afbbaa87
* it causes confusion in our users because Gerrit uses Bug: and all the error messages were requiring BUG=
This CL uses a more general API to get the list of bugs from in a CL and
renames BUG= to Bug:.
Bug: None
Change-Id: I7e86fe6d8ca426d9e4bf3bd39021d2a510ec196f
No-Treechecks: True
No-Try: True
Reviewed-on: https://webrtc-review.googlesource.com/8881
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20260}
diff --git a/presubmit_test_mocks.py b/presubmit_test_mocks.py
index cbfc4f5..4b2b3c7 100644
--- a/presubmit_test_mocks.py
+++ b/presubmit_test_mocks.py
@@ -18,7 +18,7 @@
"""
def __init__(self):
- self.change = MockChange([])
+ self.change = MockChange([], [])
self.files = []
def AffectedSourceFiles(self, file_filter=None):
@@ -64,8 +64,12 @@
current change.
"""
- def __init__(self, changed_files):
+ def __init__(self, changed_files, bugs_from_description):
self._changed_files = changed_files
+ self._bugs_from_description = bugs_from_description
+
+ def BugsFromDescription(self):
+ return self._bugs_from_description
class MockFile(object):