rename OwnersFor() to ReviewersFor(), add SyntaxError exception, ANYONE wildcard constant

neither SyntaxError or ANYONE is used at, but they will be shortly.

Review URL: http://codereview.chromium.org/6609012

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@76978 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
dpranke@chromium.org 15 years ago
parent 5257081dbf
commit 898a10e4bb

@ -7,11 +7,34 @@
class Assertion(AssertionError): class Assertion(AssertionError):
pass 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): class Database(object):
def __init__(self, root, fopen, os_path): """A database of OWNERS files for a repository.
"""Initializes the database of owners 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 root: the path to the root of the Repository
all_owners: the list of every owner in the system all_owners: the list of every owner in the system
open: function callback to open a text file for reading open: function callback to open a text file for reading
@ -34,8 +57,8 @@ class Database(object):
# In-memory cache of OWNERS files and their contents # In-memory cache of OWNERS files and their contents
self.owners_files = {} self.owners_files = {}
def OwnersFor(self, files): def ReviewersFor(self, files):
"""Returns a sets of reviewers that will cover the set of 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.""" The set of files are paths relative to (and under) self.root."""
self._LoadDataNeededFor(files) self._LoadDataNeededFor(files)

Loading…
Cancel
Save