OLD | NEW |
1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
2 # | 2 # |
3 # Copyright (c) 2009 Google Inc. All rights reserved. | 3 # Copyright (c) 2009 Google Inc. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 # up the directory tree for the top of the SVN checkout | 706 # up the directory tree for the top of the SVN checkout |
707 root_dir = project_dir | 707 root_dir = project_dir |
708 one_up_dir = os.path.dirname(root_dir) | 708 one_up_dir = os.path.dirname(root_dir) |
709 while os.path.exists(os.path.join(one_up_dir, ".svn")): | 709 while os.path.exists(os.path.join(one_up_dir, ".svn")): |
710 root_dir = os.path.dirname(root_dir) | 710 root_dir = os.path.dirname(root_dir) |
711 one_up_dir = os.path.dirname(one_up_dir) | 711 one_up_dir = os.path.dirname(one_up_dir) |
712 | 712 |
713 prefix = os.path.commonprefix([root_dir, project_dir]) | 713 prefix = os.path.commonprefix([root_dir, project_dir]) |
714 return fullname[len(prefix) + 1:] | 714 return fullname[len(prefix) + 1:] |
715 | 715 |
716 # Not SVN? Try to find a git or hg top level directory by searching up | 716 # Not SVN <= 1.6? Try to find a git, hg, or svn top level directory by |
717 # from the current path. | 717 # searching up from the current path. |
718 root_dir = os.path.dirname(fullname) | 718 root_dir = os.path.dirname(fullname) |
719 while (root_dir != os.path.dirname(root_dir) and | 719 while (root_dir != os.path.dirname(root_dir) and |
720 not os.path.exists(os.path.join(root_dir, ".git")) and | 720 not os.path.exists(os.path.join(root_dir, ".git")) and |
721 not os.path.exists(os.path.join(root_dir, ".hg"))): | 721 not os.path.exists(os.path.join(root_dir, ".hg")) and |
| 722 not os.path.exists(os.path.join(root_dir, ".svn"))): |
722 root_dir = os.path.dirname(root_dir) | 723 root_dir = os.path.dirname(root_dir) |
723 | 724 |
724 if (os.path.exists(os.path.join(root_dir, ".git")) or | 725 if (os.path.exists(os.path.join(root_dir, ".git")) or |
725 os.path.exists(os.path.join(root_dir, ".hg"))): | 726 os.path.exists(os.path.join(root_dir, ".hg")) or |
| 727 os.path.exists(os.path.join(root_dir, ".svn"))): |
726 prefix = os.path.commonprefix([root_dir, project_dir]) | 728 prefix = os.path.commonprefix([root_dir, project_dir]) |
727 return fullname[len(prefix) + 1:] | 729 return fullname[len(prefix) + 1:] |
728 | 730 |
729 # Don't know what to do; header guard warnings may be wrong... | 731 # Don't know what to do; header guard warnings may be wrong... |
730 return fullname | 732 return fullname |
731 | 733 |
732 def Split(self): | 734 def Split(self): |
733 """Splits the file into the directory, basename, and extension. | 735 """Splits the file into the directory, basename, and extension. |
734 | 736 |
735 For 'chrome/browser/browser.cc', Split() would | 737 For 'chrome/browser/browser.cc', Split() would |
(...skipping 2602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3338 _cpplint_state.ResetErrorCounts() | 3340 _cpplint_state.ResetErrorCounts() |
3339 for filename in filenames: | 3341 for filename in filenames: |
3340 ProcessFile(filename, _cpplint_state.verbose_level) | 3342 ProcessFile(filename, _cpplint_state.verbose_level) |
3341 _cpplint_state.PrintErrorCounts() | 3343 _cpplint_state.PrintErrorCounts() |
3342 | 3344 |
3343 sys.exit(_cpplint_state.error_count > 0) | 3345 sys.exit(_cpplint_state.error_count > 0) |
3344 | 3346 |
3345 | 3347 |
3346 if __name__ == '__main__': | 3348 if __name__ == '__main__': |
3347 main() | 3349 main() |
OLD | NEW |