__init__(self,
svnurl,
split_file=None,
svnuser=None,
svnpasswd=None,
pollinterval=600,
histmax=100,
svnbin='svn')
(Constructor)
-
- Parameters:
svnurl -
the SVN URL that describes the repository and subdirectory to
watch. If this ChangeSource should only pay attention to a single
branch, this should point at the repository for that branch, like
svn://svn.twistedmatrix.com/svn/Twisted/trunk . If it should
follow multiple branches, point it at the repository directory
that contains all the branches like
svn://svn.twistedmatrix.com/svn/Twisted and also provide a
branch-determining function.
Each file in the repository has a SVN URL in the form
(SVNURL)/(BRANCH)/(FILEPATH), where (BRANCH) could be empty or
not, depending upon your branch-determining function. Only files
that start with (SVNURL)/(BRANCH) will be monitored. The Change
objects that are sent to the Schedulers will see (FILEPATH) for
each modified file.
(type=string)
split_file -
a function that is called with a string of the form
(BRANCH)/(FILEPATH) and should return a tuple (BRANCH, FILEPATH).
This function should match your repository's branch-naming
policy. Each changed file has a fully-qualified URL that can be
split into a prefix (which equals the value of the 'svnurl'
argument) and a suffix; it is this suffix which is passed to the
split_file function.
If the function returns None, the file is ignored. Use this to
indicate that the file is not a part of this project.
For example, if your repository puts the trunk in trunk/...
and branches are in places like branches/1.5/..., your split_file
function could look like the following (this function is
available as svnpoller.split_file_branches):
pieces = path.split('/')
if pieces[0] == 'trunk':
return (None, '/'.join(pieces[1:]))
elif pieces[0] == 'branches':
return ('/'.join(pieces[0:2]),
'/'.join(pieces[2:]))
else:
return None
If instead your repository layout puts the trunk for ProjectA
in trunk/ProjectA/... and the 1.5 branch in
branches/1.5/ProjectA/..., your split_file function could look
like:
pieces = path.split('/')
if pieces[0] == 'trunk':
branch = None
pieces.pop(0) # remove 'trunk'
elif pieces[0] == 'branches':
pieces.pop(0) # remove 'branches'
# grab branch name
branch = 'branches/' + pieces.pop(0)
else:
return None # something weird
projectname = pieces.pop(0)
if projectname != 'ProjectA':
return None # wrong project
return (branch, '/'.join(pieces))
The default of split_file= is None, which indicates that no
splitting should be done. This is equivalent to the following
function:
return (None, path)
If you wish, you can override the split_file method with the
same sort of function instead of passing in a split_file=
argument.
(type=callable or None)
svnuser -
If set, the --username option will be added to the 'svn log'
command. You may need this to get access to a private
repository.
(type=string)
svnpasswd -
If set, the --password option will be added.
(type=string)
pollinterval -
interval in seconds between polls. The default is 600 seconds
(10 minutes). Smaller values decrease the latency between the
time a change is recorded and the time the buildbot notices it,
but it also increases the system load.
(type=int)
histmax -
maximum number of changes to look back through. The default is
100. Smaller values decrease system load, but if more than
histmax changes are recorded between polls, the extra ones will
be silently lost.
(type=int)
svnbin -
path to svn binary, defaults to just 'svn'. Use this if your
subversion command lives in an unusual location.
(type=string)
|