Skip to content

Commit

Permalink
Add support for include_repos
Browse files Browse the repository at this point in the history
When working with a large number of repos, instead of excluding a large list one
may instead simply include a limited set.

This is performed via the include_repos configuration key for github accounts.


Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
  • Loading branch information
pypingou committed Dec 17, 2013
1 parent 340a5e2 commit 265683b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bugwarrior/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ Create a ``~/.bugwarriorrc`` file with the following contents.
# two because they're spammy or something.
exclude_repos = project_bar,project_baz

# Working with a large number of projects, instead of excluding most of them I
# can also simply include just a limited set.
include_repos = project_foo,project_foz

# Note that login and username can be different. I can login as me, but
# scrape issues from an organization's repos.
login = ralphbean
Expand Down
14 changes: 14 additions & 0 deletions bugwarrior/services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(self, *args, **kw):
self.auth = (login, password)

self.exclude_repos = []
self.include_repos = []

if self.config.has_option(self.target, 'exclude_repos'):
self.exclude_repos = [
Expand All @@ -30,6 +31,13 @@ def __init__(self, *args, **kw):
.strip().split(',')
]

if self.config.has_option(self.target, 'include_repos'):
self.include_repos = [
item.strip() for item in
self.config.get(self.target, 'include_repos')
.strip().split(',')
]

def _issues(self, tag):
""" Grab all the issues """
return [
Expand Down Expand Up @@ -70,6 +78,12 @@ def filter_repos(self, repo):
if repo['name'] in self.exclude_repos:
return False

if self.include_repos:
if repo['name'] in self.include_repos:
return True
else:
return False

return True

def issues(self):
Expand Down

0 comments on commit 265683b

Please sign in to comment.