|
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members
# NOTE: If users use a filter_fn, we have no way to determine whether it has # changed at reconfig, so the scheduler will always be restarted. That's as # good as Python can do.
# gets a Change object, returns boolean filter_fn=None, # change attribute comparisons: exact match to PROJECT, member of # list PROJECTS, regular expression match to PROJECT_RE, or # PROJECT_FN returns True when called with the project; repository, # branch, and so on are similar. Note that the regular expressions # are anchored to the first character of the string. For convenience, # a list can also be specified to the singular option (e.g,. PROJETS project=None, project_re=None, project_fn=None, repository=None, repository_re=None, repository_fn=None, branch=NotABranch, branch_re=None, branch_fn=None, category=None, category_re=None, category_fn=None):
(mklist(project), mkre(project_re), project_fn, "project"), (mklist(repository), mkre(repository_re), repository_fn, "repository"), (mklist_br(branch), mkre(branch_re), branch_fn, "branch"), (mklist(category), mkre(category_re), category_fn, "category"), ]
return False
def __repr__(self): checks = [] for (filt_list, filt_re, filt_fn, chg_attr) in self.checks: if filt_list is not None and len(filt_list) == 1: checks.append('%s == %s' % (chg_attr, filt_list[0])) elif filt_list is not None: checks.append('%s in %r' % (chg_attr, filt_list)) if filt_re is not None : checks.append('%s ~/%s/' % (chg_attr, filt_re)) if filt_fn is not None : checks.append('%s(%s)' % (filt_fn.__name__, chg_attr))
return "<%s on %s>" % (self.__class__.__name__, ' and '.join(checks))
branch=NotABranch, categories=None):
""" Static method to create a filter based on constructor args change_filter, branch, and categories; use default values @code{None}, @code{NotABranch}, and @code{None}, respectively. These arguments are interpreted as documented for the L{buildbot.schedulers.basic.Scheduler} class.
@returns: L{ChangeFilter} instance or None for not filtering """
# use a change_filter, if given one raise RuntimeError("cannot specify both change_filter and " "branch or categories") # build a change filter from the deprecated category and branch args else: |