diff options
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | lorrycontroller/lstroves.py | 14 |
2 files changed, 12 insertions, 7 deletions
@@ -126,8 +126,9 @@ Additionally, the following optional keys are allowed in Trove specifications: * `ignore` -- a list of git repositories from the other Trove that - should NOT be mirrored. Each list element is a path to the git - repository (not including leading slash). + should NOT be mirrored. Each list element is a glob pattern which + is matched against the path to the git repository (not including leading + slash). * `auth` -- specify how to authenticate to the remote Trove over https (only). It should be a dictionary with the fields `username` and diff --git a/lorrycontroller/lstroves.py b/lorrycontroller/lstroves.py index e69dce2..72515f5 100644 --- a/lorrycontroller/lstroves.py +++ b/lorrycontroller/lstroves.py @@ -1,4 +1,4 @@ -# Copyright (C) 2014 Codethink Limited +# Copyright (C) 2014-2015 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,12 +14,11 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import fnmatch import json import logging -import time import bottle -import cliapp import lorrycontroller @@ -83,8 +82,13 @@ class TroveRepositoryLister(object): return repo_paths def skip_ignored_repos(self, trovehost, repo_paths): - ignored_paths = json.loads(trovehost['ignore']) - return [x for x in repo_paths if x not in ignored_paths] + ignored_patterns = json.loads(trovehost['ignore']) + + ignored_paths = set() + for pattern in ignored_patterns: + ignored_paths.update(fnmatch.filter(repo_paths, pattern)) + + return set(repo_paths).difference(ignored_paths) def map_remote_repos_to_local_ones(self, trove_info, remote_paths): '''Return a dict that maps each remote repo path to a local one.''' |