@@ -312,31 +312,39 @@ export const collectMetricOrder = (
312312type RevisionPathData = { [ path : string ] : Record < string , unknown > [ ] }
313313
314314export type RevisionData = {
315- [ revision : string ] : RevisionPathData
315+ [ label : string ] : RevisionPathData
316316}
317317
318318export type ComparisonData = {
319- [ revision : string ] : {
319+ [ label : string ] : {
320320 [ path : string ] : ImagePlot
321321 }
322322}
323323
324+ export type CLIRevisionIdToLabel = { [ shortSha : string ] : string }
325+
324326const collectImageData = (
325327 acc : ComparisonData ,
326328 path : string ,
327- plot : ImagePlot
329+ plot : ImagePlot ,
330+ cliIdToLabel : CLIRevisionIdToLabel
328331) => {
329332 const rev = plot . revisions ?. [ 0 ]
330-
331333 if ( ! rev ) {
332334 return
333335 }
334336
335- if ( ! acc [ rev ] ) {
336- acc [ rev ] = { }
337+ const label = cliIdToLabel [ rev ]
338+
339+ if ( ! label ) {
340+ return
341+ }
342+
343+ if ( ! acc [ label ] ) {
344+ acc [ label ] = { }
337345 }
338346
339- acc [ rev ] [ path ] = plot
347+ acc [ label ] [ path ] = plot
340348}
341349
342350const collectDatapoints = (
@@ -353,15 +361,17 @@ const collectDatapoints = (
353361const collectPlotData = (
354362 acc : RevisionData ,
355363 path : string ,
356- plot : TemplatePlot
364+ plot : TemplatePlot ,
365+ cliIdToLabel : CLIRevisionIdToLabel
357366) => {
358- for ( const rev of plot . revisions || [ ] ) {
359- if ( ! acc [ rev ] ) {
360- acc [ rev ] = { }
367+ for ( const id of plot . revisions || [ ] ) {
368+ const label = cliIdToLabel [ id ]
369+ if ( ! acc [ label ] ) {
370+ acc [ label ] = { }
361371 }
362- acc [ rev ] [ path ] = [ ]
372+ acc [ label ] [ path ] = [ ]
363373
364- collectDatapoints ( acc , path , rev , plot . datapoints ?. [ rev ] )
374+ collectDatapoints ( acc , path , label , plot . datapoints ?. [ id ] )
365375 }
366376}
367377
@@ -370,25 +380,33 @@ type DataAccumulator = {
370380 comparisonData : ComparisonData
371381}
372382
373- const collectPathData = ( acc : DataAccumulator , path : string , plots : Plot [ ] ) => {
383+ const collectPathData = (
384+ acc : DataAccumulator ,
385+ path : string ,
386+ plots : Plot [ ] ,
387+ cliIdToLabel : CLIRevisionIdToLabel
388+ ) => {
374389 for ( const plot of plots ) {
375390 if ( isImagePlot ( plot ) ) {
376- collectImageData ( acc . comparisonData , path , plot )
391+ collectImageData ( acc . comparisonData , path , plot , cliIdToLabel )
377392 continue
378393 }
379394
380- collectPlotData ( acc . revisionData , path , plot )
395+ collectPlotData ( acc . revisionData , path , plot , cliIdToLabel )
381396 }
382397}
383398
384- export const collectData = ( data : PlotsOutput ) : DataAccumulator => {
399+ export const collectData = (
400+ data : PlotsOutput ,
401+ cliIdToLabel : CLIRevisionIdToLabel
402+ ) : DataAccumulator => {
385403 const acc = {
386404 comparisonData : { } ,
387405 revisionData : { }
388406 } as DataAccumulator
389407
390408 for ( const [ path , plots ] of Object . entries ( data ) ) {
391- collectPathData ( acc , path , plots )
409+ collectPathData ( acc , path , plots , cliIdToLabel )
392410 }
393411
394412 return acc
@@ -543,7 +561,7 @@ export const collectBranchRevisionDetails = (
543561 const branchRevisions : Record < string , string > = { }
544562 for ( const { id, sha } of branchShas ) {
545563 if ( sha ) {
546- branchRevisions [ id ] = sha
564+ branchRevisions [ id ] = shortenForLabel ( sha )
547565 }
548566 }
549567 return branchRevisions
0 commit comments