3434import threading
3535import requests
3636
37+ from .common import commitRepoDir
3738from .gitutils import Git
3839from .llm import AiChatMode , AiModelBase , AiParameters , AiResponse , LocalLLM
3940from .statewindow import StateWindow
@@ -542,10 +543,18 @@ def currentChatThread(self):
542543 def isLocalLLM (self ):
543544 return self .cbBots .currentIndex () == 0
544545
545- def codeReview (self , sha1 , args ):
546- data : bytes = Git .commitRawDiff (sha1 , gitArgs = args )
546+ def codeReview (self , commit , args ):
547+ repoDir = commitRepoDir (commit )
548+ data : bytes = Git .commitRawDiff (commit .sha1 , gitArgs = args , repoDir = repoDir )
547549 if not data :
548550 return
551+
552+ for subCommit in commit .subCommits :
553+ repoDir = commitRepoDir (subCommit )
554+ subData = Git .commitRawDiff (subCommit .sha1 , gitArgs = args , repoDir = repoDir )
555+ if subData :
556+ data += subData
557+ data += b"\n "
549558
550559 diff = data .decode ("utf-8" , errors = "replace" )
551560 self ._doRequest (diff , AiChatMode .CodeReview )
@@ -560,5 +569,5 @@ def __init__(self, parent=None):
560569 centralWidget = AiChatWidget (self )
561570 self .setCentralWidget (centralWidget )
562571
563- def codeReview (self , sha1 , args = None ):
564- self .centralWidget ().codeReview (sha1 , args )
572+ def codeReview (self , commit , args = None ):
573+ self .centralWidget ().codeReview (commit , args )
0 commit comments