Skip to content

Commit

Permalink
Merge branch 'gitpoller-addcategory' of git://github.com/shawnchin/bu…
Browse files Browse the repository at this point in the history
…ildbot

* 'gitpoller-addcategory' of git://github.com/shawnchin/buildbot:
  fixed typo
  Added "category" and "project" arguments to GitPoller (as implemented for SVNPoller)
  • Loading branch information
Dustin J. Mitchell committed Sep 13, 2010
2 parents 44c5382 + a67751a commit d5e8068
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions master/buildbot/changes/gitpoller.py
Expand Up @@ -16,7 +16,11 @@
class GitPoller(base.ChangeSource):
"""This source will poll a remote git repo for changes and submit
them to the change master."""


compare_attrs = ["repourl", "branch", "workdir",
"pollinterval", "gitbin", "usetimestamps",
"category", "project"]

parent = None # filled in when we're added
loop = None
volatile = ['loop']
Expand All @@ -25,7 +29,8 @@ class GitPoller(base.ChangeSource):

def __init__(self, repourl, branch='master',
workdir=None, pollinterval=10*60,
gitbin='git', usetimestamps=True):
gitbin='git', usetimestamps=True,
category=None, project=None):
"""
@type repourl: string
@param repourl: the url that describes the remote repository,
Expand All @@ -48,6 +53,16 @@ def __init__(self, repourl, branch='master',
@param usetimestamps: parse each revision's commit timestamp (default True), or
ignore it in favor of the current time (to appear together
in the waterfall page)
@type category: string
@param category: catergory associated with the change. Attached to
the Change object produced by this changesource such that
it can be targeted by change filters.
@type project string
@param project project that the changes are associated to. Attached to
the Change object produced by this changesource such that
it can be targeted by change filters.
"""

self.repourl = repourl
Expand All @@ -56,8 +71,10 @@ def __init__(self, repourl, branch='master',
self.lastChange = time.time()
self.lastPoll = time.time()
self.gitbin = gitbin
self.workdir = workdir;
self.workdir = workdir
self.usetimestamps = usetimestamps
self.category = category
self.project = project

if self.workdir == None:
self.workdir = tempfile.gettempdir() + '/gitpoller_work'
Expand Down Expand Up @@ -200,7 +217,9 @@ def _process_changes(self, res):
files = self._get_commit_files(rev),
comments = self._get_commit_comments(rev),
when = commit_timestamp,
branch = self.branch)
branch = self.branch,
category = self.category,
project = self.project)
self.parent.addChange(c)
self.lastChange = self.lastPoll

Expand Down

0 comments on commit d5e8068

Please sign in to comment.