Skip to content

Commit a99ebf8

Browse files
committed
implementing PR bot feedback
1 parent 2a9e3ee commit a99ebf8

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

pr_agent/git_providers/bitbucket_server_provider.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ def get_files(self):
139139
#gets the best common ancestor: https://git-scm.com/docs/git-merge-base
140140
@staticmethod
141141
def get_best_common_ancestor(source_commits_list, destination_commits_list, guaranteed_common_ancestor) -> str:
142-
destination_commit_hashes = {commit['id'] for commit in destination_commits_list}
143-
destination_commit_hashes.add(guaranteed_common_ancestor)
142+
destination_commit_hashes = {commit['id'] for commit in destination_commits_list} | {guaranteed_common_ancestor}
144143

145144
for commit in source_commits_list:
146145
for parent_commit in commit['parents']:

tests/unittest/test_bitbucket_provider.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,17 @@ def test_parse_pr_url(self):
2323
assert pr_number == 1
2424

2525
def mock_get_content_of_file(self, project_key, repository_slug, filename, at=None, markup=None):
26-
if at == '9c1cffdd9f276074bfb6fb3b70fbee62d298b058':
27-
return 'file\nwith\nsome\nlines\nto\nemulate\na\nreal\nfile\n'
28-
elif at == '2a1165446bdf991caf114d01f7c88d84ae7399cf':
29-
return 'file\nwith\nmultiple \nlines\nto\nemulate\na\nfake\nfile\n'
30-
elif at == 'f617708826cdd0b40abb5245eda71630192a17e3':
31-
return 'file\nwith\nmultiple \nlines\nto\nemulate\na\nreal\nfile\n'
32-
elif at == 'cb68a3027d6dda065a7692ebf2c90bed1bcdec28':
33-
return 'file\nwith\nsome\nchanges\nto\nemulate\na\nreal\nfile\n'
34-
elif at == '1905dcf16c0aac6ac24f7ab617ad09c73dc1d23b':
35-
return 'file\nwith\nsome\nlines\nto\nemulate\na\nfake\ntest\n'
36-
elif at == 'ae4eca7f222c96d396927d48ab7538e2ee13ca63':
37-
return 'readme\nwithout\nsome\nlines\nto\nsimulate\na\nreal\nfile'
38-
elif at == '548f8ba15abc30875a082156314426806c3f4d97':
39-
return 'file\nwith\nsome\nlines\nto\nemulate\na\nreal\nfile'
40-
return ''
26+
content_map = {
27+
'9c1cffdd9f276074bfb6fb3b70fbee62d298b058': 'file\nwith\nsome\nlines\nto\nemulate\na\nreal\nfile\n',
28+
'2a1165446bdf991caf114d01f7c88d84ae7399cf': 'file\nwith\nmultiple \nlines\nto\nemulate\na\nfake\nfile\n',
29+
'f617708826cdd0b40abb5245eda71630192a17e3': 'file\nwith\nmultiple \nlines\nto\nemulate\na\nreal\nfile\n',
30+
'cb68a3027d6dda065a7692ebf2c90bed1bcdec28': 'file\nwith\nsome\nchanges\nto\nemulate\na\nreal\nfile\n',
31+
'1905dcf16c0aac6ac24f7ab617ad09c73dc1d23b': 'file\nwith\nsome\nlines\nto\nemulate\na\nfake\ntest\n',
32+
'ae4eca7f222c96d396927d48ab7538e2ee13ca63': 'readme\nwithout\nsome\nlines\nto\nsimulate\na\nreal\nfile',
33+
'548f8ba15abc30875a082156314426806c3f4d97': 'file\nwith\nsome\nlines\nto\nemulate\na\nreal\nfile'
34+
}
35+
36+
return content_map.get(at, '')
4137

4238
'''
4339
tests the 2-way diff functionality where the diff should be between the HEAD of branch b and node c

0 commit comments

Comments
 (0)