mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 05:10:38 +08:00
Support pull requests in personal spaces in Bitbucket Server
Related to #1148 Update `_parse_pr_url` method in `pr_agent/git_providers/bitbucket_server_provider.py` to handle URLs with `/users/`. * Add logic to check for both `/projects/` and `/users/` in the URL path and process them accordingly. * Modify the method to raise a `ValueError` if neither `/projects/` nor `/users/` is found in the URL. * Update the `workspace_slug` to include a `~` prefix if the URL contains `/users/`. Add test case for URL with `/users/` in `tests/unittest/test_bitbucket_provider.py`. * Ensure the new test case verifies the correct parsing of URLs with `/users/`.
This commit is contained in:
@ -24,6 +24,13 @@ class TestBitbucketServerProvider:
|
||||
assert repo_slug == "my-repo"
|
||||
assert pr_number == 1
|
||||
|
||||
def test_parse_pr_url_with_users(self):
|
||||
url = "https://bitbucket.company-server.url/users/username/repos/my-repo/pull-requests/1"
|
||||
workspace_slug, repo_slug, pr_number = BitbucketServerProvider._parse_pr_url(url)
|
||||
assert workspace_slug == "~username"
|
||||
assert repo_slug == "my-repo"
|
||||
assert pr_number == 1
|
||||
|
||||
def mock_get_content_of_file(self, project_key, repository_slug, filename, at=None, markup=None):
|
||||
content_map = {
|
||||
'9c1cffdd9f276074bfb6fb3b70fbee62d298b058': 'file\nwith\nsome\nlines\nto\nemulate\na\nreal\nfile\n',
|
||||
|
Reference in New Issue
Block a user