comparison rhodecode/lib/hooks.py @ 2407:8a68e0292232 beta

Change git & hg hooks to post. They shouldn't block as they are used just for logging actions. Futhermore post hooks have access to changesets, so it's much better flexible
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 06 Jun 2012 22:23:27 +0200
parents 7be31af5bc78
children 89875fb6739a
comparison
equal deleted inserted replaced
2406:7be31af5bc78 2407:8a68e0292232
136 else: 136 else:
137 return (len(repo) - 1, 0) 137 return (len(repo) - 1, 0)
138 138
139 stop, start = get_revs(repo, [node + ':']) 139 stop, start = get_revs(repo, [node + ':'])
140 h = binascii.hexlify 140 h = binascii.hexlify
141 revs = (h(repo[r].node()) for r in xrange(start, stop + 1)) 141 revs = [h(repo[r].node()) for r in xrange(start, stop + 1)]
142 elif scm == 'git': 142 elif scm == 'git':
143 revs = kwargs.get('_git_revs', []) 143 revs = kwargs.get('_git_revs', [])
144 if '_git_revs' in kwargs: 144 if '_git_revs' in kwargs:
145 kwargs.pop('_git_revs') 145 kwargs.pop('_git_revs')
146 146
196 return 0 196 return 0
197 197
198 198
199 def handle_git_post_receive(repo_path, revs, env): 199 def handle_git_post_receive(repo_path, revs, env):
200 """ 200 """
201 A really hacky method that is runned by git pre-receive hook and logs 201 A really hacky method that is runned by git post-receive hook and logs
202 an push action together with pushed revisions. It's runned by subprocess 202 an push action together with pushed revisions. It's runned by subprocess
203 thus needs all info to be able to create a temp pylons enviroment, connect 203 thus needs all info to be able to create a temp pylons enviroment, connect
204 to database and run the logging code. Hacky as sh**t but works. ps. 204 to database and run the logging code. Hacky as sh**t but works. ps.
205 GIT SUCKS 205 GIT SUCKS
206 206