| 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 23 matching lines...) Expand all Loading... |
| 34 from webkitpy.common.checkout.diff_parser import DiffParser | 34 from webkitpy.common.checkout.diff_parser import DiffParser |
| 35 from webkitpy.common.system.executive import Executive | 35 from webkitpy.common.system.executive import Executive |
| 36 from webkitpy.common.system.filesystem import FileSystem | 36 from webkitpy.common.system.filesystem import FileSystem |
| 37 from webkitpy.common.checkout.scm.detection import SCMDetector | 37 from webkitpy.common.checkout.scm.detection import SCMDetector |
| 38 | 38 |
| 39 | 39 |
| 40 _log = logging.getLogger(__name__) | 40 _log = logging.getLogger(__name__) |
| 41 | 41 |
| 42 | 42 |
| 43 class PatchReader(object): | 43 class PatchReader(object): |
| 44 |
| 44 """Supports checking style in patches.""" | 45 """Supports checking style in patches.""" |
| 45 | 46 |
| 46 def __init__(self, text_file_reader): | 47 def __init__(self, text_file_reader): |
| 47 """Create a PatchReader instance. | 48 """Create a PatchReader instance. |
| 48 | 49 |
| 49 Args: | 50 Args: |
| 50 text_file_reader: A TextFileReader instance. | 51 text_file_reader: A TextFileReader instance. |
| 51 | 52 |
| 52 """ | 53 """ |
| 53 self._text_file_reader = text_file_reader | 54 self._text_file_reader = text_file_reader |
| (...skipping 20 matching lines...) Expand all Loading... |
| 74 if detection.display_name() == "git": | 75 if detection.display_name() == "git": |
| 75 call_only_once = False | 76 call_only_once = False |
| 76 continue | 77 continue |
| 77 # Don't check files which contain only deleted lines | 78 # Don't check files which contain only deleted lines |
| 78 # as they can never add style errors. However, mark them as | 79 # as they can never add style errors. However, mark them as |
| 79 # processed so that we count up number of such files. | 80 # processed so that we count up number of such files. |
| 80 self._text_file_reader.count_delete_only_file() | 81 self._text_file_reader.count_delete_only_file() |
| 81 continue | 82 continue |
| 82 | 83 |
| 83 self._text_file_reader.process_file(file_path=path, line_numbers=lin
e_numbers) | 84 self._text_file_reader.process_file(file_path=path, line_numbers=lin
e_numbers) |
| OLD | NEW |