mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 03:39:23 +00:00
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:
@@ -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>;
|
||||
|
||||
Reference in New Issue
Block a user