-
Notifications
You must be signed in to change notification settings - Fork 393
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
fix: Enable Source-Tracking Commands (Push*, Pull*, View Changes*) for Source-Tracked Sandboxes #4755
Conversation
packages/salesforcedx-vscode-core/src/context/workspaceOrgType.ts
Outdated
Show resolved
Hide resolved
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.
I'll defer to @AnanyaJha and approve once she has looked at this change because Ken and I discussed this change and came up with this text together.
@sbudhirajadoc and @AnanyaJha FYI - realized that this workspaceOrgType change also exposes the SFDX: View Changes* commands - which is good since those commands can be used to check source status in a source-tracked sandbox now. Just wanted to give you a heads up that I also updated the title text for those commands to remove "Scratch". |
packages/salesforcedx-vscode-core/src/context/workspaceContext.ts
Outdated
Show resolved
Hide resolved
packages/salesforcedx-vscode-core/src/context/workspaceOrgType.ts
Outdated
Show resolved
Hide resolved
packages/salesforcedx-vscode-core/test/jest/context/workspaceContext.test.ts
Outdated
Show resolved
Hide resolved
packages/salesforcedx-vscode-core/test/vscode-integration/context/workspaceOrgType.test.ts
Outdated
Show resolved
Hide resolved
@@ -150,14 +150,14 @@ | |||
{ | |||
"id": "metadata", | |||
"name": "Metadata", | |||
"when": "sfdx:project_opened && sfdx:default_username_has_no_change_tracking" | |||
"when": "sfdx:project_opened && (sfdx:default_username_has_no_change_tracking || !sfdx:is_scratch_org)" |
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.
Had to add this context variable in order to keep the Deploy* and Retrieve* commands exposed for source-tracked Sandboxes but not yet expose them for Scratch Orgs.
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.
Do the deploy/retrieve commands not yet work for scratch orgs?
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.
They work to deploy and retrieve the components, but they do not fix up source tracking correctly, since they don't have the source tracking library in the flow.
I broke the original PR up to split out the work in this PR, and the next two PRs will be to "fix Retrieve for source-tracked sandboxes" (to add in STL #4773), and then "fix Deploy for source-tracked sandboxes" (to add in STL).
After those two, we will expose deploy/retrieve for Scratch orgs (now that they will be handling source tracking correctly). And finally, expose Org Browser.
import * as vscode from 'vscode'; | ||
import { OrgAuthInfo } from '../util'; | ||
|
||
export async function setIsScratchOrg() { |
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.
Pulled this out from workspaceContext to make testing easier.
@@ -56,6 +55,10 @@ export async function setupWorkspaceOrgType(defaultUsernameOrAlias?: string) { | |||
setDefaultUsernameHasChangeTracking(false); | |||
setDefaultUsernameHasNoChangeTracking(false); | |||
break; | |||
case 'NoUsernameFoundError': |
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.
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.
@@ -150,14 +150,14 @@ | |||
{ | |||
"id": "metadata", | |||
"name": "Metadata", | |||
"when": "sfdx:project_opened && sfdx:default_username_has_no_change_tracking" | |||
"when": "sfdx:project_opened && (sfdx:default_username_has_no_change_tracking || !sfdx:is_scratch_org)" |
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.
Do the deploy/retrieve commands not yet work for scratch orgs?
packages/salesforcedx-vscode-core/test/jest/context/contextVariables.test.ts
Show resolved
Hide resolved
packages/salesforcedx-vscode-core/test/jest/context/workspaceContext.test.ts
Outdated
Show resolved
Hide resolved
I QA'd this and didn't find any issues. I tested push, pull, and view changes on a scratch org, a source tracked sandbox org, and tests deploy & retrieve on a (non-source tracked) sandbox org. |
change to stay in line with this PR -- #4755
What does this PR do?
Fixes the getWorkspaceOrgType function to properly identify source-tracked sandboxes as being source-tracking enabled.
Making this change exposes the SFDX: Push*, SFDX: Pull*, and SFDX: View Changes* commands when connected to a source-tracked sandbox org. These commands have been slightly renamed, to remove the word "Scratch" from the command title.
Push-or-deploy-on-save
setting. Prior to this PR, this setting would initiate adeploy
operation on save. After this PR the setting will initiate apush
operation on save - since the extension code now recognizes a sandbox with source-tracking enabled as being a source-tracked org.What issues does this PR fix or reference?
@W-12757190@
Fixes #2952
Many thanks to @FabienTaillon for submitting a draft PR (#4727) to implement this.
Functionality Before
getWorkspaceOrgType would return OrgType.NonSourceTracked for a source-tracked Sandbox.
When enabled, the Push-or-deploy-on-save setting would initiate a
deploy
operation on save.The following commands were not exposed when connected to a source-tracked Sandbox:
'SFDX: Pull Source from Default Scratch Org',
'SFDX: Pull Source from Default Scratch Org and Override Conflicts',
'SFDX: Pull Source from Default Scratch Org (Legacy)',**'SFDX: Pull Source from Default Scratch Org and Override Conflicts (Legacy)',**'SFDX: Push Source to Default Scratch Org',
'SFDX: Push Source to Default Scratch Org and Override Conflicts',
'SFDX: Push Source to Default Scratch Org (Legacy)',**'SFDX: Push Source to Default Scratch Org and Override Conflicts (Legacy)',**'SFDX: View Local Changes',
'SFDX: View Changes in Default Scratch Org',
'SFDX: View All Changes (Local and in Default Scratch Org)',
'SFDX: View All Changes (Local and in Default Scratch Org) (Legacy)'**Note: the "(Legacy)" commands were removed in #4771
Functionality After
getWorkspaceOrgType returns OrgType.SourceTracked for a source-tracked Sandbox.
When enabled, the Push-or-deploy-on-save setting initiates a
push
operation on save.The following commands ARE exposed when connected to a source-tracked Sandbox (and are renamed slightly):
'SFDX: Pull Source from Default Org',
'SFDX: Pull Source from Default Org and Override Conflicts',
'SFDX: Push Source to Default Org',
'SFDX: Push Source to Default Org and Override Conflicts',
'SFDX: View Local Changes',
'SFDX: View Changes in Default Org',
'SFDX: View All Changes (Local and in Default Org)',
Todos: