comparison rhodecode/lib/middleware/simplegit.py @ 2236:37c143aa8616 beta

fixes issue #436 git push error
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 04 May 2012 14:13:17 +0200
parents 19a6c23af14b
children a437a986d399 6ea36346590a
comparison
equal deleted inserted replaced
2235:b6adef467e23 2236:37c143aa8616
199 199
200 try: 200 try:
201 # invalidate cache on push 201 # invalidate cache on push
202 if action == 'push': 202 if action == 'push':
203 self._invalidate_cache(repo_name) 203 self._invalidate_cache(repo_name)
204 self._handle_githooks(action, baseui, environ) 204 self._handle_githooks(repo_name, action, baseui, environ)
205 205
206 log.info('%s action on GIT repo "%s"' % (action, repo_name)) 206 log.info('%s action on GIT repo "%s"' % (action, repo_name))
207 app = self.__make_app(repo_name, repo_path) 207 app = self.__make_app(repo_name, repo_path)
208 return app(environ, start_response) 208 return app(environ, start_response)
209 except Exception: 209 except Exception:
262 # try to fallback to stored variable as we don't know if the last 262 # try to fallback to stored variable as we don't know if the last
263 # operation is pull/push 263 # operation is pull/push
264 op = getattr(self, '_git_stored_op', 'pull') 264 op = getattr(self, '_git_stored_op', 'pull')
265 return op 265 return op
266 266
267 def _handle_githooks(self, action, baseui, environ): 267 def _handle_githooks(self, repo_name, action, baseui, environ):
268 from rhodecode.lib.hooks import log_pull_action, log_push_action 268 from rhodecode.lib.hooks import log_pull_action, log_push_action
269 service = environ['QUERY_STRING'].split('=') 269 service = environ['QUERY_STRING'].split('=')
270 if len(service) < 2: 270 if len(service) < 2:
271 return 271 return
272 272
277 277
278 push_hook = 'pretxnchangegroup.push_logger' 278 push_hook = 'pretxnchangegroup.push_logger'
279 pull_hook = 'preoutgoing.pull_logger' 279 pull_hook = 'preoutgoing.pull_logger'
280 _hooks = dict(baseui.configitems('hooks')) or {} 280 _hooks = dict(baseui.configitems('hooks')) or {}
281 if action == 'push' and _hooks.get(push_hook): 281 if action == 'push' and _hooks.get(push_hook):
282 log_push_action(ui=baseui, repo=repo._repo) 282 log_push_action(ui=baseui, repo=_repo._repo)
283 elif action == 'pull' and _hooks.get(pull_hook): 283 elif action == 'pull' and _hooks.get(pull_hook):
284 log_pull_action(ui=baseui, repo=repo._repo) 284 log_pull_action(ui=baseui, repo=_repo._repo)
285 285
286 def __inject_extras(self, repo_path, baseui, extras={}): 286 def __inject_extras(self, repo_path, baseui, extras={}):
287 """ 287 """
288 Injects some extra params into baseui instance 288 Injects some extra params into baseui instance
289 289