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): ...@@ -626,6 +626,7 @@ class GitAffectedFile(AffectedFile):
def GenerateScmDiff(self): def GenerateScmDiff(self):
return scm.GIT.GenerateDiff(self._local_root, files=[self.LocalPath(),]) return scm.GIT.GenerateDiff(self._local_root, files=[self.LocalPath(),])
class Change(object): class Change(object):
"""Describe a change. """Describe a change.
...@@ -642,6 +643,7 @@ class Change(object): ...@@ -642,6 +643,7 @@ class Change(object):
# Matches key/value (or "tag") lines in changelist descriptions. # Matches key/value (or "tag") lines in changelist descriptions.
_TAG_LINE_RE = re.compile( _TAG_LINE_RE = re.compile(
'^\s*(?P<key>[A-Z][A-Z_0-9]*)\s*=\s*(?P<value>.*?)\s*$') '^\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): def __init__(self, name, description, local_root, files, issue, patchset):
if files is None: if files is None:
...@@ -652,7 +654,6 @@ class Change(object): ...@@ -652,7 +654,6 @@ class Change(object):
self._local_root = os.path.abspath(local_root) self._local_root = os.path.abspath(local_root)
self.issue = issue self.issue = issue
self.patchset = patchset self.patchset = patchset
self.scm = ''
# From the description text, build up a dictionary of key/value pairs # From the description text, build up a dictionary of key/value pairs
# plus the description minus all key/value or "tag" lines. # plus the description minus all key/value or "tag" lines.
...@@ -766,11 +767,8 @@ class Change(object): ...@@ -766,11 +767,8 @@ class Change(object):
class SvnChange(Change): class SvnChange(Change):
_AFFECTED_FILES = SvnAffectedFile _AFFECTED_FILES = SvnAffectedFile
scm = 'svn'
def __init__(self, *args, **kwargs): _changelists = None
Change.__init__(self, *args, **kwargs)
self.scm = 'svn'
self._changelists = None
def _GetChangeLists(self): def _GetChangeLists(self):
"""Get all change lists.""" """Get all change lists."""
...@@ -801,10 +799,7 @@ class SvnChange(Change): ...@@ -801,10 +799,7 @@ class SvnChange(Change):
class GitChange(Change): class GitChange(Change):
_AFFECTED_FILES = GitAffectedFile _AFFECTED_FILES = GitAffectedFile
scm = 'git'
def __init__(self, *args, **kwargs):
Change.__init__(self, *args, **kwargs)
self.scm = 'git'
def ListRelevantPresubmitFiles(files, root): 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