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

Side by Side Diff: presubmit_support.py

Issue 119421: Add CheckChangeSvnEolStyle presubmit canned check. (Closed)
Patch Set: version Created 11 years, 6 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 unified diff | Download patch
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Enables directory-specific presubmit checks to run at upload and/or commit. 6 """Enables directory-specific presubmit checks to run at upload and/or commit.
7 """ 7 """
8 8
9 __version__ = '1.3.1' 9 __version__ = '1.3.2'
10 10
11 # TODO(joi) Add caching where appropriate/needed. The API is designed to allow 11 # TODO(joi) Add caching where appropriate/needed. The API is designed to allow
12 # caching (between all different invocations of presubmit scripts for a given 12 # caching (between all different invocations of presubmit scripts for a given
13 # change). We should add it as our presubmit scripts start feeling slow. 13 # change). We should add it as our presubmit scripts start feeling slow.
14 14
15 import cPickle # Exposed through the API. 15 import cPickle # Exposed through the API.
16 import cStringIO # Exposed through the API. 16 import cStringIO # Exposed through the API.
17 import exceptions 17 import exceptions
18 import fnmatch 18 import fnmatch
19 import glob 19 import glob
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 class AffectedFile(object): 354 class AffectedFile(object):
355 """Representation of a file in a change.""" 355 """Representation of a file in a change."""
356 356
357 def __init__(self, path, action, repository_root=''): 357 def __init__(self, path, action, repository_root=''):
358 self._path = path 358 self._path = path
359 self._action = action 359 self._action = action
360 self._repository_root = repository_root 360 self._repository_root = repository_root
361 self._is_directory = None 361 self._is_directory = None
362 self._properties = {} 362 self._properties = {}
363 self.scm = ''
363 364
364 def ServerPath(self): 365 def ServerPath(self):
365 """Returns a path string that identifies the file in the SCM system. 366 """Returns a path string that identifies the file in the SCM system.
366 367
367 Returns the empty string if the file does not exist in SCM. 368 Returns the empty string if the file does not exist in SCM.
368 """ 369 """
369 return "" 370 return ""
370 371
371 def LocalPath(self): 372 def LocalPath(self):
372 """Returns the path of this file on the local disk relative to client root. 373 """Returns the path of this file on the local disk relative to client root.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 raise NotImplementedError() # Implement if/when needed. 436 raise NotImplementedError() # Implement if/when needed.
436 437
437 438
438 class SvnAffectedFile(AffectedFile): 439 class SvnAffectedFile(AffectedFile):
439 """Representation of a file in a change out of a Subversion checkout.""" 440 """Representation of a file in a change out of a Subversion checkout."""
440 441
441 def __init__(self, *args, **kwargs): 442 def __init__(self, *args, **kwargs):
442 AffectedFile.__init__(self, *args, **kwargs) 443 AffectedFile.__init__(self, *args, **kwargs)
443 self._server_path = None 444 self._server_path = None
444 self._is_text_file = None 445 self._is_text_file = None
446 self.scm = 'svn'
445 447
446 def ServerPath(self): 448 def ServerPath(self):
447 if self._server_path is None: 449 if self._server_path is None:
448 self._server_path = gclient.CaptureSVNInfo( 450 self._server_path = gclient.CaptureSVNInfo(
449 self.AbsoluteLocalPath()).get('URL', '') 451 self.AbsoluteLocalPath()).get('URL', '')
450 return self._server_path 452 return self._server_path
451 453
452 def IsDirectory(self): 454 def IsDirectory(self):
453 if self._is_directory is None: 455 if self._is_directory is None:
454 path = self.AbsoluteLocalPath() 456 path = self.AbsoluteLocalPath()
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 return not DoPresubmitChecks(gcl.ChangeInfo('No name', 0, 0, '', files), 805 return not DoPresubmitChecks(gcl.ChangeInfo('No name', 0, 0, '', files),
804 options.commit, 806 options.commit,
805 options.verbose, 807 options.verbose,
806 sys.stdout, 808 sys.stdout,
807 sys.stdin, 809 sys.stdin,
808 default_presubmit=None) 810 default_presubmit=None)
809 811
810 812
811 if __name__ == '__main__': 813 if __name__ == '__main__':
812 sys.exit(Main(sys.argv)) 814 sys.exit(Main(sys.argv))
OLDNEW
« 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