1212 get_project_cls_by_name ,
1313 get_local_project_repo ,
1414)
15- from varats .utils .git_util import FullCommitHash
15+ from varats .utils .git_util import FullCommitHash , RepositoryHandle
1616from varats .utils .github_util import (
1717 get_cached_github_object_list ,
1818 get_github_repo_name_for_project ,
@@ -101,14 +101,14 @@ def as_raw_bug(pygit_bug: PygitBug) -> RawBug:
101101 )
102102
103103
104- def as_pygit_bug (raw_bug : RawBug , repo : pygit2 . Repository ) -> PygitBug :
104+ def as_pygit_bug (raw_bug : RawBug , repo : RepositoryHandle ) -> PygitBug :
105105 """Converts a ``RawBug`` to a ``PygitBug``."""
106106 introducing_commits : tp .Set [pygit2 .Commit ] = set ()
107107 for intro_commit in raw_bug .introducing_commits :
108- introducing_commits .add (repo .get (intro_commit . hash ))
108+ introducing_commits .add (repo .pygit_commit (intro_commit ))
109109 return PygitBug (
110- repo . get ( raw_bug .fixing_commit .hash ) , introducing_commits ,
111- raw_bug .issue_id , raw_bug . creation_date , raw_bug .resolution_date
110+ repo [ raw_bug .fixing_commit .hash ] , introducing_commits , raw_bug . issue_id ,
111+ raw_bug .creation_date , raw_bug .resolution_date
112112 )
113113
114114
@@ -239,7 +239,7 @@ def load_issue_events(github: Github) -> 'PaginatedList[IssueEvent]':
239239
240240def _create_corresponding_bug (
241241 closing_commit : pygit2 .Commit ,
242- project_repo : pygit2 . Repository ,
242+ project_repo : RepositoryHandle ,
243243 issue_id : tp .Optional [int ] = None ,
244244 creation_date : tp .Optional [datetime ] = None ,
245245 resolution_date : tp .Optional [datetime ] = None
@@ -258,7 +258,7 @@ def _create_corresponding_bug(
258258 Returns:
259259 the specified bug
260260 """
261- pydrill_repo = pydriller .Git (project_repo .path )
261+ pydrill_repo = pydriller .Git (str ( project_repo .repo_path ) )
262262
263263 introducing_commits : tp .Set [pygit2 .Commit ] = set ()
264264 blame_dict = pydrill_repo .get_commits_last_modified_lines (
@@ -267,7 +267,7 @@ def _create_corresponding_bug(
267267
268268 for _ , introducing_set in blame_dict .items ():
269269 for introducing_id in introducing_set :
270- introducing_commits .add (project_repo .get (introducing_id ))
270+ introducing_commits .add (project_repo .pygit_commit (introducing_id ))
271271
272272 return PygitBug (
273273 closing_commit , introducing_commits , issue_id , creation_date ,
@@ -294,12 +294,12 @@ def _find_corresponding_pygit_suspect_tuple(
294294 A PygitSuspectTuple if the issue event represents the closing of a bug,
295295 None otherwise
296296 """
297- pygit_repo = get_local_project_repo (project_name ). pygit_repo
298- pydrill_repo = pydriller .Git (pygit_repo . path )
297+ repo = get_local_project_repo (project_name )
298+ pydrill_repo = pydriller .Git (str ( repo . repo_path ) )
299299
300300 if _has_closed_a_bug (issue_event ) and issue_event .commit_id :
301301 issue_date = issue_event .issue .created_at
302- fixing_commit = pygit_repo . get (issue_event .commit_id )
302+ fixing_commit = repo . pygit_commit (issue_event .commit_id )
303303 pydrill_fixing_commit = pydrill_repo .get_commit (issue_event .commit_id )
304304 blame_dict = pydrill_repo .get_commits_last_modified_lines (
305305 pydrill_fixing_commit
@@ -317,9 +317,9 @@ def _find_corresponding_pygit_suspect_tuple(
317317 ).committer_date .astimezone (timezone .utc )
318318
319319 if introduction_date > issue_date : # commit is a suspect
320- suspect_commits .add (pygit_repo . get (introducing_id ))
320+ suspect_commits .add (repo . pygit_commit (introducing_id ))
321321 else :
322- non_suspect_commits .add (pygit_repo . get (introducing_id ))
322+ non_suspect_commits .add (repo . pygit_commit (introducing_id ))
323323
324324 return PygitSuspectTuple (
325325 fixing_commit , non_suspect_commits , suspect_commits ,
@@ -386,7 +386,7 @@ def _filter_issue_bugs(
386386
387387def _filter_commit_message_bugs (
388388 project_name : str ,
389- commit_filter_function : tp .Callable [[pygit2 . Repository , pygit2 .Commit ],
389+ commit_filter_function : tp .Callable [[RepositoryHandle , pygit2 .Commit ],
390390 tp .Optional [PygitBug ]]
391391) -> tp .FrozenSet [PygitBug ]:
392392 """
@@ -400,10 +400,11 @@ def _filter_commit_message_bugs(
400400 the set of bugs created by the given filter
401401 """
402402 filtered_bugs = set ()
403- project_repo = get_local_project_repo (project_name ).pygit_repo
403+ project_repo = get_local_project_repo (project_name )
404+ pygit_repo = project_repo .pygit_repo
404405
405- for commit in project_repo .walk (
406- project_repo .head .target , pygit2 .GIT_SORT_TIME
406+ for commit in pygit_repo .walk (
407+ pygit_repo .head .target , pygit2 .enums . SortMode . TIME
407408 ):
408409 pybug = commit_filter_function (project_repo , commit )
409410 if pybug :
@@ -435,7 +436,7 @@ def accept_suspect_with_certain_introduction(
435436 ) -> tp .Optional [PygitBug ]:
436437 bug = suspect .create_corresponding_bug ()
437438
438- if fixing_commit and bug .fixing_commit .hex != fixing_commit :
439+ if fixing_commit and bug .fixing_commit .id != fixing_commit :
439440 return None
440441
441442 if introducing_commit and introducing_commit not in [
@@ -470,12 +471,12 @@ def find_commit_message_bugs(
470471 """
471472
472473 def accept_commit_message_pybug (
473- repo : pygit2 . Repository , commit : pygit2 .Commit
474+ repo : RepositoryHandle , commit : pygit2 .Commit
474475 ) -> tp .Optional [PygitBug ]:
475476 if _is_closing_message (commit .message ):
476477 bug = _create_corresponding_bug (commit , repo )
477478
478- if fixing_commit and bug .fixing_commit .hex != fixing_commit :
479+ if fixing_commit and bug .fixing_commit .id != fixing_commit :
479480 return None
480481
481482 if introducing_commit and introducing_commit not in [
0 commit comments