__init__(self,
svnurl,
split_file=None,
svnuser=None,
svnpasswd=None,
pollinterval=600,
histmax=100,
svnbin=' svn ' ,
revlinktmpl='
' ,
category=None,
project=None,
cachepath=None)
(Constructor)
| source code
|
@type svnurl: string
@param 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 split_file: callable or None
@param 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 svnuser: string
@param 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 svnpasswd: string
@param svnpasswd: If set, the --password option will be added.
@type pollinterval: int
@param 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 histmax: int
@param 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 svnbin: string
@param svnbin: path to svn binary, defaults to just 'svn'. Use
this if your subversion command lives in an
unusual location.
@type revlinktmpl: string
@param revlinktmpl: A format string to use for hyperlinks to revision
information. For example, setting this to
"http://reposerver/websvn/revision.php?rev=%s"
would create suitable links on the build pages
to information in websvn on each revision.
@type category: string
@param category: A single category associated with the changes that
could be used by schedulers watch for branches of a
certain name AND category.
@type project string
@param project A single project that the changes are associated with
the repository, added to the changes, for the use in
change filters
@type cachepath string
@param cachepath A path to a file that can be used to store the last
rev that was processed, so we can grab changes that
happened while we were offline
|