Show More
@@ -94,10 +94,10 b' class SimpleVCS(object):' | |||||
94 | # we use this regex which will match only on URLs pointing to shadow |
|
94 | # we use this regex which will match only on URLs pointing to shadow | |
95 | # repositories. |
|
95 | # repositories. | |
96 | shadow_repo_re = re.compile( |
|
96 | shadow_repo_re = re.compile( | |
97 | '(?P<groups>(?:{slug_pat})(?:/{slug_pat})*)' # repo groups |
|
97 | '(?P<groups>(?:{slug_pat})(?:/{slug_pat})*/)?' # repo groups | |
98 |
' |
|
98 | '(?P<target>{slug_pat})/' # target repo | |
99 |
' |
|
99 | 'pull-request/(?P<pr_id>\d+)/' # pull request | |
100 |
' |
|
100 | 'repository$' # shadow repo | |
101 | .format(slug_pat=SLUG_RE.pattern)) |
|
101 | .format(slug_pat=SLUG_RE.pattern)) | |
102 |
|
102 | |||
103 | def __init__(self, application, config, registry): |
|
103 | def __init__(self, application, config, registry): | |
@@ -143,15 +143,17 b' class SimpleVCS(object):' | |||||
143 | match_dict = match.groupdict() |
|
143 | match_dict = match.groupdict() | |
144 |
|
144 | |||
145 | # Build acl repo name from regex match. |
|
145 | # Build acl repo name from regex match. | |
146 | acl_repo_name = safe_unicode( |
|
146 | acl_repo_name = safe_unicode('{groups}{target}'.format( | |
147 | '{groups}/{target}'.format(**match_dict)) |
|
147 | groups=match_dict['groups'] or '', | |
|
148 | target=match_dict['target'])) | |||
148 |
|
149 | |||
149 | # Retrieve pull request instance by ID from regex match. |
|
150 | # Retrieve pull request instance by ID from regex match. | |
150 | pull_request = PullRequest.get(match_dict['pr_id']) |
|
151 | pull_request = PullRequest.get(match_dict['pr_id']) | |
151 |
|
152 | |||
152 | # Only proceed if we got a pull request and if acl repo name from |
|
153 | # Only proceed if we got a pull request and if acl repo name from | |
153 | # URL equals the target repo name of the pull request. |
|
154 | # URL equals the target repo name of the pull request. | |
154 |
if pull_request and acl_repo_name == |
|
155 | if pull_request and (acl_repo_name == | |
|
156 | pull_request.target_repo.repo_name): | |||
155 | # Get file system path to shadow repository. |
|
157 | # Get file system path to shadow repository. | |
156 | workspace_id = PullRequestModel()._workspace_id(pull_request) |
|
158 | workspace_id = PullRequestModel()._workspace_id(pull_request) | |
157 | target_vcs = pull_request.target_repo.scm_instance() |
|
159 | target_vcs = pull_request.target_repo.scm_instance() |
General Comments 0
You need to be logged in to leave comments.
Login now