@@ -38,7 +38,7 @@ def __init__(self, pr_url: Optional[str] = None, incremental=IncrementalPR(False
3838 self .set_pr (pr_url )
3939 self .pr_commits = list (self .pr .get_commits ())
4040 if self .incremental .is_incremental :
41- self .file_set = dict ()
41+ self .unreviewed_files_set = dict ()
4242 self .get_incremental_commits ()
4343 self .last_commit_id = self .pr_commits [- 1 ]
4444 self .pr_url = self .get_pr_url () # pr_url for github actions can be as api.github.com, so we need to get the url from the pr object
@@ -68,9 +68,10 @@ def get_incremental_commits(self):
6868 if commit .commit .message .startswith (f"Merge branch '{ self ._get_repo ().default_branch } '" ):
6969 get_logger ().info (f"Skipping merge commit { commit .commit .message } " )
7070 continue
71- self .file_set .update ({file .filename : file for file in commit .files })
71+ self .unreviewed_files_set .update ({file .filename : file for file in commit .files })
7272 else :
73- raise ValueError ("No previous review found" )
73+ get_logger ().info ("No previous review found, will review the entire PR" )
74+ self .incremental .is_incremental = False
7475
7576 def get_commit_range (self ):
7677 last_review_time = self .previous_review .created_at
@@ -99,8 +100,8 @@ def get_previous_review(self, *, full: bool, incremental: bool):
99100 return self .comments [index ]
100101
101102 def get_files (self ):
102- if self .incremental .is_incremental and self .file_set :
103- return self .file_set .values ()
103+ if self .incremental .is_incremental and self .unreviewed_files_set :
104+ return self .unreviewed_files_set .values ()
104105 try :
105106 git_files = context .get ("git_files" , None )
106107 if git_files :
@@ -146,10 +147,10 @@ def get_diff_files(self) -> list[FilePatchInfo]:
146147 new_file_content_str = self ._get_pr_file_content (file , self .pr .head .sha ) # communication with GitHub
147148 patch = file .patch
148149
149- if self .incremental .is_incremental and self .file_set :
150+ if self .incremental .is_incremental and self .unreviewed_files_set :
150151 original_file_content_str = self ._get_pr_file_content (file , self .incremental .last_seen_commit_sha )
151152 patch = load_large_diff (file .filename , new_file_content_str , original_file_content_str )
152- self .file_set [file .filename ] = patch
153+ self .unreviewed_files_set [file .filename ] = patch
153154 else :
154155 original_file_content_str = self ._get_pr_file_content (file , self .pr .base .sha )
155156 if not patch :
0 commit comments