mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-22 19:29:17 +00:00
Git - improve compare reference notification (#274776)
SCM - improve compare reference notification
This commit is contained in:
@@ -3116,13 +3116,12 @@ export class CommandCenter {
|
||||
return;
|
||||
}
|
||||
|
||||
const title = `${repository.historyProvider.currentHistoryItemRemoteRef.name} ↔ ${getHistoryItemDisplayName(historyItem)}`;
|
||||
|
||||
await this._openChangesBetweenRefs(
|
||||
repository,
|
||||
repository.historyProvider.currentHistoryItemRemoteRef.revision,
|
||||
historyItem.id,
|
||||
title);
|
||||
repository.historyProvider.currentHistoryItemRemoteRef.name,
|
||||
getHistoryItemDisplayName(historyItem));
|
||||
}
|
||||
|
||||
@command('git.graph.compareWithMergeBase', { repository: true })
|
||||
@@ -3131,13 +3130,12 @@ export class CommandCenter {
|
||||
return;
|
||||
}
|
||||
|
||||
const title = `${repository.historyProvider.currentHistoryItemBaseRef.name} ↔ ${getHistoryItemDisplayName(historyItem)}`;
|
||||
|
||||
await this._openChangesBetweenRefs(
|
||||
repository,
|
||||
repository.historyProvider.currentHistoryItemBaseRef.name,
|
||||
historyItem.id,
|
||||
title);
|
||||
repository.historyProvider.currentHistoryItemBaseRef.name,
|
||||
getHistoryItemDisplayName(historyItem));
|
||||
}
|
||||
|
||||
@command('git.graph.compareRef', { repository: true })
|
||||
@@ -3168,16 +3166,15 @@ export class CommandCenter {
|
||||
return;
|
||||
}
|
||||
|
||||
const title = `${sourceRef.ref.name} ↔ ${getHistoryItemDisplayName(historyItem)}`;
|
||||
|
||||
await this._openChangesBetweenRefs(
|
||||
repository,
|
||||
sourceRef.ref.commit,
|
||||
historyItem.id,
|
||||
title);
|
||||
sourceRef.ref.name,
|
||||
getHistoryItemDisplayName(historyItem));
|
||||
}
|
||||
|
||||
private async _openChangesBetweenRefs(repository: Repository, ref1: string | undefined, ref2: string | undefined, title: string): Promise<void> {
|
||||
private async _openChangesBetweenRefs(repository: Repository, ref1: string | undefined, ref2: string | undefined, ref1DisplayId: string | undefined, ref2DisplayId: string | undefined): Promise<void> {
|
||||
if (!repository || !ref1 || !ref2) {
|
||||
return;
|
||||
}
|
||||
@@ -3186,7 +3183,7 @@ export class CommandCenter {
|
||||
const changes = await repository.diffBetween2(ref1, ref2);
|
||||
|
||||
if (changes.length === 0) {
|
||||
window.showInformationMessage(l10n.t('There are no changes between "{0}" and "{1}".', ref1, ref2));
|
||||
window.showInformationMessage(l10n.t('There are no changes between "{0}" and "{1}".', ref1DisplayId ?? ref1, ref2DisplayId ?? ref2));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3195,11 +3192,11 @@ export class CommandCenter {
|
||||
|
||||
await commands.executeCommand('_workbench.openMultiDiffEditor', {
|
||||
multiDiffSourceUri,
|
||||
title,
|
||||
title: `${ref1DisplayId} ↔ ${ref2DisplayId}`,
|
||||
resources
|
||||
});
|
||||
} catch (err) {
|
||||
window.showErrorMessage(l10n.t('Failed to open changes between "{0}" and "{1}": {2}', ref1, ref2, err.message));
|
||||
window.showErrorMessage(l10n.t('Failed to open changes between "{0}" and "{1}": {2}', ref1DisplayId ?? ref1, ref2DisplayId ?? ref2, err.message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5337,7 +5334,8 @@ export class CommandCenter {
|
||||
repository,
|
||||
sourceRef.ref.commit,
|
||||
artifact.id,
|
||||
`${sourceRef.ref.name} ↔ ${artifact.name}`);
|
||||
sourceRef.ref.name,
|
||||
artifact.name);
|
||||
}
|
||||
|
||||
private async _createTag(repository: Repository, ref?: string): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user