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

Unified Diff: presubmit_support.py

Issue 6821083: Use class-level variable instead of instance members for Change object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 8 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 | « no previous file | no next file » | 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 b0e325ba9673eb1dfabde325c6a6244f0191c536..3e4d43330b5f6feef63e67fbc343a6c93c95a4b8 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -626,6 +626,7 @@ class GitAffectedFile(AffectedFile):
def GenerateScmDiff(self):
return scm.GIT.GenerateDiff(self._local_root, files=[self.LocalPath(),])
+
class Change(object):
"""Describe a change.
@@ -642,6 +643,7 @@ class Change(object):
# Matches key/value (or "tag") lines in changelist descriptions.
_TAG_LINE_RE = re.compile(
'^\s*(?P<key>[A-Z][A-Z_0-9]*)\s*=\s*(?P<value>.*?)\s*$')
+ scm = ''
def __init__(self, name, description, local_root, files, issue, patchset):
if files is None:
@@ -652,7 +654,6 @@ class Change(object):
self._local_root = os.path.abspath(local_root)
self.issue = issue
self.patchset = patchset
- self.scm = ''
# From the description text, build up a dictionary of key/value pairs
# plus the description minus all key/value or "tag" lines.
@@ -766,11 +767,8 @@ class Change(object):
class SvnChange(Change):
_AFFECTED_FILES = SvnAffectedFile
-
- def __init__(self, *args, **kwargs):
- Change.__init__(self, *args, **kwargs)
- self.scm = 'svn'
- self._changelists = None
+ scm = 'svn'
+ _changelists = None
def _GetChangeLists(self):
"""Get all change lists."""
@@ -801,10 +799,7 @@ class SvnChange(Change):
class GitChange(Change):
_AFFECTED_FILES = GitAffectedFile
-
- def __init__(self, *args, **kwargs):
- Change.__init__(self, *args, **kwargs)
- self.scm = 'git'
+ scm = 'git'
def ListRelevantPresubmitFiles(files, root):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698