1- import { MarkdownString , TreeItem , TreeItemCollapsibleState } from 'vscode' ;
1+ import { MarkdownString , ThemeColor , ThemeIcon , TreeItem , TreeItemCollapsibleState } from 'vscode' ;
2+ import type { Colors } from '../../constants.colors' ;
23import { GitUri } from '../../git/gitUri' ;
34import { GitBranch } from '../../git/models/branch' ;
45import type { GitCommit } from '../../git/models/commit' ;
@@ -7,16 +8,25 @@ import type { GitBranchReference } from '../../git/models/reference';
78import type { Repository } from '../../git/models/repository' ;
89import { getAheadBehindFilesQuery , getCommitsQuery } from '../../git/queryResults' ;
910import { getIssueOrPullRequestMarkdownIcon , getIssueOrPullRequestThemeIcon } from '../../git/utils/-webview/icons' ;
10- import { ensurePullRequestRefs , getOrOpenPullRequestRepository } from '../../git/utils/-webview/pullRequest.utils' ;
11- import { getComparisonRefsForPullRequest } from '../../git/utils/pullRequest.utils' ;
11+ import {
12+ ensurePullRequestRefs ,
13+ ensurePullRequestRemote ,
14+ getOrOpenPullRequestRepository ,
15+ } from '../../git/utils/-webview/pullRequest.utils' ;
16+ import {
17+ getComparisonRefsForPullRequest ,
18+ getRepositoryIdentityForPullRequest ,
19+ } from '../../git/utils/pullRequest.utils' ;
1220import { createRevisionRange } from '../../git/utils/revision.utils' ;
21+ import { createCommand } from '../../system/-webview/command' ;
1322import { pluralize } from '../../system/string' ;
1423import type { ViewsWithCommits } from '../viewBase' ;
24+ import { createViewDecorationUri } from '../viewDecorationProvider' ;
1525import { CacheableChildrenViewNode } from './abstract/cacheableChildrenViewNode' ;
1626import type { ClipboardType , ViewNode } from './abstract/viewNode' ;
1727import { ContextValues , getViewNodeId } from './abstract/viewNode' ;
1828import { CodeSuggestionsNode } from './codeSuggestionsNode' ;
19- import { MessageNode } from './common' ;
29+ import { CommandMessageNode , MessageNode } from './common' ;
2030import { ResultsCommitsNode } from './resultsCommitsNode' ;
2131import { ResultsFilesNode } from './resultsFilesNode' ;
2232
@@ -159,6 +169,31 @@ export async function getPullRequestChildren(
159169
160170 const repoPath = repo . path ;
161171 const refs = getComparisonRefsForPullRequest ( repoPath , pullRequest . refs ! ) ;
172+ const identity = getRepositoryIdentityForPullRequest ( pullRequest ) ;
173+ if ( ! ( await ensurePullRequestRemote ( pullRequest , repo , { silent : true } ) ) ) {
174+ return [
175+ new CommandMessageNode (
176+ view ,
177+ parent ,
178+ createCommand < [ ViewNode , PullRequest , Repository ] > (
179+ 'gitlens.views.addPullRequestRemote' ,
180+ 'Add Pull Request Remote...' ,
181+ parent ,
182+ pullRequest ,
183+ repo ,
184+ ) ,
185+ `Unable to find a remote for '${ identity . provider . repoDomain } '` ,
186+ undefined ,
187+ `Click to add a remote for '${ identity . provider . repoDomain } '` ,
188+ new ThemeIcon (
189+ 'question' ,
190+ new ThemeColor ( 'gitlens.decorations.workspaceRepoMissingForegroundColor' satisfies Colors ) ,
191+ ) ,
192+ undefined ,
193+ createViewDecorationUri ( 'remote' , { state : 'missing' } ) ,
194+ ) ,
195+ ] ;
196+ }
162197
163198 const counts = await ensurePullRequestRefs (
164199 pullRequest ,
0 commit comments