Mercurial > kallithea
comparison rhodecode/lib/middleware/simplegit.py @ 2058:fb51a6fc10ae beta
updated CONTRIBUTORS
- code garden
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 28 Feb 2012 05:25:16 +0200 |
parents | 766696ee9487 |
children | 572855f7a392 |
comparison
equal
deleted
inserted
replaced
2057:766696ee9487 | 2058:fb51a6fc10ae |
---|---|
80 log = logging.getLogger(__name__) | 80 log = logging.getLogger(__name__) |
81 | 81 |
82 | 82 |
83 GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs') | 83 GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs') |
84 | 84 |
85 | |
85 def is_git(action): | 86 def is_git(action): |
86 return action in ['pull','push'] | 87 return action in ['pull','push'] |
88 | |
87 | 89 |
88 class SimpleGit(BaseVCSController): | 90 class SimpleGit(BaseVCSController): |
89 | 91 |
90 def _handle_request(self, environ, start_response): | 92 def _handle_request(self, environ, start_response): |
91 #====================================================================== | 93 #====================================================================== |
228 | 230 |
229 def __get_user(self, username): | 231 def __get_user(self, username): |
230 return User.get_by_username(username) | 232 return User.get_by_username(username) |
231 | 233 |
232 def __get_action(self, environ): | 234 def __get_action(self, environ): |
233 """Maps git request commands into a pull or push command. | 235 """ |
236 Maps git request commands into a pull or push command. | |
234 | 237 |
235 :param environ: | 238 :param environ: |
236 """ | 239 """ |
237 service = environ['QUERY_STRING'].split('=') | 240 service = environ['QUERY_STRING'].split('=') |
238 if len(service) > 1: | 241 if len(service) > 1: |
239 service_cmd = service[1] | 242 service_cmd = service[1] |
240 mapping = {'git-receive-pack': 'push', | 243 mapping = { |
241 'git-upload-pack': 'pull', | 244 'git-receive-pack': 'push', |
242 } | 245 'git-upload-pack': 'pull', |
246 } | |
243 | 247 |
244 return mapping.get(service_cmd, | 248 return mapping.get(service_cmd, |
245 service_cmd if service_cmd else 'other') | 249 service_cmd if service_cmd else 'other') |
246 else: | 250 else: |
247 return 'other' | 251 return 'other' |