@@ -34,37 +34,37 @@ async function loadDiffView({ params, url }: PageLoadEvent) {
34
34
const { repoName } = parseRepoRevision ( params . repo )
35
35
const filePath = decodeURIComponent ( params . path )
36
36
const revParam = url . searchParams . get ( 'rev' )
37
- const isPerforceDepot = revParam ?. includes ( 'changelist' )
38
- const cid = revParam ?. replace ( 'changelist/' , '' )
37
+ const cid = revParam ?. includes ( 'changelist' ) && revParam ?. replace ( 'changelist/' , '' )
39
38
40
39
assertNonNullable ( revisionOverride , 'revisionOverride is set' )
41
40
42
- return isPerforceDepot ? {
43
- type : 'DiffView' as const ,
44
- enableInlineDiff : true ,
45
- enableViewAtCommit : true ,
46
- filePath,
47
- commit : client
48
- . query ( BlobDiffViewChangelistQuery , {
49
- repoName,
50
- // @TODO : do better.
51
- cid : cid ! ,
52
- path : filePath ,
53
- } )
54
- . then ( mapOrThrow ( result => result . data ?. repository ?. changelist ?. commit ?? null ) ) ,
55
- } : {
56
- type : 'DiffView' as const ,
57
- enableInlineDiff : true ,
58
- enableViewAtCommit : true ,
59
- filePath,
60
- commit : client
61
- . query ( BlobDiffViewCommitQuery , {
62
- repoName,
63
- revspec : revisionOverride ,
64
- path : filePath ,
65
- } )
66
- . then ( mapOrThrow ( result => result . data ?. repository ?. commit ?? null ) ) ,
67
- }
41
+ return cid
42
+ ? {
43
+ type : 'DiffView' as const ,
44
+ enableInlineDiff : true ,
45
+ enableViewAtCommit : true ,
46
+ filePath,
47
+ commit : client
48
+ . query ( BlobDiffViewChangelistQuery , {
49
+ repoName,
50
+ cid : cid ,
51
+ path : filePath ,
52
+ } )
53
+ . then ( mapOrThrow ( result => result . data ?. repository ?. changelist ?. commit ?? null ) ) ,
54
+ }
55
+ : {
56
+ type : 'DiffView' as const ,
57
+ enableInlineDiff : true ,
58
+ enableViewAtCommit : true ,
59
+ filePath,
60
+ commit : client
61
+ . query ( BlobDiffViewCommitQuery , {
62
+ repoName,
63
+ revspec : revisionOverride ,
64
+ path : filePath ,
65
+ } )
66
+ . then ( mapOrThrow ( result => result . data ?. repository ?. commit ?? null ) ) ,
67
+ }
68
68
}
69
69
70
70
async function fetchCodeGraphData (
@@ -214,11 +214,11 @@ async function loadFileView({ parent, params, url }: PageLoadEvent) {
214
214
// We can ignore the error because if the revision doesn't exist, other queries will fail as well
215
215
revisionOverride : revisionOverride
216
216
? await client
217
- . query ( BlobFileViewCommitQuery_revisionOverride , {
218
- repoName,
219
- revspec : revisionOverride ,
220
- } )
221
- . then ( result => result . data ?. repository ?. commit )
217
+ . query ( BlobFileViewCommitQuery_revisionOverride , {
218
+ repoName,
219
+ revspec : revisionOverride ,
220
+ } )
221
+ . then ( result => result . data ?. repository ?. commit )
222
222
: null ,
223
223
externalServiceType : parent ( )
224
224
. then ( ( { resolvedRevision } ) => resolvedRevision . repo ?. externalRepository ?. serviceType )
0 commit comments