소스 검색

Adds push to commit terminal command

main
Eric Amodio 6 년 전
부모
커밋
da8a22f5d4
5개의 변경된 파일29개의 추가작업 그리고 3개의 파일을 삭제
  1. +1
    -0
      CHANGELOG.md
  2. +2
    -2
      README.md
  3. +14
    -0
      package.json
  4. +1
    -1
      src/views/commitNode.ts
  5. +11
    -0
      src/views/explorerCommands.ts

+ 1
- 0
CHANGELOG.md 파일 보기

@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds `gitlens.statusBar.reduceFlicker` setting to specify whether to reduce the status bar "flickering" when changing lines by not first clearing the previous blame information -- closes [#272](https://github.com/eamodio/vscode-gitlens/issues/272)
- Adds the *Open File* (`gitlens.explorers.openFile`) command to the *GitLens* explorer inline for file nodes
- Adds the *Clear Results* (`gitlen.resultsExplorer.clearResultsNode`) command to the *GitLens Results* view inline for results nodes
- Adds *Push to Commit (via Terminal)* (`gitlens.explorers.terminalPushCommit`) command to commit nodes on the current branch in the *GitLens* explorer
### Fixed
- Fixes [#276](https://github.com/eamodio/vscode-gitlens/issues/276) - Lookup for branches without upstreams fails

+ 2
- 2
README.md 파일 보기

@ -110,7 +110,7 @@ The repository view provides a full Git repository explorer, which has the follo
- *Open Branch in Remote* (if available), *Compare with Remote* (if available), *Compare with Index (HEAD)*, *Compare with Working Tree*, *Compare with Selected* (when available), *Compare Selected Ancestor with Working Tree* (when available), *Select for Compare*, *Open Directory Compare with Working Tree*, *Checkout Branch (via Terminal)*, *Merge Branch (via Terminal)*, *Rebase (Interactive) Branch (via Terminal)*, *Rebase (Interactive) Branch to Remote (via Terminal)*, *Squash Branch into Commit (via Terminal)*, *Create Branch (via Terminal)...*, *Delete Branch (via Terminal)*, *Create Tag (via Terminal)...*, and *Refresh* commands
- Revisions (commits) expand to show the set of files changed, complete with status indicators for adds, changes, renames, and deletes
- Context menus for each revision (commit) provide
- *Open Commit in Remote* (if available), *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*, *Compare with Index (HEAD)*, *Compare with Working Tree*, *Compare with Selected* (when available), *Select for Compare*, *Cherry Pick Commit (via Terminal)*, *Revert Commit (via Terminal)*, *Rebase to Commit (via Terminal)*, *Reset to Commit (via Terminal)*, *Create Branch (via Terminal)...*, *Create Tag (via Terminal)...*, and *Refresh* commands
- *Open Commit in Remote* (if available), *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*, *Compare with Index (HEAD)*, *Compare with Working Tree*, *Compare with Selected* (when available), *Select for Compare*, *Cherry Pick Commit (via Terminal)* (when available), *Push to Commit (via Terminal)* (when available), *Revert Commit (via Terminal)* (when available), *Rebase to Commit (via Terminal)* (when available), *Reset to Commit (via Terminal)* (when available), *Create Branch (via Terminal)...*, *Create Tag (via Terminal)...*, and *Refresh* commands
- Context menus for each changed file provide
- *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote*, *Open Revision in Remote*, *Apply Changes*, and *Show Commit File Details* commands
@ -168,7 +168,7 @@ An on-demand, [customizable](#gitlens-results-view-settings "Jump to the GitLens
- *Show Commit Details* command (`gitlens.showQuickCommitDetails`)
- Revisions (commits) expand show the set of files changed, complete with status indicators for adds, changes, renames, and deletes
- Context menus for each revision (commit) provide
- *Open Commit in Remote* (if available), *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*, *Compare with Index (HEAD)*, *Compare with Working Tree*, *Compare with Selected* (when available), *Select for Compare*, *Cherry Pick Commit (via Terminal)*, *Revert Commit (via Terminal)*, *Rebase to Commit (via Terminal)*, *Reset to Commit (via Terminal)*, *Create Branch (via Terminal)...*, *Create Tag (via Terminal)...*, and *Refresh* commands
- *Open Commit in Remote* (if available), *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*, *Compare with Index (HEAD)*, *Compare with Working Tree*, *Compare with Selected* (when available), *Select for Compare*, *Cherry Pick Commit (via Terminal)* (when available), *Push to Commit (via Terminal)* (when available), *Revert Commit (via Terminal)* (when available), *Rebase to Commit (via Terminal)* (when available), *Reset to Commit (via Terminal)* (when available), *Create Branch (via Terminal)...*, *Create Tag (via Terminal)...*, and *Refresh* commands
- Context menus for each changed file provide
- *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote*, *Open Revision in Remote*, *Apply Changes*, and *Show Commit File Details* commands

+ 14
- 0
package.json 파일 보기

@ -1479,6 +1479,11 @@
"category": "GitLens"
},
{
"command": "gitlens.explorers.terminalPushCommit",
"title": "Push to Commit (via Terminal)",
"category": "GitLens"
},
{
"command": "gitlens.explorers.terminalRebaseCommit",
"title": "Rebase to Commit (via Terminal)",
"category": "GitLens"
@ -1924,6 +1929,10 @@
"when": "false"
},
{
"command": "gitlens.explorers.terminalPushCommit",
"when": "false"
},
{
"command": "gitlens.explorers.terminalRebaseCommit",
"when": "false"
},
@ -2475,6 +2484,11 @@
"group": "8_gitlens@1"
},
{
"command": "gitlens.explorers.terminalPushCommit",
"when": "viewItem == gitlens:commit:current",
"group": "8_gitlens@1"
},
{
"command": "gitlens.explorers.terminalRevertCommit",
"when": "viewItem == gitlens:commit:current",
"group": "8_gitlens@1"

+ 1
- 1
src/views/commitNode.ts 파일 보기

@ -15,7 +15,7 @@ export class CommitNode extends ExplorerRefNode {
constructor(
public readonly commit: GitLogCommit,
private readonly explorer: Explorer,
private readonly branch?: GitBranch
public readonly branch?: GitBranch
) {
super(commit.toGitUri());
}

+ 11
- 0
src/views/explorerCommands.ts 파일 보기

@ -49,6 +49,7 @@ export class ExplorerCommands extends Disposable {
commands.registerCommand('gitlens.explorers.terminalRebaseBranchToRemote', this.terminalRebaseBranchToRemote, this);
commands.registerCommand('gitlens.explorers.terminalSquashBranchIntoCommit', this.terminalSquashBranchIntoCommit, this);
commands.registerCommand('gitlens.explorers.terminalCherryPickCommit', this.terminalCherryPickCommit, this);
commands.registerCommand('gitlens.explorers.terminalPushCommit', this.terminalPushCommit, this);
commands.registerCommand('gitlens.explorers.terminalRebaseCommit', this.terminalRebaseCommit, this);
commands.registerCommand('gitlens.explorers.terminalResetCommit', this.terminalResetCommit, this);
commands.registerCommand('gitlens.explorers.terminalRevertCommit', this.terminalRevertCommit, this);
@ -280,6 +281,16 @@ export class ExplorerCommands extends Disposable {
this.sendTerminalCommand(command, node.repoPath);
}
async terminalPushCommit(node: ExplorerNode) {
if (!(node instanceof CommitNode)) return;
const branch = node.branch || await Container.git.getBranch(node.repoPath);
if (branch === undefined) return;
const command = `push ${branch.getRemote()} ${node.ref}:${branch.getName()}`;
this.sendTerminalCommand(command, node.repoPath);
}
terminalRebaseCommit(node: ExplorerNode) {
if (!(node instanceof CommitNode)) return;

불러오는 중...
취소
저장