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

Unified Diff: owners.py

Issue 6609012: rename OwnersFor() to ReviewersFor(), add SyntaxError exception, ANYONE wildcard constant (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: use super() Created 9 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: owners.py
diff --git a/owners.py b/owners.py
index 76fb51f0528c1dea6cce88bb3417371e01c0c5f9..9f840dbc65c9e59f67d018dff1eb34e9edb63b3b 100644
--- a/owners.py
+++ b/owners.py
@@ -7,16 +7,39 @@
class Assertion(AssertionError):
pass
+
+class SyntaxErrorInOwnersFile(Exception):
+ def __init__(self, path, line, msg):
+ super(SyntaxErrorInOwnersFile, self).__init__((path, line, msg))
+ self.path = path
+ self.line = line
+ self.msg = msg
+
+ def __str__(self):
+ if self.msg:
+ return "%s:%d syntax error: %s" % (self.path, self.line, self.msg)
+ else:
+ return "%s:%d syntax error" % (self.path, self.line)
+
+
+# Wildcard email-address in the OWNERS file.
+ANYONE = '*'
+
+
class Database(object):
- def __init__(self, root, fopen, os_path):
- """Initializes the database of owners for a repository.
+ """A database of OWNERS files for a repository.
- Args:
+ This class allows you to find a suggested set of reviewers for a list
+ of changed files, and see if a list of changed files is covered by a
+ list of reviewers."""
+
+ def __init__(self, root, fopen, os_path):
+ """Args:
root: the path to the root of the Repository
all_owners: the list of every owner in the system
open: function callback to open a text file for reading
os_path: module/object callback with fields for 'exists',
- 'dirname', and 'join'
+ 'dirname', and 'join'
"""
self.root = root
self.fopen = fopen
@@ -34,8 +57,8 @@ class Database(object):
# In-memory cache of OWNERS files and their contents
self.owners_files = {}
- def OwnersFor(self, files):
- """Returns a sets of reviewers that will cover the set of files.
+ def ReviewersFor(self, files):
+ """Returns a suggested set of reviewers that will cover the set of files.
The set of files are paths relative to (and under) self.root."""
self._LoadDataNeededFor(files)
« 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