Package buildbot :: Package changes :: Module svnpoller :: Class SVNPoller
[frames | no frames]

Class SVNPoller

ComparableMixin --+    
                  |    
        Service --+    
                  |    
       ChangeSource --+
                      |
    ComparableMixin --+
                      |
                     SVNPoller


This source will poll a Subversion repository for changes and submit them to the change master.
Method Summary
  __init__(self, svnurl, split_file, svnuser, svnpasswd, pollinterval, histmax, svnbin)
  checksvn(self)
  create_changes(self, new_logentries)
  describe(self)
  determine_prefix(self, output)
  finished(self, res)
  get_logs(self, ignored_prefix)
  get_new_logentries(self, logentries)
  get_root(self)
  getProcessOutput(self, args)
  parse_logs(self, output)
  split_file(self, path)
  startService(self)
  stopService(self)
  submit_changes(self, changes)
    Inherited from Service
  __getstate__(self)
  disownServiceParent(self)
  privilegedStartService(self)
  setName(self, name)
  setServiceParent(self, parent)
    Inherited from ComparableMixin
  __cmp__(self, them)
  __hash__(self)

Class Variable Summary
list compare_attrs = ['svnurl', 'split_file_function', 'svnus...
NoneType last_change = None                                                                  
NoneType loop = None                                                                  
NoneType parent = None                                                                  
bool working = False
    Inherited from ChangeSource
Implements __implemented__ = <implementedBy buildbot.changes.base.C...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...
    Inherited from Service
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...
NoneType name = None                                                                  
int running = 0                                                                     

Method Details

__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)

Class Variable Details

compare_attrs

Type:
list
Value:
['svnurl',
 'split_file_function',
 'svnuser',
 'svnpasswd',
 'pollinterval',
 'histmax',
 'svnbin']                                                             

last_change

Type:
NoneType
Value:
None                                                                  

loop

Type:
NoneType
Value:
None                                                                  

parent

Type:
NoneType
Value:
None                                                                  

working

Type:
bool
Value:
False                                                                  

Generated by Epydoc 2.1 on Sun Dec 10 22:04:44 2006 http://epydoc.sf.net