diff --git a/presubmit_support.py b/presubmit_support.py index b0e325ba96..3e4d43330b 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[A-Z][A-Z_0-9]*)\s*=\s*(?P.*?)\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):