From 82c3d8b518947b82be2123261b77c22c6a82040b Mon Sep 17 00:00:00 2001 From: Jason Harris Date: Thu, 15 Aug 2024 15:29:50 -0500 Subject: [PATCH 1/2] history panel should update ui elements if scoped to perforce depot --- client/web-sveltekit/src/lib/repo/HistoryPanel.gql | 4 ++++ .../web-sveltekit/src/lib/repo/HistoryPanel.svelte | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/client/web-sveltekit/src/lib/repo/HistoryPanel.gql b/client/web-sveltekit/src/lib/repo/HistoryPanel.gql index 9c5a69ebf984..5e2e40eca7e7 100644 --- a/client/web-sveltekit/src/lib/repo/HistoryPanel.gql +++ b/client/web-sveltekit/src/lib/repo/HistoryPanel.gql @@ -11,6 +11,10 @@ fragment HistoryPanel_HistoryConnection on GitCommitConnection { ...Avatar_Person } } + perforceChangelist { + cid + canonicalURL + } canonicalURL } pageInfo { diff --git a/client/web-sveltekit/src/lib/repo/HistoryPanel.svelte b/client/web-sveltekit/src/lib/repo/HistoryPanel.svelte index 61e0a457da3f..faa849ae8537 100644 --- a/client/web-sveltekit/src/lib/repo/HistoryPanel.svelte +++ b/client/web-sveltekit/src/lib/repo/HistoryPanel.svelte @@ -61,13 +61,17 @@ {#each $history.data as commit (commit.id)} {@const selected = commit.abbreviatedOID === selectedRev || commit.oid === selectedRev} + {@const isPerforceDepot = commit.perforceChangelist !== null} + {@const revURL = isPerforceDepot ? commit.perforceChangelist?.canonicalURL : commit.canonicalURL} + {@const revID = isPerforceDepot ? commit.perforceChangelist?.cid : commit.abbreviatedOID} + - {commit.abbreviatedOID} + {revID} {#if enableInlineDiff} - {commit.subject} + {commit.subject} {:else} {commit.subject} {/if} @@ -78,7 +82,7 @@ - {#if enableViewAtCommit} + {#if enableViewAtCommit && !isPerforceDepot} From de12d4fb18b317ada3f6e6ab5035eaf1ff957754 Mon Sep 17 00:00:00 2001 From: Peter Guy Date: Thu, 15 Aug 2024 14:17:58 -0700 Subject: [PATCH 2/2] Include both the changelist and commit in the query --- .../(validrev)/(code)/-/blob/[...path]/+page.ts | 6 +++++- .../(validrev)/(code)/-/blob/[...path]/page.gql | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/client/web-sveltekit/src/routes/[...repo=reporev]/(validrev)/(code)/-/blob/[...path]/+page.ts b/client/web-sveltekit/src/routes/[...repo=reporev]/(validrev)/(code)/-/blob/[...path]/+page.ts index 3514d1d6d075..bba78e78e45b 100644 --- a/client/web-sveltekit/src/routes/[...repo=reporev]/(validrev)/(code)/-/blob/[...path]/+page.ts +++ b/client/web-sveltekit/src/routes/[...repo=reporev]/(validrev)/(code)/-/blob/[...path]/+page.ts @@ -46,7 +46,11 @@ async function loadDiffView({ params, url }: PageLoadEvent) { revspec: revisionOverride, path: filePath, }) - .then(mapOrThrow(result => result.data?.repository?.commit ?? null)), + .then( + mapOrThrow( + result => result.data?.repository?.changelist?.commit ?? result.data?.repository?.commit ?? null + ) + ), } } diff --git a/client/web-sveltekit/src/routes/[...repo=reporev]/(validrev)/(code)/-/blob/[...path]/page.gql b/client/web-sveltekit/src/routes/[...repo=reporev]/(validrev)/(code)/-/blob/[...path]/page.gql index dd5827fd627f..5df000d0130a 100644 --- a/client/web-sveltekit/src/routes/[...repo=reporev]/(validrev)/(code)/-/blob/[...path]/page.gql +++ b/client/web-sveltekit/src/routes/[...repo=reporev]/(validrev)/(code)/-/blob/[...path]/page.gql @@ -1,6 +1,21 @@ query BlobDiffViewCommitQuery($repoName: String!, $revspec: String!, $path: String!) { repository(name: $repoName) { id + changelist(cid: $revspec) { + commit { + id + perforceChangelist { + cid + canonicalURL + } + + blob(path: $path) { + ...DiffViewGitBlob + } + + ...DiffViewCommit + } + } commit(rev: $revspec) { id perforceChangelist {