Commit c193875b authored by maruel@chromium.org's avatar maruel@chromium.org

Use class-level variable instead of instance members for Change object.

R=dpranke@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/6821083

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@81322 0039d316-1c4b-4281-b951-d872f2087c98
parent 61e0b691
......@@ -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):
......
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