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

Side by Side Diff: tools/presubmit.py

Issue 2533583002: Presubmit should be able to handle files being deleted. (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 | « no previous file | 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 (not self.IgnoreFile(f.LocalPath()) and 182 if (os.path.isfile(f.AbsoluteLocalPath()) and
183 not self.IgnoreFile(f.LocalPath()) and
183 self.IsRelevant(f.LocalPath()) and 184 self.IsRelevant(f.LocalPath()) and
184 all(not self.IgnoreDir(d) for d in dirs(f.LocalPath())) and 185 all(not self.IgnoreDir(d) for d in dirs(f.LocalPath())) and
185 any(map(f.LocalPath().startswith, search_paths))) 186 any(map(f.LocalPath().startswith, search_paths)))
186 ] 187 ]
187 188
188 return self.ProcessFiles(all_files) 189 return self.ProcessFiles(all_files)
189 190
190 def IgnoreDir(self, name): 191 def IgnoreDir(self, name):
191 return (name.startswith('.') or 192 return (name.startswith('.') or
192 name in ('buildtools', 'data', 'gmock', 'gtest', 'kraken', 193 name in ('buildtools', 'data', 'gmock', 'gtest', 'kraken',
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 success &= SourceProcessor().RunOnPath(workspace) 522 success &= SourceProcessor().RunOnPath(workspace)
522 success &= CheckStatusFiles(workspace) 523 success &= CheckStatusFiles(workspace)
523 if success: 524 if success:
524 return 0 525 return 0
525 else: 526 else:
526 return 1 527 return 1
527 528
528 529
529 if __name__ == '__main__': 530 if __name__ == '__main__':
530 sys.exit(Main()) 531 sys.exit(Main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698