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

Side by Side Diff: tools/presubmit.py

Issue 2534813002: [test] Don't run presubmit over deleted files. (Closed)
Patch Set: Created 4 years 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.py ('k') | no next file » | 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/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 # Helper for getting directory pieces. 172 # Helper for getting directory pieces.
173 dirs = lambda f: dirname(f).split(os.sep) 173 dirs = lambda f: dirname(f).split(os.sep)
174 174
175 # Path offsets where to look (to be in sync with RunOnPath). 175 # Path offsets where to look (to be in sync with RunOnPath).
176 # Normalize '.' to check for it with str.startswith. 176 # Normalize '.' to check for it with str.startswith.
177 search_paths = [('' if p == '.' else p) for p in self.GetPathsToSearch()] 177 search_paths = [('' if p == '.' else p) for p in self.GetPathsToSearch()]
178 178
179 all_files = [ 179 all_files = [
180 f.AbsoluteLocalPath() 180 f.AbsoluteLocalPath()
181 for f in files 181 for f in files
182 if (os.path.isfile(f.AbsoluteLocalPath()) and 182 if (not self.IgnoreFile(f.LocalPath()) and
183 not self.IgnoreFile(f.LocalPath()) and
184 self.IsRelevant(f.LocalPath()) and 183 self.IsRelevant(f.LocalPath()) and
185 all(not self.IgnoreDir(d) for d in dirs(f.LocalPath())) and 184 all(not self.IgnoreDir(d) for d in dirs(f.LocalPath())) and
186 any(map(f.LocalPath().startswith, search_paths))) 185 any(map(f.LocalPath().startswith, search_paths)))
187 ] 186 ]
188 187
189 return self.ProcessFiles(all_files) 188 return self.ProcessFiles(all_files)
190 189
191 def IgnoreDir(self, name): 190 def IgnoreDir(self, name):
192 return (name.startswith('.') or 191 return (name.startswith('.') or
193 name in ('buildtools', 'data', 'gmock', 'gtest', 'kraken', 192 name in ('buildtools', 'data', 'gmock', 'gtest', 'kraken',
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 success &= SourceProcessor().RunOnPath(workspace) 521 success &= SourceProcessor().RunOnPath(workspace)
523 success &= CheckStatusFiles(workspace) 522 success &= CheckStatusFiles(workspace)
524 if success: 523 if success:
525 return 0 524 return 0
526 else: 525 else:
527 return 1 526 return 1
528 527
529 528
530 if __name__ == '__main__': 529 if __name__ == '__main__':
531 sys.exit(Main()) 530 sys.exit(Main())
OLDNEW
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698