Next: , Previous: GoogleCodeAtomPoller, Up: Change Sources


4.7.9 GitPoller

If you cannot take advantage of post-receive hooks as provided by contrib/git_buildbot.py for example, then you can use the GitPoller.

The GitPoller periodically fetches from a remote git repository and processes any changes. It requires its own working directory for operation, which can be specified via the workdir property. By default a temporary directory will be used.

The GitPoller only works with git 1.7 and up, out of the box. If you're using earlier versions of git, you can get things to work by manually creating an empty repository in <tempdir>/gitpoller_work.

GitPoller accepts the following arguments:

repourl
the git-url that describes the remote repository, e.g. git@example.com:foobaz/myrepo.git (see the git fetch help for more info on git-url formats)
branch
the desired branch to fetch, will default to 'master'
workdir
the directory where the poller should keep its local repository. will default to <tempdir>/gitpoller_work, which is probably not what you want. If this is a relative path, it will be interpreted relative to the master's basedir.
pollInterval
interval in seconds between polls, default is 10 minutes.
gitbin
path to the git binary, defaults to just 'git'
fetch_refspec
One or more refspecs to use when fetching updates for the repository. By default, the GitPoller will simply fetch all refs. If your repository is large enough that this would be unwise (or active enough on irrelevant branches that it'd be a waste of time to fetch them all), you may wish to specify only a certain refs to be updated. (A single refspec may be passed as a string, or multiple refspecs may be passed as a list or set of strings.)
category
Set the category to be used for the changes produced by the GitPoller. This will then be set in any changes generated by the GitPoller, and can be used in a Change Filter for triggering particular builders.
project
Set the name of the project to be used for the GitPoller. This will then be set in any changes generated by the GitPoller, and can be used in a Change Filter for triggering particular builders.
usetimestamps
parse each revision's commit timestamp (default is True), or ignore it in favor of the current time (so recently processed commits appear together in the waterfall page)
encoding
Set encoding will be used to parse author's name and commit message. Default encoding is 'utf-8'. This will not be applied to file names since git will translate non-ascii file names to unreadable escape sequences.

Example

     from buildbot.changes.gitpoller import GitPoller
     c['change_source'] = GitPoller('git@example.com:foobaz/myrepo.git',
                                    branch='great_new_feature',
                                    workdir='/home/buildbot/gitpoller_workdir')