Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """A database of OWNERS files. | 5 """A database of OWNERS files. |
| 6 | 6 |
| 7 OWNERS files indicate who is allowed to approve changes in a specific directory | 7 OWNERS files indicate who is allowed to approve changes in a specific directory |
| 8 (or who is allowed to make changes without needing approval of another OWNER). | 8 (or who is allowed to make changes without needing approval of another OWNER). |
| 9 Note that all changes must still be reviewed by someone familiar with the code, | 9 Note that all changes must still be reviewed by someone familiar with the code, |
| 10 so you may need approval from both an OWNER and a reviewer in many cases. | 10 so you may need approval from both an OWNER and a reviewer in many cases. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 continue | 217 continue |
| 218 if line == 'set noparent': | 218 if line == 'set noparent': |
| 219 self.stop_looking.add(dirpath) | 219 self.stop_looking.add(dirpath) |
| 220 continue | 220 continue |
| 221 | 221 |
| 222 m = re.match("per-file (.+)=(.+)", line) | 222 m = re.match("per-file (.+)=(.+)", line) |
| 223 if m: | 223 if m: |
| 224 glob_string = m.group(1) | 224 glob_string = m.group(1) |
| 225 directive = m.group(2) | 225 directive = m.group(2) |
| 226 full_glob_string = self.os_path.join(self.root, dirpath, glob_string) | 226 full_glob_string = self.os_path.join(self.root, dirpath, glob_string) |
| 227 if self.os_path.sep in glob_string: | 227 if '/' in glob_string: |
|
M-A Ruel
2012/10/20 23:05:23
personally, I'd also blacklist '\\' for safety.
| |
| 228 raise SyntaxErrorInOwnersFile(owners_path, lineno, | 228 raise SyntaxErrorInOwnersFile(owners_path, lineno, |
| 229 'per-file globs cannot span directories: "%s"' % line) | 229 'per-file globs cannot span directories: "%s"' % line) |
| 230 baselines = self.glob(full_glob_string) | 230 baselines = self.glob(full_glob_string) |
| 231 for baseline in (self.os_path.relpath(b, self.root) for b in baselines): | 231 for baseline in (self.os_path.relpath(b, self.root) for b in baselines): |
| 232 self._add_entry(baseline, directive, "per-file line", | 232 self._add_entry(baseline, directive, "per-file line", |
| 233 owners_path, lineno) | 233 owners_path, lineno) |
| 234 continue | 234 continue |
| 235 | 235 |
| 236 if line.startswith('set '): | 236 if line.startswith('set '): |
| 237 raise SyntaxErrorInOwnersFile(owners_path, lineno, | 237 raise SyntaxErrorInOwnersFile(owners_path, lineno, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 break | 299 break |
| 300 | 300 |
| 301 final_owners.add(max_owner) | 301 final_owners.add(max_owner) |
| 302 | 302 |
| 303 # Remove all directories owned by the current owner from the remaining | 303 # Remove all directories owned by the current owner from the remaining |
| 304 # list. | 304 # list. |
| 305 for dirname in owned_dirs[max_owner]: | 305 for dirname in owned_dirs[max_owner]: |
| 306 dirs.discard(dirname) | 306 dirs.discard(dirname) |
| 307 | 307 |
| 308 return final_owners | 308 return final_owners |
| OLD | NEW |