-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Opens all changes after open in worktree flow finished for PRs #3701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ import { Commands } from '../../constants.commands'; | |
| import type { StoredDeepLinkContext, StoredNamedRef } from '../../constants.storage'; | ||
| import type { Container } from '../../container'; | ||
| import { executeGitCommand } from '../../git/actions'; | ||
| import { openFileAtRevision } from '../../git/actions/commit'; | ||
| import { openComparisonChanges, openFileAtRevision } from '../../git/actions/commit'; | ||
| import type { GitBranch } from '../../git/models/branch'; | ||
| import { getBranchNameWithoutRemote } from '../../git/models/branch'; | ||
| import type { GitCommit } from '../../git/models/commit'; | ||
|
|
@@ -19,6 +19,7 @@ import { missingRepositoryId } from '../../gk/models/repositoryIdentities'; | |
| import { ensureAccount, ensurePaidPlan } from '../../plus/utils'; | ||
| import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol'; | ||
| import { createQuickPickSeparator } from '../../quickpicks/items/common'; | ||
| import { debug } from '../../system/decorators/log'; | ||
| import { once } from '../../system/event'; | ||
| import { Logger } from '../../system/logger'; | ||
| import { normalizePath } from '../../system/path'; | ||
|
|
@@ -68,10 +69,7 @@ export class DeepLinkService implements Disposable { | |
| this._disposables.push(container.uri.onDidReceiveUri(async (uri: Uri) => this.processDeepLinkUri(uri))); | ||
|
|
||
| const pendingDeepLink = this.container.storage.get('deepLinks:pending'); | ||
| if (pendingDeepLink != null) { | ||
| void this.container.storage.delete('deepLinks:pending'); | ||
| void this.processPendingDeepLink(pendingDeepLink); | ||
| } | ||
| void this.processPendingDeepLink(pendingDeepLink); | ||
| } | ||
|
|
||
| dispose() { | ||
|
|
@@ -241,9 +239,11 @@ export class DeepLinkService implements Disposable { | |
| } | ||
| } | ||
|
|
||
| private async processPendingDeepLink(pendingDeepLink: StoredDeepLinkContext) { | ||
| if (pendingDeepLink.url == null) return; | ||
|
|
||
| @debug() | ||
| private async processPendingDeepLink(pendingDeepLink: StoredDeepLinkContext | undefined) { | ||
| if (pendingDeepLink == null) return; | ||
| void this.container.storage.delete('deepLinks:pending'); | ||
axosoft-ramint marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (pendingDeepLink?.url == null) return; | ||
| const link = parseDeepLinkUri(Uri.parse(pendingDeepLink.url)); | ||
| if (link == null) return; | ||
|
|
||
|
|
@@ -509,6 +509,7 @@ export class DeepLinkService implements Disposable { | |
| // TODO @axosoft-ramint: Move all the logic for matching a repo, prompting to add repo, matching remote, etc. for a target (branch, PR, etc.) | ||
| // to a separate service where it can be used outside of the context of deep linking. Then the deep link service should leverage it, | ||
| // and we should stop using deep links to process things like Launchpad switch actions, Open in Worktree command, etc. | ||
| @debug() | ||
| private async processDeepLink( | ||
| initialAction: DeepLinkServiceAction = DeepLinkServiceAction.DeepLinkEventFired, | ||
| useProgress: boolean = true, | ||
|
|
@@ -1078,7 +1079,6 @@ export class DeepLinkService implements Disposable { | |
| } | ||
| case DeepLinkServiceState.GoToTarget: { | ||
| // Need to re-fetch the remotes in case we opened in a new window | ||
|
|
||
| if (targetType === DeepLinkType.Repository) { | ||
| if ( | ||
| this._context.action === DeepLinkActionType.Switch || | ||
|
|
@@ -1373,7 +1373,6 @@ export class DeepLinkService implements Disposable { | |
| case DeepLinkServiceState.OpenInspect: { | ||
| // If we arrive at this step, clear any stored data used for the "new window" option | ||
| await this.container.storage.delete('deepLinks:pending'); | ||
|
|
||
| if (!repo) { | ||
| action = DeepLinkServiceAction.DeepLinkErrored; | ||
| message = 'Missing repository.'; | ||
|
|
@@ -1386,6 +1385,34 @@ export class DeepLinkService implements Disposable { | |
| repository: repo, | ||
| source: 'launchpad', | ||
| } satisfies ShowWipArgs); | ||
| action = DeepLinkServiceAction.OpenAllPrChanges; | ||
|
||
| break; | ||
| } | ||
| case DeepLinkServiceState.OpenAllPrChanges: { | ||
| const prId = this._context.params?.get('prId'); | ||
| const prHeadRef = this._context.params?.get('prHeadRef'); | ||
| const prBaseRef = this._context.params?.get('prBaseRef'); | ||
| const prTitle = this._context.params?.get('prTitle'); | ||
| if (!repoPath || !prId || !prHeadRef || !prBaseRef) { | ||
| action = DeepLinkServiceAction.DeepLinkErrored; | ||
| if (!repoPath) { | ||
| message = 'No repository path was provided.'; | ||
| } else if (!prId) { | ||
| message = 'No pull request id provided.'; | ||
| } else { | ||
| message = 'No pull request refs was provided.'; | ||
| } | ||
| break; | ||
| } | ||
| await openComparisonChanges( | ||
| this.container, | ||
| { | ||
| repoPath: repoPath, | ||
| lhs: prBaseRef, | ||
| rhs: prHeadRef, | ||
| }, | ||
| { title: `Changes in Pull Request ${prTitle ? `"${prTitle}"` : `#${prId}`}` }, | ||
| ); | ||
| action = DeepLinkServiceAction.DeepLinkResolved; | ||
| break; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This transition is no longer necessary since it would/should only be reachable from
OpenInspect