-
Notifications
You must be signed in to change notification settings - Fork 406
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
Mz/w 14720788/diff refresh to sf #5418
Changes from 4 commits
0109d87
9f56b7c
9a17809
b215413
e56ef4f
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 |
---|---|---|
|
@@ -21,15 +21,15 @@ import { FilePathGatherer, SfdxCommandlet, SfdxWorkspaceChecker } from './util'; | |
|
||
const workspaceChecker = new SfdxWorkspaceChecker(); | ||
|
||
export async function forceSourceDiff(sourceUri?: vscode.Uri) { | ||
export const sourceDiff = async (sourceUri?: vscode.Uri) => { | ||
if (!sourceUri) { | ||
const editor = vscode.window.activeTextEditor; | ||
if (editor && editor.document.languageId !== 'forcesourcemanifest') { | ||
sourceUri = editor.document.uri; | ||
} else { | ||
const errorMessage = nls.localize('force_source_diff_unsupported_type'); | ||
const errorMessage = nls.localize('source_diff_unsupported_type'); | ||
telemetryService.sendException('unsupported_type_on_diff', errorMessage); | ||
notificationService.showErrorMessage(errorMessage); | ||
await notificationService.showErrorMessage(errorMessage); | ||
channelService.appendLine(errorMessage); | ||
channelService.showChannelOutput(); | ||
return; | ||
|
@@ -38,13 +38,15 @@ export async function forceSourceDiff(sourceUri?: vscode.Uri) { | |
|
||
const defaultUsernameorAlias = WorkspaceContext.getInstance().username; | ||
if (!defaultUsernameorAlias) { | ||
notificationService.showErrorMessage(nls.localize('missing_default_org')); | ||
await notificationService.showErrorMessage( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here |
||
nls.localize('missing_default_org') | ||
); | ||
return; | ||
} | ||
const executor = new MetadataCacheExecutor( | ||
defaultUsernameorAlias, | ||
nls.localize('force_source_diff_text'), | ||
'force_source_diff', | ||
nls.localize('source_diff_text'), | ||
'source_diff', | ||
handleCacheResults | ||
); | ||
const commandlet = new SfdxCommandlet( | ||
|
@@ -53,17 +55,17 @@ export async function forceSourceDiff(sourceUri?: vscode.Uri) { | |
executor | ||
); | ||
await commandlet.run(); | ||
} | ||
}; | ||
|
||
export async function forceSourceFolderDiff(explorerPath: vscode.Uri) { | ||
export const sourceFolderDiff = async (explorerPath: vscode.Uri) => { | ||
if (!explorerPath) { | ||
const editor = vscode.window.activeTextEditor; | ||
if (editor && editor.document.languageId !== 'forcesourcemanifest') { | ||
explorerPath = editor.document.uri; | ||
} else { | ||
const errorMessage = nls.localize('force_source_diff_unsupported_type'); | ||
const errorMessage = nls.localize('source_diff_unsupported_type'); | ||
telemetryService.sendException('unsupported_type_on_diff', errorMessage); | ||
notificationService.showErrorMessage(errorMessage); | ||
await notificationService.showErrorMessage(errorMessage); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here |
||
channelService.appendLine(errorMessage); | ||
channelService.showChannelOutput(); | ||
return; | ||
|
@@ -72,7 +74,9 @@ export async function forceSourceFolderDiff(explorerPath: vscode.Uri) { | |
|
||
const username = WorkspaceContext.getInstance().username; | ||
if (!username) { | ||
notificationService.showErrorMessage(nls.localize('missing_default_org')); | ||
await notificationService.showErrorMessage( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here (? |
||
nls.localize('missing_default_org') | ||
); | ||
return; | ||
} | ||
|
||
|
@@ -87,12 +91,12 @@ export async function forceSourceFolderDiff(explorerPath: vscode.Uri) { | |
) | ||
); | ||
await commandlet.run(); | ||
} | ||
}; | ||
|
||
export async function handleCacheResults( | ||
export const handleCacheResults = async ( | ||
username: string, | ||
cache?: MetadataCacheResult | ||
): Promise<void> { | ||
): Promise<void> => { | ||
if (cache) { | ||
if (cache.selectedType === PathType.Individual && cache.cache.components) { | ||
await differ.diffOneFile( | ||
|
@@ -104,8 +108,8 @@ export async function handleCacheResults( | |
await differ.diffFolder(cache, username); | ||
} | ||
} else { | ||
const message = nls.localize('force_source_diff_components_not_in_org'); | ||
notificationService.showErrorMessage(message); | ||
const message = nls.localize('source_diff_components_not_in_org'); | ||
await notificationService.showErrorMessage(message); | ||
throw new Error(message); | ||
} | ||
} | ||
}; |
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.
same here