Skip to content

Commit

Permalink
Add release note. Update docs, and rename split_file_project_branches…
Browse files Browse the repository at this point in the history
… as suggested
  • Loading branch information
John Carr committed Aug 6, 2012
1 parent be063e8 commit 48ff1ee
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion master/buildbot/changes/svnpoller.py
Expand Up @@ -49,7 +49,7 @@ def split_file_branches(path):
else:
return None

def split_file_project_branches(path):
def split_file_projects_branches(path):
# turn projectname/trunk/subdir/file.c into SVNFile(project=projectname, branch=trunk, path=subdir/file.c)
if not "/" in path:
return None
Expand Down
8 changes: 4 additions & 4 deletions master/buildbot/test/unit/test_changes_svnpoller.py
Expand Up @@ -610,15 +610,15 @@ def test_split_file_branches_otherfile(self):
svnpoller.split_file_branches('tags/testthis/subdir/file.c'),
None)

def test_split_file_project_branches(self):
def test_split_file_projects_branches(self):
self.assertEqual(
svnpoller.split_file_project_branches('buildbot/trunk/subdir/file.c'),
svnpoller.split_file_projects_branches('buildbot/trunk/subdir/file.c'),
dict(project='buildbot', path='subdir/file.c'))
self.assertEqual(
svnpoller.split_file_project_branches('buildbot/branches/1.5.x/subdir/file.c'),
svnpoller.split_file_projects_branches('buildbot/branches/1.5.x/subdir/file.c'),
dict(project='buildbot', branch='branches/1.5.x', path='subdir/file.c'))
# tags are ignored:
self.assertEqual(
svnpoller.split_file_project_branches('buildbot/tags/testthis/subdir/file.c'),
svnpoller.split_file_projects_branches('buildbot/tags/testthis/subdir/file.c'),
None)

6 changes: 3 additions & 3 deletions master/docs/manual/cfg-changesources.rst
Expand Up @@ -953,14 +953,14 @@ When using this splitter the poller will set the ``project`` attribute of any
changes to the ``project`` attribute of the poller.

For repositories with the ``{PROJECT}/trunk`` and
``{PROJECT}/branches/{BRANCH}`` layout, ``split_file_project_branches`` will do
``{PROJECT}/branches/{BRANCH}`` layout, ``split_file_projects_branches`` will do
the job::

from buildbot.changes.svnpoller import SVNPoller
from buildbot.changes.svnpoller import split_file_project_branches
from buildbot.changes.svnpoller import split_file_projects_branches
c['change_source'] = SVNPoller(
svnurl="https://amanda.svn.sourceforge.net/svnroot/amanda/",
split_file=split_file_project_branches)
split_file=split_file_projects_branches)

When using this splitter the poller will set the ``project`` attribute of any
changes to the project determined by the splitter.
Expand Down
14 changes: 9 additions & 5 deletions master/docs/manual/customization.rst
Expand Up @@ -202,6 +202,7 @@ function is always given a string that names a file relative to the
subdirectory pointed to by the :bb:chsrc:`SVNPoller`\'s ``svnurl=`` argument.
It is expected to return a dictionary with at least the ``path`` key. The
splitter may optionally set ``branch``, ``project`` and ``repository``.
For backwards compatibility it may return a tuple of ``(branchname, path)``.
It may also return ``None`` to indicate that the file is of no interest.

.. note:: the function should return ``branches/3_3`` rather than just ``3_3``
Expand Down Expand Up @@ -239,22 +240,25 @@ If you have multiple projects in the same repository your split function can
attach a project name to the Change to help the Scheduler filter out unwanted
changes::

from buildbot.changes.svnpoller import SVNFile, split_file_branches
def split_file_project_branches(path):
from buildbot.changes.svnpoller import split_file_branches
def split_file_projects_branches(path):
if not "/" in path:
return None
project, path = path.split("/", 1)
f = split_file_branches(path)
if f:
f["project"] = project
info = dict(project=project, path=f[1])
if f[0]:
info['branch'] = f[0]
return info
return f

Again, this is provided by default. To use it you would do this::

from buildbot.changes.svnpoller import SVNPoller, split_file_project_branches
from buildbot.changes.svnpoller import SVNPoller, split_file_projects_branches
c['change_source'] = SVNPoller(
svnurl="https://svn.amanda.sourceforge.net/svnroot/amanda/",
split_file=split_file_project_branches)
split_file=split_file_projects_branches)

Note here that we are monitoring at the root of the repository, and that within
that repository is a ``amanda`` subdirectory which in turn has ``trunk`` and
Expand Down
4 changes: 4 additions & 0 deletions master/docs/release-notes.rst
Expand Up @@ -138,6 +138,10 @@ Deprecations, Removals, and Non-Compatible Changes
This allows the ``split_file`` function to distinguish between files and directories.
Customized split functions may need to be adjusted accordingly.

* The ``split_file`` function for :bb:chsrc:`SVNPoller` may now return a
dictionary instead of a tuple. This allows it to add extra information about
a change (such as ``project`` or ``repository``).

Changes for Developers
~~~~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 48ff1ee

Please sign in to comment.