Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1626)

Unified Diff: presubmit_support.py

Issue 195793021: Infer CL author and reviewer list from local state if the issue has not previously been uploaded. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Add an additional test Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
diff --git a/presubmit_support.py b/presubmit_support.py
index ebcf14e01dc89dde8868c245b12bfb6741b2104e..ae56b068b3494e78c44289a571b5eabb270ed230 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -794,27 +794,16 @@ class Change(object):
if files is None:
files = []
self._name = name
- self._full_description = description
# Convert root into an absolute path.
self._local_root = os.path.abspath(local_root)
self.issue = issue
self.patchset = patchset
self.author_email = author
- # From the description text, build up a dictionary of key/value pairs
- # plus the description minus all key/value or "tag" lines.
- description_without_tags = []
+ self._full_description = ''
self.tags = {}
- for line in self._full_description.splitlines():
- m = self.TAG_LINE_RE.match(line)
- if m:
- self.tags[m.group('key')] = m.group('value')
- else:
- description_without_tags.append(line)
-
- # Change back to text and remove whitespace at end.
- self._description_without_tags = (
- '\n'.join(description_without_tags).rstrip())
+ self._description_without_tags = ''
+ self.SetDescriptionText(description)
assert all(
(isinstance(f, (list, tuple)) and len(f) == 2) for f in files), files
@@ -842,6 +831,27 @@ class Change(object):
"""Returns the complete changelist description including tags."""
return self._full_description
+ def SetDescriptionText(self, description):
+ """Sets the full description text (including tags) to |description|.
+
+ Also updates the list of tags."""
+ self._full_description = description
+
+ # From the description text, build up a dictionary of key/value pairs
+ # plus the description minus all key/value or "tag" lines.
+ description_without_tags = []
+ self.tags = {}
+ for line in self._full_description.splitlines():
+ m = self.TAG_LINE_RE.match(line)
+ if m:
+ self.tags[m.group('key')] = m.group('value')
+ else:
+ description_without_tags.append(line)
+
+ # Change back to text and remove whitespace at end.
+ self._description_without_tags = (
+ '\n'.join(description_without_tags).rstrip())
+
def RepositoryRoot(self):
"""Returns the repository (checkout) root directory for this change,
as an absolute path.
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698