Show More
@@ -19,6 +19,7 b'' | |||||
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | import gzip |
|
21 | import gzip | |
|
22 | import re | |||
22 | import shutil |
|
23 | import shutil | |
23 | import logging |
|
24 | import logging | |
24 | import tempfile |
|
25 | import tempfile | |
@@ -181,16 +182,17 b' class VCSMiddleware(object):' | |||||
181 | url_repo_name = repo_name |
|
182 | url_repo_name = repo_name | |
182 | pr_id = None |
|
183 | pr_id = None | |
183 |
|
184 | |||
184 | # TODO: johbo: recognize a pull request based on pattern matching |
|
185 | pr_regex = re.compile( | |
185 | if '/pull-request/' in repo_name: |
|
186 | '(?P<base_name>(?:[\w-]+)(?:/[\w-]+)*)/' | |
186 | acl_repo_name, other = repo_name.split('/pull-request/') |
|
187 | '(?P<repo_name>[\w-]+)' | |
187 | # TODO: johbo: Set shadow repo path |
|
188 | '/pull-request/(?P<pr_id>\d+)/repository') | |
188 | basename, repo_segment = acl_repo_name.rsplit('/', 1) |
|
189 | match = pr_regex.match(repo_name) | |
189 | pr_id = int(other[0:-len('/repository')]) |
|
190 | if match: | |
190 | vcs_repo_name = '{basename}/.__shadow_{repo_segment}_pr-{pr_id}'.format( |
|
191 | match_dict = match.groupdict() | |
191 | basename=basename, |
|
192 | pr_id = match_dict.get('pr_id') | |
192 | repo_segment=repo_segment, |
|
193 | acl_repo_name = '{base_name}/{repo_name}'.format(**match_dict) | |
193 | pr_id=pr_id) |
|
194 | vcs_repo_name = '{base_name}/.__shadow_{repo_name}_pr-{pr_id}'.format( | |
|
195 | **match_dict) | |||
194 |
|
196 | |||
195 | log.debug('repo_names %s', { |
|
197 | log.debug('repo_names %s', { | |
196 | 'acl_repo_name': acl_repo_name, |
|
198 | 'acl_repo_name': acl_repo_name, |
General Comments 0
You need to be logged in to leave comments.
Login now