Pārlūkot izejas kodu

Fixes #200 adds repo path to terminal commands

main
Eric Amodio pirms 7 gadiem
vecāks
revīzija
c78d06c5ac
2 mainītis faili ar 14 papildinājumiem un 17 dzēšanām
  1. +1
    -0
      CHANGELOG.md
  2. +13
    -17
      src/views/explorerCommands.ts

+ 1
- 0
CHANGELOG.md Parādīt failu

@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [Unreleased]
### Fixed
- Fixes [#201](https://github.com/eamodio/vscode-gitlens/issues/201) - "Open in Remote" commands should check for branch upstream tracking
- Fixes [#200](https://github.com/eamodio/vscode-gitlens/issues/200) - Submodule using terminal command, root directory is incorrect
## [6.1.0] - 2017-11-13
### Added

+ 13
- 17
src/views/explorerCommands.ts Parādīt failu

@ -143,7 +143,7 @@ export class ExplorerCommands extends Disposable {
if (!(node instanceof BranchHistoryNode)) return;
const command = `checkout ${node.branch.name}`;
this.sendTerminalCommand(command);
this.sendTerminalCommand(command, node.branch.repoPath);
}
async terminalCreateBranch(node: ExplorerNode) {
@ -157,7 +157,7 @@ export class ExplorerCommands extends Disposable {
if (name === undefined || name === '') return;
const command = `branch ${node.branch.remote ? '-t ' : ''}${name} ${node.branch.name}`;
this.sendTerminalCommand(command);
this.sendTerminalCommand(command, node.branch.repoPath);
}
terminalDeleteBranch(node: ExplorerNode) {
@ -166,52 +166,48 @@ export class ExplorerCommands extends Disposable {
const command = node.branch.remote
? `push ${node.branch.remote} :${node.branch.name}`
: `branch -d ${node.branch.name}`;
this.sendTerminalCommand(command);
this.sendTerminalCommand(command, node.branch.repoPath);
}
terminalRebaseBranchToRemote(node: ExplorerNode) {
let command: string;
if (node instanceof BranchHistoryNode) {
if (!node.branch.current || !node.branch.tracking) return;
command = `rebase -i ${node.branch.tracking}`;
const command = `rebase -i ${node.branch.tracking}`;
this.sendTerminalCommand(command, node.branch.repoPath);
}
else if (node instanceof StatusUpstreamNode) {
command = `rebase -i ${node.status.upstream}`;
const command = `rebase -i ${node.status.upstream}`;
this.sendTerminalCommand(command, node.status.repoPath);
}
else {
return;
}
this.sendTerminalCommand(command);
}
terminalSquashBranchIntoCommit(node: ExplorerNode) {
if (!(node instanceof BranchHistoryNode)) return;
const command = `merge --squash ${node.branch.name}`;
this.sendTerminalCommand(command);
this.sendTerminalCommand(command, node.branch.repoPath);
}
terminalRebaseCommit(node: ExplorerNode) {
if (!(node instanceof CommitNode)) return;
const command = `rebase -i ${node.commit.sha}^`;
this.sendTerminalCommand(command);
this.sendTerminalCommand(command, node.commit.repoPath);
}
terminalResetCommit(node: ExplorerNode) {
if (!(node instanceof CommitNode)) return;
const command = `reset --soft ${node.commit.sha}^`;
this.sendTerminalCommand(command);
this.sendTerminalCommand(command, node.commit.repoPath);
}
terminalRemoveRemote(node: ExplorerNode) {
if (!(node instanceof RemoteNode)) return;
const command = `remote remove ${node.remote.name}`;
this.sendTerminalCommand(command);
this.sendTerminalCommand(command, node.remote.repoPath);
}
private ensureTerminal(): Terminal {
@ -231,7 +227,7 @@ export class ExplorerCommands extends Disposable {
return this._terminal;
}
private sendTerminalCommand(command: string) {
private sendTerminalCommand(command: string, cwd: string) {
// let git = GitService.getGitPath();
// if (git.includes(' ')) {
// git = `"${git}"`;
@ -239,6 +235,6 @@ export class ExplorerCommands extends Disposable {
const terminal = this.ensureTerminal();
terminal.show(false);
terminal.sendText(`git ${command}`, false);
terminal.sendText(`git -C ${cwd} ${command}`, false);
}
}

Notiek ielāde…
Atcelt
Saglabāt