@@ -400,21 +400,22 @@ export const make = Effect.gen(function* () {
400400 } ) ;
401401
402402 // GitCafe's pulls carry no line totals, and linked pull requests are summarized every minute,
403- // so totals are held per revision rather than recounted from hunks on every read.
404- const lineStatsByRevision = new Map < string , Effect . Success < ReturnType < typeof readLineStats > > > ( ) ;
403+ // so totals are held per head commit rather than recounted from hunks on every read. The
404+ // pull's version also moves on comments and reviews, which change no lines.
405+ const lineStatsByHead = new Map < string , Effect . Success < ReturnType < typeof readLineStats > > > ( ) ;
405406 const lineStats = (
406407 input : PullRef ,
407408 pull : { readonly version : number ; readonly headOid : string } ,
408409 ) => {
409- const key = `${ input . host } ${ input . repository . toLowerCase ( ) } ${ input . number } ${ pull . version } ${ pull . headOid } ` ;
410- const held = lineStatsByRevision . get ( key ) ;
410+ const key = `${ input . host } ${ input . repository . toLowerCase ( ) } ${ input . number } ${ pull . headOid } ` ;
411+ const held = lineStatsByHead . get ( key ) ;
411412 if ( held !== undefined ) return Effect . succeed ( held ) ;
412413 return readLineStats ( input , pull . version ) . pipe (
413414 Effect . tap ( ( stats ) =>
414415 Effect . sync ( ( ) => {
415- if ( lineStatsByRevision . size >= LINE_STATS_CACHE_SIZE )
416- lineStatsByRevision . delete ( lineStatsByRevision . keys ( ) . next ( ) . value ! ) ;
417- lineStatsByRevision . set ( key , stats ) ;
416+ if ( lineStatsByHead . size >= LINE_STATS_CACHE_SIZE )
417+ lineStatsByHead . delete ( lineStatsByHead . keys ( ) . next ( ) . value ! ) ;
418+ lineStatsByHead . set ( key , stats ) ;
418419 } ) ,
419420 ) ,
420421 ) ;
@@ -547,26 +548,6 @@ export const make = Effect.gen(function* () {
547548 } ;
548549 } ,
549550 ) ,
550- listChangeRequestStats : ( input ) =>
551- Effect . forEach (
552- input . changeRequests ,
553- ( { repository, number } ) => {
554- const ref = { cwd : input . cwd , host : input . host , repository, number } ;
555- return readPull ( "listChangeRequestStats" , ref ) . pipe (
556- Effect . flatMap ( ( pull ) =>
557- pull . headOid === null
558- ? Effect . succeed ( [ ] )
559- : lineStats ( ref , { version : pull . version , headOid : pull . headOid } ) . pipe (
560- Effect . map ( ( { additions, deletions } ) => [
561- { repository, number, additions, deletions } ,
562- ] ) ,
563- ) ,
564- ) ,
565- Effect . orElseSucceed ( ( ) => [ ] ) ,
566- ) ;
567- } ,
568- { concurrency : 4 } ,
569- ) . pipe ( Effect . map ( ( stats ) => stats . flat ( ) ) ) ,
570551 getChangeRequestSummary : Effect . fn ( "GitCafePullRequestProvider.getChangeRequestSummary" ) (
571552 function * ( input ) {
572553 const pull = yield * readPull ( "getChangeRequestSummary" , input ) ;
0 commit comments