| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) | 2 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) |
| 3 # Copyright (C) 2010 ProFUSION embedded systems | 3 # Copyright (C) 2010 ProFUSION embedded systems |
| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 patch_files = DiffParser(patch_string.splitlines()).files | 58 patch_files = DiffParser(patch_string.splitlines()).files |
| 59 | 59 |
| 60 # If the user uses git, checking subversion config file only once is eno
ugh. | 60 # If the user uses git, checking subversion config file only once is eno
ugh. |
| 61 call_only_once = True | 61 call_only_once = True |
| 62 | 62 |
| 63 for path, diff_file in patch_files.iteritems(): | 63 for path, diff_file in patch_files.iteritems(): |
| 64 line_numbers = diff_file.added_or_modified_line_numbers() | 64 line_numbers = diff_file.added_or_modified_line_numbers() |
| 65 _log.debug('Found %s new or modified lines in: %s', len(line_numbers
), path) | 65 _log.debug('Found %s new or modified lines in: %s', len(line_numbers
), path) |
| 66 | 66 |
| 67 if not line_numbers: | 67 if not line_numbers: |
| 68 match = re.search("\s*png$", path) | 68 match = re.search(r"\s*png$", path) |
| 69 if match and fs.exists(path): | 69 if match and fs.exists(path): |
| 70 if call_only_once: | 70 if call_only_once: |
| 71 self._text_file_reader.process_file(file_path=path, line
_numbers=None) | 71 self._text_file_reader.process_file(file_path=path, line
_numbers=None) |
| 72 cwd = FileSystem().getcwd() | 72 cwd = FileSystem().getcwd() |
| 73 detection = SCMDetector(fs, Executive()).detect_scm_syst
em(cwd) | 73 detection = SCMDetector(fs, Executive()).detect_scm_syst
em(cwd) |
| 74 if detection.display_name() == "git": | 74 if detection.display_name() == "git": |
| 75 call_only_once = False | 75 call_only_once = False |
| 76 continue | 76 continue |
| 77 # Don't check files which contain only deleted lines | 77 # Don't check files which contain only deleted lines |
| 78 # as they can never add style errors. However, mark them as | 78 # as they can never add style errors. However, mark them as |
| 79 # processed so that we count up number of such files. | 79 # processed so that we count up number of such files. |
| 80 self._text_file_reader.count_delete_only_file() | 80 self._text_file_reader.count_delete_only_file() |
| 81 continue | 81 continue |
| 82 | 82 |
| 83 self._text_file_reader.process_file(file_path=path, line_numbers=lin
e_numbers) | 83 self._text_file_reader.process_file(file_path=path, line_numbers=lin
e_numbers) |
| OLD | NEW |