Commit 898a10e4 authored by dpranke@chromium.org's avatar dpranke@chromium.org

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
parent 5257081d
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment