mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +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:
@@ -1071,6 +1071,24 @@
|
||||
"title": "%command.rebase2%",
|
||||
"category": "Git",
|
||||
"enablement": "!operationInProgress"
|
||||
},
|
||||
{
|
||||
"command": "git.repositories.deleteBranch",
|
||||
"title": "%command.deleteRef%",
|
||||
"category": "Git",
|
||||
"enablement": "!operationInProgress"
|
||||
},
|
||||
{
|
||||
"command": "git.repositories.deleteTag",
|
||||
"title": "%command.deleteRef%",
|
||||
"category": "Git",
|
||||
"enablement": "!operationInProgress"
|
||||
},
|
||||
{
|
||||
"command": "git.repositories.createFrom",
|
||||
"title": "%command.createFrom%",
|
||||
"category": "Git",
|
||||
"enablement": "!operationInProgress"
|
||||
}
|
||||
],
|
||||
"continueEditSession": [
|
||||
@@ -1722,6 +1740,18 @@
|
||||
{
|
||||
"command": "git.repositories.rebase",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "git.repositories.deleteBranch",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "git.repositories.deleteTag",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "git.repositories.createFrom",
|
||||
"when": "false"
|
||||
}
|
||||
],
|
||||
"scm/title": [
|
||||
@@ -1950,9 +1980,24 @@
|
||||
"group": "2_modify@2",
|
||||
"when": "scmProvider == git && scmArtifactGroupId == branches"
|
||||
},
|
||||
{
|
||||
"command": "git.repositories.createFrom",
|
||||
"group": "3_modify@1",
|
||||
"when": "scmProvider == git && scmArtifactGroupId == branches"
|
||||
},
|
||||
{
|
||||
"command": "git.repositories.deleteBranch",
|
||||
"group": "3_modify@2",
|
||||
"when": "scmProvider == git && scmArtifactGroupId == branches"
|
||||
},
|
||||
{
|
||||
"command": "git.repositories.deleteTag",
|
||||
"group": "3_modify@1",
|
||||
"when": "scmProvider == git && scmArtifactGroupId == tags"
|
||||
},
|
||||
{
|
||||
"command": "git.repositories.compareRef",
|
||||
"group": "3_compare@1",
|
||||
"group": "4_compare@1",
|
||||
"when": "scmProvider == git"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -77,7 +77,8 @@
|
||||
"command.merge2": "Merge",
|
||||
"command.mergeAbort": "Abort Merge",
|
||||
"command.rebase": "Rebase Branch...",
|
||||
"command.rebase2": "Rebase Branch",
|
||||
"command.rebase2": "Rebase",
|
||||
"command.createFrom": "Create from...",
|
||||
"command.createTag": "Create Tag...",
|
||||
"command.deleteTag": "Delete Tag...",
|
||||
"command.migrateWorktreeChanges": "Migrate Worktree Changes...",
|
||||
@@ -142,6 +143,7 @@
|
||||
"command.graphCompareRef": "Compare with...",
|
||||
"command.graphCompareWithMergeBase": "Compare with Merge Base",
|
||||
"command.graphCompareWithRemote": "Compare with Remote",
|
||||
"command.deleteRef": "Delete",
|
||||
"command.blameToggleEditorDecoration": "Toggle Git Blame Editor Decoration",
|
||||
"command.blameToggleStatusBarItem": "Toggle Git Blame Status Bar Item",
|
||||
"command.api.getRepositories": "Get Repositories",
|
||||
|
||||
@@ -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