@@ -958,9 +958,20 @@ def __onGeneratePatch(self):
958958 self ,
959959 self .tr ("Save Patch" ))
960960 if f :
961- # TODO: generate with subCommits?
962- repoDir = commitRepoDir (commit )
963- Git .generatePatch (commit .sha1 , f , repoDir )
961+ repoDir = commitRepoDir (commit )
962+ patch = Git .commitRawPatch (commit .sha1 , repoDir )
963+ if patch is None :
964+ patch = b''
965+
966+ for subCommit in commit .subCommits :
967+ repoDir = commitRepoDir (subCommit )
968+ subPatch = Git .commitRawPatch (subCommit .sha1 , repoDir )
969+ if subPatch :
970+ patch += b'\n ' + subPatch
971+
972+ if patch :
973+ with open (f , "wb+" ) as h :
974+ h .write (patch )
964975
965976 def __onGenerateDiff (self ):
966977 if self .curIdx == - 1 :
@@ -973,9 +984,19 @@ def __onGenerateDiff(self):
973984 self ,
974985 self .tr ("Save Diff" ))
975986 if f :
976- # TODO: generate with subCommits?
977987 repoDir = commitRepoDir (commit )
978- Git .generateDiff (commit .sha1 , f , repoDir )
988+ diff = Git .commitRawDiff (commit .sha1 , repoDir = repoDir )
989+ if diff is None :
990+ diff = b''
991+ for subCommit in commit .subCommits :
992+ repoDir = commitRepoDir (subCommit )
993+ subDiff = Git .commitRawDiff (subCommit .sha1 , repoDir = repoDir )
994+ if subDiff :
995+ diff += b'\n ' + subDiff
996+
997+ if diff :
998+ with open (f , "wb+" ) as h :
999+ h .write (diff )
9791000
9801001 def __onRevertCommit (self ):
9811002 if self .curIdx == - 1 :
0 commit comments