Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit 9a623b9

Browse files
committed
Match deleted lines for dirs matching.
1 parent b78bd99 commit 9a623b9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

highfive/newpr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ def choose_reviewer(self, repo, owner, diff, exclude):
304304
]
305305
continue
306306

307-
if (not line.startswith('+++')) and line.startswith('+'):
307+
if ((not line.startswith('+++')) and line.startswith('+')) or \
308+
((not line.startswith('---')) and line.startswith('-')):
308309
for path in longest_dir_paths:
309310
counts[path] = counts.get(path, 0) + 1
310311

highfive/tests/test_newpr.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,15 @@ def test_prefixed_dirs(self):
13501350
(chosen_reviewers, _) = self.choose_reviewers(diff, 'ehuss')
13511351
assert set(['parser']) == chosen_reviewers
13521352

1353+
def test_deleted_file(self):
1354+
"""Test dirs matching for a deleted file."""
1355+
self.handler = HighfiveHandlerMock(
1356+
Payload({}), repo_config=self.fakes['config']['prefixed-dirs']
1357+
).handler
1358+
diff = fakes.make_fake_diff([('compiler/rustc_parse/src/foo.rs', 0, 10)])
1359+
(chosen_reviewers, _) = self.choose_reviewers(diff, 'ehuss')
1360+
assert set(['parser']) == chosen_reviewers
1361+
13531362

13541363
class TestRun(TestNewPR):
13551364
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)