##// END OF EJS Templates
pr: Unify clone url generation of shadow repository.
Martin Bornhold -
r897:b8b5fdac default
parent child Browse files
Show More
@@ -111,9 +111,6 b' class SimpleVCS(object):'
111 This will populate the attributes acl_repo_name, url_repo_name,
111 This will populate the attributes acl_repo_name, url_repo_name,
112 vcs_repo_name and pr_id on the current instance.
112 vcs_repo_name and pr_id on the current instance.
113 """
113 """
114 # TODO: martinb: Unify generation/suffix of clone url. It is currently
115 # used here in the regex, in PullRequest in get_api_data() and
116 # indirectly in routing configuration.
117 # TODO: martinb: Move to class or module scope.
114 # TODO: martinb: Move to class or module scope.
118 # TODO: martinb: Check if we have to use re.UNICODE.
115 # TODO: martinb: Check if we have to use re.UNICODE.
119 # TODO: martinb: Check which chars are allowed for repo/group names.
116 # TODO: martinb: Check which chars are allowed for repo/group names.
@@ -3140,8 +3140,8 b' class PullRequest(Base, _PullRequestBase'
3140 },
3140 },
3141 },
3141 },
3142 'shadow': {
3142 'shadow': {
3143 # TODO: martinb: Unify generation/suffix of clone url.
3143 'clone_url': PullRequestModel().get_shadow_clone_url(
3144 'clone_url': '{}/repository'.format(pull_request_url),
3144 pull_request),
3145 },
3145 },
3146 'author': pull_request.author.get_api_data(include_secrets=False,
3146 'author': pull_request.author.get_api_data(include_secrets=False,
3147 details='basic'),
3147 details='basic'),
@@ -777,7 +777,15 b' class PullRequestModel(BaseModel):'
777 qualified=True)
777 qualified=True)
778
778
779 def get_shadow_clone_url(self, pull_request):
779 def get_shadow_clone_url(self, pull_request):
780 return u'{url}/repository'.format(url=self.get_url(pull_request))
780 """
781 Returns qualified url pointing to the shadow repository. If this pull
782 request is closed there is no shadow repository and ``None`` will be
783 returned.
784 """
785 if pull_request.is_closed():
786 return None
787 else:
788 return u'{url}/repository'.format(url=self.get_url(pull_request))
781
789
782 def notify_reviewers(self, pull_request, reviewers_ids):
790 def notify_reviewers(self, pull_request, reviewers_ids):
783 # notification to reviewers
791 # notification to reviewers
General Comments 0
You need to be logged in to leave comments. Login now