Ver a proveniência

Adds terminalCheckoutBranch command

main
Eric Amodio há 7 anos
ascendente
cometimento
81b469ca91
4 ficheiros alterados com 41 adições e 8 eliminações
  1. +1
    -0
      CHANGELOG.md
  2. +2
    -2
      README.md
  3. +30
    -6
      package.json
  4. +8
    -0
      src/views/explorerCommands.ts

+ 1
- 0
CHANGELOG.md Ver ficheiro

@ -23,6 +23,7 @@ ATTENTION! To support multi-root workspaces some underlying fundamentals had to
- Adds `Enable Automatic Refresh` command (`gitlens.gitExplorer.setAutoRefreshToOn`) to the `GitLens` custom view regardless of the current view
- Adds `Disable Automatic Refresh` command (`gitlens.gitExplorer.setAutoRefreshToOff`) to the `GitLens` custom view regardless of the current view
- Adds new Git terminal commands to the `GitLens` custom view - opens a `GitLens` terminal and sends the specified Git command to it
- Adds `Checkout Branch (via Terminal)` command (`gitlens.terminalCheckoutBranch`) to branch node(s) of the `GitLens` custom view
- Adds `Create Branch (via Terminal)...` command (`gitlens.terminalCreateBranch`) to branch node(s) of the `GitLens` custom view
- Adds `Delete Branch (via Terminal)` command (`gitlens.terminalDeleteBranch`) to branch node(s) of the `GitLens` custom view
- Adds `Rebase Branch to Remote (via Terminal)` command (`gitlens.terminalRebaseBranchToRemote`) to branch node(s) of the `GitLens` custom view

+ 2
- 2
README.md Ver ficheiro

@ -164,7 +164,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
- Provides a context menu on each revision (commit) with `Open Commit in Remote`, `Open All Changes`, `Open All Changes with Working Tree`, `Open Files`, `Open Revisions`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`, `Show Commit Details`, `Rebase Commit (via Terminal)`, `Reset Commit (via Terminal)`, and `Refresh` commands
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, and `Show Commit File Details` commands
- Provides a context menu on each branch with `Open Branch in Remote`, `Create Branch (via Terminal)...`, `Delete Branch (via Terminal)`, `Rebase Branch to Remote (via Terminal)`, and `Refresh` commands
- Provides a context menu on each branch with `Open Branch in Remote`, `Checkout Branch (via Terminal)`, `Create Branch (via Terminal)...`, `Delete Branch (via Terminal)`, `Rebase Branch to Remote (via Terminal)`, and `Refresh` commands
- Provides a context menu with `Open Branches in Remote`, and `Refresh` commands
- `Remotes` node — provides a list of remotes
@ -174,7 +174,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
- Provides a context menu on each revision (commit) with `Open Commit in Remote`, `Open All Changes`, `Open All Changes with Working Tree`, `Open Files`, `Open Revisions`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`,`Show Commit Details`, and `Refresh` commands
- Provides a context menu on each changed file with `Open Changes`, `Open Changes with Working Tree`, `Open File`, `Open Revision`, `Open File in Remote`, `Open Revision in Remote`, `Apply Changes`, `Show File History`, and `Show Commit File Details` commands
- Provides a context menu on each remote branch with `Open Branch in Remote`, `Create Branch (via Terminal)...`, `Delete Branch (via Terminal)`, and `Refresh` commands
- Provides a context menu on each remote branch with `Open Branch in Remote`, `Checkout Branch (via Terminal)`, `Create Branch (via Terminal)...`, `Delete Branch (via Terminal)`, and `Refresh` commands
- Provides a context menu on each remote with `Open Branches in Remote`, `Open Repository in Remote`, and `Refresh` commands
- Provides a context menu with a `Refresh` command

+ 30
- 6
package.json Ver ficheiro

