Skip to content

Commit 08f8c10

Browse files
committed
Merge branch 'change_classifier_interface' into 'develop'
Add repo as an argument of predict(), mainly for bitbcnn classifier See merge request persper/code-analytics!112
2 parents 3412514 + 2da61cd commit 08f8c10

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

persper/analytics/analyzer2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ async def _analyzeCommit(self, commit: Union[Commit, str], parentCommit: Union[C
245245

246246
# commit classification
247247
if self._commit_classifier and commit.hexsha not in self._clf_results:
248-
prob = self._commit_classifier.predict(commit, diff_index)
248+
prob = self._commit_classifier.predict(commit, diff_index, self._repo)
249249
self._clf_results[commit.hexsha] = prob
250250

251251
# t2: update_graph + git diff traversing time

persper/analytics/commit_classifier.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from abc import ABC, abstractmethod
2-
from git import Commit, DiffIndex
2+
from git import Commit, DiffIndex, Repo
33

44

55
class CommitClassifier(ABC):
@@ -8,13 +8,14 @@ class CommitClassifier(ABC):
88
"""
99

1010
@abstractmethod
11-
def predict(self, commit: Commit, diff_index: DiffIndex):
11+
def predict(self, commit: Commit, diff_index: DiffIndex, repo: Repo):
1212
"""
1313
Args:
1414
commit: A gitpython's Commit object.
1515
diff_index: A gitpython's DiffIndex object.
1616
It is a list of Diff object, each containing the
1717
diff information between a pair of old/new source files.
18+
repo: A gitpython's Repo object.
1819
1920
2021
Returns:

0 commit comments

Comments
 (0)