Git - add more commands to repositories view (#274484)

* Git - add actions to delete branch/tag

* Fix rebase action label

* Git - add more commands
This commit is contained in:
Ladislau Szomoru
2025-11-01 12:27:56 +00:00
committed by GitHub
parent c0755c9484
commit 69e17b67f1
3 changed files with 90 additions and 2 deletions

View File

@@ -5296,6 +5296,15 @@ export class CommandCenter {
await repository.rebase(artifact.id);
}
@command('git.repositories.createFrom', { repository: true })
async artifactCreateFrom(repository: Repository, artifact: SourceControlArtifact): Promise<void> {
if (!repository || !artifact) {
return;
}
await this._branch(repository, undefined, false, artifact.id);
}
@command('git.repositories.compareRef', { repository: true })
async artifactCompareWith(repository: Repository, artifact: SourceControlArtifact): Promise<void> {
if (!repository || !artifact) {
@@ -5352,6 +5361,38 @@ export class CommandCenter {
await repository.tag({ name, message: inputMessage, ref });
}
@command('git.repositories.deleteBranch', { repository: true })
async artifactDeleteBranch(repository: Repository, artifact: SourceControlArtifact): Promise<void> {
if (!repository || !artifact) {
return;
}
const message = l10n.t('Are you sure you want to DELETE branch "{0}"? This action will permanently remove the branch reference from the repository.', artifact.name);
const yes = l10n.t('Yes');
const result = await window.showWarningMessage(message, { modal: true }, yes);
if (result !== yes) {
return;
}
await this._deleteBranch(repository, undefined, artifact.name, { remote: false });
}
@command('git.repositories.deleteTag', { repository: true })
async artifactDeleteTag(repository: Repository, artifact: SourceControlArtifact): Promise<void> {
if (!repository || !artifact) {
return;
}
const message = l10n.t('Are you sure you want to DELETE tag "{0}"? This action will permanently remove the tag reference from the repository.', artifact.name);
const yes = l10n.t('Yes');
const result = await window.showWarningMessage(message, { modal: true }, yes);
if (result !== yes) {
return;
}
await repository.deleteTag(artifact.name);
}
private createCommand(id: string, key: string, method: Function, options: ScmCommandOptions): (...args: any[]) => any {
const result = (...args: any[]) => {
let result: Promise<any>;