OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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.8.0' | 9 __version__ = '1.8.0' |
10 | 10 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 dir_with_slash = normpath("%s/" % self.PresubmitLocalPath()) | 378 dir_with_slash = normpath("%s/" % self.PresubmitLocalPath()) |
379 if len(dir_with_slash) == 1: | 379 if len(dir_with_slash) == 1: |
380 dir_with_slash = '' | 380 dir_with_slash = '' |
381 | 381 |
382 return filter( | 382 return filter( |
383 lambda x: normpath(x.AbsoluteLocalPath()).startswith(dir_with_slash), | 383 lambda x: normpath(x.AbsoluteLocalPath()).startswith(dir_with_slash), |
384 self.change.AffectedFiles(include_dirs, include_deletes, file_filter)) | 384 self.change.AffectedFiles(include_dirs, include_deletes, file_filter)) |
385 | 385 |
386 def LocalPaths(self, include_dirs=False): | 386 def LocalPaths(self, include_dirs=False): |
387 """Returns local paths of input_api.AffectedFiles().""" | 387 """Returns local paths of input_api.AffectedFiles().""" |
388 return [af.LocalPath() for af in self.AffectedFiles(include_dirs)] | 388 paths = [af.LocalPath() for af in self.AffectedFiles(include_dirs)] |
| 389 logging.debug("LocalPaths: %s", paths) |
| 390 return paths |
389 | 391 |
390 def AbsoluteLocalPaths(self, include_dirs=False): | 392 def AbsoluteLocalPaths(self, include_dirs=False): |
391 """Returns absolute local paths of input_api.AffectedFiles().""" | 393 """Returns absolute local paths of input_api.AffectedFiles().""" |
392 return [af.AbsoluteLocalPath() for af in self.AffectedFiles(include_dirs)] | 394 return [af.AbsoluteLocalPath() for af in self.AffectedFiles(include_dirs)] |
393 | 395 |
394 def ServerPaths(self, include_dirs=False): | 396 def ServerPaths(self, include_dirs=False): |
395 """Returns server paths of input_api.AffectedFiles().""" | 397 """Returns server paths of input_api.AffectedFiles().""" |
396 return [af.ServerPath() for af in self.AffectedFiles(include_dirs)] | 398 return [af.ServerPath() for af in self.AffectedFiles(include_dirs)] |
397 | 399 |
398 def AffectedTextFiles(self, include_deletes=None): | 400 def AffectedTextFiles(self, include_deletes=None): |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 except PresubmitFailure, e: | 1644 except PresubmitFailure, e: |
1643 print >> sys.stderr, e | 1645 print >> sys.stderr, e |
1644 print >> sys.stderr, 'Maybe your depot_tools is out of date?' | 1646 print >> sys.stderr, 'Maybe your depot_tools is out of date?' |
1645 print >> sys.stderr, 'If all fails, contact maruel@' | 1647 print >> sys.stderr, 'If all fails, contact maruel@' |
1646 return 2 | 1648 return 2 |
1647 | 1649 |
1648 | 1650 |
1649 if __name__ == '__main__': | 1651 if __name__ == '__main__': |
1650 fix_encoding.fix_encoding() | 1652 fix_encoding.fix_encoding() |
1651 sys.exit(Main(None)) | 1653 sys.exit(Main(None)) |
OLD | NEW |