@ -1326,6 +1326,11 @@
"category": "GitLens"
},
{
"command": "gitlens.gitExplorer.terminalCheckoutBranch",
"title": "Checkout Branch (via Terminal)",
"category": "GitLens"
},
{
"command": "gitlens.gitExplorer.terminalCreateBranch",
"title": "Create Branch (via Terminal)...",
"category": "GitLens"
@ -1582,6 +1587,10 @@
"when": "false"
},
{
"command": "gitlens.gitExplorer.terminalCheckoutBranch",
"when": "false"
},
{
"command": "gitlens.gitExplorer.terminalCreateBranch",
"when": "false"
},
@ -1869,31 +1878,41 @@
"group": "1_gitlens@1"
},
{
"command": "gitlens.gitExplorer.terminalCreateBranch",
"command": "gitlens.gitExplorer.terminalCheckoutBranch",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:branch-history",
"group": "8_gitlens@1"
},
{
"command": "gitlens.gitExplorer.terminalDeleteBranch",
"command": "gitlens.gitExplorer.terminalCreateBranch",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:branch-history",
"group": "8_gitlens@2"
},
{
"command": "gitlens.gitExplorer.terminalDeleteBranch",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:branch-history",
"group": "8_gitlens@3"
},
{
"command": "gitlens.openBranchInRemote",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:branch-history:tracking",
"group": "1_gitlens@1"
},
{
"command": "gitlens.gitExplorer.terminalCreateBranch",
"command": "gitlens.gitExplorer.terminalCheckoutBranch",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:branch-history:tracking",
"group": "8_gitlens@1"
},
{
"command": "gitlens.gitExplorer.terminalDeleteBranch",
"command": "gitlens.gitExplorer.terminalCreateBranch",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:branch-history:tracking",
"group": "8_gitlens@2"
},
{
"command": "gitlens.gitExplorer.terminalDeleteBranch",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:branch-history:tracking",
"group": "8_gitlens@3"
},
{
"command": "gitlens.gitExplorer.terminalCreateBranch",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:current-branch-history",
"group": "8_gitlens@1"
@ -1919,16 +1938,21 @@
"group": "1_gitlens@1"
},
{
"command": "gitlens.gitExplorer.terminalCreateBranch",
"command": "gitlens.gitExplorer.terminalCheckoutBranch",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:remote-branch-history",
"group": "8_gitlens@1"
},
{
"command": "gitlens.gitExplorer.terminalDeleteBranch",
"command": "gitlens.gitExplorer.terminalCreateBranch",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:remote-branch-history",
"group": "8_gitlens@2"
},
{
"command": "gitlens.gitExplorer.terminalDeleteBranch",
"when": "view == gitlens.gitExplorer && viewItem == gitlens:remote-branch-history",
"group": "8_gitlens@3"
},
{
"command": "gitlens.openCommitInRemote",
"when": "gitlens:hasRemotes && view == gitlens.gitExplorer && viewItem == gitlens:commit",
"group": "1_gitlens@1"

+ 8
- 0
src/views/explorerCommands.ts Ver ficheiro

@ -36,6 +36,7 @@ export class ExplorerCommands extends Disposable {
commands.registerCommand('gitlens.gitExplorer.openChangedFileChangesWithWorking', this.openChangedFileChangesWithWorking, this);
commands.registerCommand('gitlens.gitExplorer.openChangedFileRevisions', this.openChangedFileRevisions, this);
commands.registerCommand('gitlens.gitExplorer.applyChanges', this.applyChanges, this);
commands.registerCommand('gitlens.gitExplorer.terminalCheckoutBranch', this.terminalCheckoutBranch, this);
commands.registerCommand('gitlens.gitExplorer.terminalCreateBranch', this.terminalCreateBranch, this);
commands.registerCommand('gitlens.gitExplorer.terminalDeleteBranch', this.terminalDeleteBranch, this);
commands.registerCommand('gitlens.gitExplorer.terminalRebaseBranchToRemote', this.terminalRebaseBranchToRemote, this);
@ -136,6 +137,13 @@ export class ExplorerCommands extends Disposable {
return workspace.getConfiguration(ExtensionKey).update(configuration.name('gitExplorer')('files')('layout').value, layout, true);
}
async terminalCheckoutBranch(node: ExplorerNode) {
if (!(node instanceof BranchHistoryNode)) return;
const command = `checkout ${node.branch.name}`;
this.sendTerminalCommand(command);
}
async terminalCreateBranch(node: ExplorerNode) {
if (!(node instanceof BranchHistoryNode)) return;

Carregando…
Cancelar
Guardar