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

Side by Side Diff: testing_support/filesystem_mock.py

Issue 11569018: Suggest owners for OWNERS files that only have per-file owners. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « owners.py ('k') | tests/owners_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import errno 5 import errno
6 import fnmatch 6 import fnmatch
7 import os 7 import os
8 import re 8 import re
9 import StringIO 9 import StringIO
10 10
(...skipping 28 matching lines...) Expand all
39 return path 39 return path
40 40
41 def dirname(self, path): 41 def dirname(self, path):
42 if self.sep not in path: 42 if self.sep not in path:
43 return '' 43 return ''
44 return self._split(path)[0] or self.sep 44 return self._split(path)[0] or self.sep
45 45
46 def exists(self, path): 46 def exists(self, path):
47 return self.isfile(path) or self.isdir(path) 47 return self.isfile(path) or self.isdir(path)
48 48
49 def isabs(self, path):
50 return path.startswith(self.sep)
M-A Ruel 2012/12/13 23:25:16 I assume you don't mind if this doesn't pass on Wi
51
49 def isfile(self, path): 52 def isfile(self, path):
50 return path in self.files and self.files[path] is not None 53 return path in self.files and self.files[path] is not None
51 54
52 def isdir(self, path): 55 def isdir(self, path):
53 if path in self.files: 56 if path in self.files:
54 return False 57 return False
55 if not path.endswith(self.sep): 58 if not path.endswith(self.sep):
56 path += self.sep 59 path += self.sep
57 60
58 # We need to use a copy of the keys here in order to avoid switching 61 # We need to use a copy of the keys here in order to avoid switching
(...skipping 18 matching lines...) Expand all
77 if self.files[path] is None: 80 if self.files[path] is None:
78 _RaiseNotFound(path) 81 _RaiseNotFound(path)
79 return self.files[path] 82 return self.files[path]
80 83
81 @staticmethod 84 @staticmethod
82 def relpath(path, base): 85 def relpath(path, base):
83 # This implementation is wrong in many ways; assert to check them for now. 86 # This implementation is wrong in many ways; assert to check them for now.
84 assert path.startswith(base) 87 assert path.startswith(base)
85 assert base.endswith('/') 88 assert base.endswith('/')
86 return path[len(base):] 89 return path[len(base):]
OLDNEW
« no previous file with comments | « owners.py ('k') | tests/owners_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698