Skip to content

Commit

Permalink
fix hook code when the revmap is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
cotto committed Sep 29, 2010
1 parent 5e01436 commit f983969
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion github/github.py
Expand Up @@ -284,7 +284,7 @@ def processCommitHook(self, req):
jsondata = simplejson.loads(data)

for i in jsondata['commits']:
self.hook.process(i, status)
self.hook.process(i, status, self.enable_revmap)

if int(self.autofetch):
repo = Git(self.repo)
Expand Down
9 changes: 6 additions & 3 deletions github/hook.py
Expand Up @@ -96,7 +96,7 @@ class CommitHook:
def __init__(self, env):
self.env = env

def process(self, commit, status):
def process(self, commit, status, enable_revmap):
self.closestatus = status

msg = commit['message']
Expand All @@ -105,10 +105,13 @@ def process(self, commit, status):
msg = "%s \n %s" % (msg, note)
author = commit['author']['name']
timestamp = datetime.now(utc)
if int(self.enable_revmap):
cursor = self.env.get_db_cnx().cursor()
if int(enable_revmap):
self.env.log.debug("adding commit %s to revmap", commit['id'])
db = self.env.get_db_cnx()
cursor = db.cursor()
cursor.execute("INSERT INTO svn_revmap (svn_rev, git_hash, commit_msg) VALUES (0, %s, %s);",
(commit['id'], commit['message']))
db.commit()

cmd_groups = command_re.findall(msg)
self.env.log.debug("Function Handlers: %s" % cmd_groups)
Expand Down

0 comments on commit f983969

Please sign in to comment.