mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Git - fix editor tab labels and notifications when comparing references (#275292)
This commit is contained in:
@@ -3116,10 +3116,14 @@ export class CommandCenter {
|
|||||||
|
|
||||||
await this._openChangesBetweenRefs(
|
await this._openChangesBetweenRefs(
|
||||||
repository,
|
repository,
|
||||||
repository.historyProvider.currentHistoryItemRemoteRef.revision,
|
{
|
||||||
historyItem.id,
|
id: repository.historyProvider.currentHistoryItemRemoteRef.revision,
|
||||||
repository.historyProvider.currentHistoryItemRemoteRef.name,
|
displayId: repository.historyProvider.currentHistoryItemRemoteRef.name
|
||||||
getHistoryItemDisplayName(historyItem));
|
},
|
||||||
|
{
|
||||||
|
id: historyItem.id,
|
||||||
|
displayId: getHistoryItemDisplayName(historyItem)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@command('git.graph.compareWithMergeBase', { repository: true })
|
@command('git.graph.compareWithMergeBase', { repository: true })
|
||||||
@@ -3130,10 +3134,14 @@ export class CommandCenter {
|
|||||||
|
|
||||||
await this._openChangesBetweenRefs(
|
await this._openChangesBetweenRefs(
|
||||||
repository,
|
repository,
|
||||||
repository.historyProvider.currentHistoryItemBaseRef.name,
|
{
|
||||||
historyItem.id,
|
id: repository.historyProvider.currentHistoryItemBaseRef.revision,
|
||||||
repository.historyProvider.currentHistoryItemBaseRef.name,
|
displayId: repository.historyProvider.currentHistoryItemBaseRef.name
|
||||||
getHistoryItemDisplayName(historyItem));
|
},
|
||||||
|
{
|
||||||
|
id: historyItem.id,
|
||||||
|
displayId: getHistoryItemDisplayName(historyItem)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@command('git.graph.compareRef', { repository: true })
|
@command('git.graph.compareRef', { repository: true })
|
||||||
@@ -3166,35 +3174,39 @@ export class CommandCenter {
|
|||||||
|
|
||||||
await this._openChangesBetweenRefs(
|
await this._openChangesBetweenRefs(
|
||||||
repository,
|
repository,
|
||||||
sourceRef.ref.commit,
|
{
|
||||||
historyItem.id,
|
id: sourceRef.ref.commit,
|
||||||
sourceRef.ref.name,
|
displayId: sourceRef.ref.name
|
||||||
getHistoryItemDisplayName(historyItem));
|
},
|
||||||
|
{
|
||||||
|
id: historyItem.id,
|
||||||
|
displayId: getHistoryItemDisplayName(historyItem)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _openChangesBetweenRefs(repository: Repository, ref1: string | undefined, ref2: string | undefined, ref1DisplayId: string | undefined, ref2DisplayId: string | undefined): Promise<void> {
|
private async _openChangesBetweenRefs(repository: Repository, ref1: { id: string | undefined; displayId: string | undefined }, ref2: { id: string | undefined; displayId: string | undefined }): Promise<void> {
|
||||||
if (!repository || !ref1 || !ref2) {
|
if (!repository || !ref1.id || !ref2.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const changes = await repository.diffBetween2(ref1, ref2);
|
const changes = await repository.diffBetween2(ref1.id, ref2.id);
|
||||||
|
|
||||||
if (changes.length === 0) {
|
if (changes.length === 0) {
|
||||||
window.showInformationMessage(l10n.t('There are no changes between "{0}" and "{1}".', ref1DisplayId ?? ref1, ref2DisplayId ?? ref2));
|
window.showInformationMessage(l10n.t('There are no changes between "{0}" and "{1}".', ref1.displayId ?? ref1.id, ref2.displayId ?? ref2.id));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const multiDiffSourceUri = Uri.from({ scheme: 'git-ref-compare', path: `${repository.root}/${ref1}..${ref2}` });
|
const multiDiffSourceUri = Uri.from({ scheme: 'git-ref-compare', path: `${repository.root}/${ref1.id}..${ref2.id}` });
|
||||||
const resources = changes.map(change => toMultiFileDiffEditorUris(change, ref1, ref2));
|
const resources = changes.map(change => toMultiFileDiffEditorUris(change, ref1.id!, ref2.id!));
|
||||||
|
|
||||||
await commands.executeCommand('_workbench.openMultiDiffEditor', {
|
await commands.executeCommand('_workbench.openMultiDiffEditor', {
|
||||||
multiDiffSourceUri,
|
multiDiffSourceUri,
|
||||||
title: `${ref1DisplayId} \u2194 ${ref2DisplayId}`,
|
title: `${ref1.displayId ?? ref1.id} \u2194 ${ref2.displayId ?? ref2.id}`,
|
||||||
resources
|
resources
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
window.showErrorMessage(l10n.t('Failed to open changes between "{0}" and "{1}": {2}', ref1DisplayId ?? ref1, ref2DisplayId ?? ref2, err.message));
|
window.showErrorMessage(l10n.t('Failed to open changes between "{0}" and "{1}": {2}', ref1.displayId ?? ref1.id, ref2.displayId ?? ref2.id, err.message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5330,10 +5342,14 @@ export class CommandCenter {
|
|||||||
|
|
||||||
await this._openChangesBetweenRefs(
|
await this._openChangesBetweenRefs(
|
||||||
repository,
|
repository,
|
||||||
sourceRef.ref.commit,
|
{
|
||||||
artifact.id,
|
id: sourceRef.ref.commit,
|
||||||
sourceRef.ref.name,
|
displayId: sourceRef.ref.name
|
||||||
artifact.name);
|
},
|
||||||
|
{
|
||||||
|
id: artifact.id,
|
||||||
|
displayId: artifact.name
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _createTag(repository: Repository, ref?: string): Promise<void> {
|
private async _createTag(repository: Repository, ref?: string): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user