Przeglądaj źródła

Renames Compare Selected Ancestor with Working

main
Eric Amodio 7 lat temu
rodzic
commit
216eb6cad5
4 zmienionych plików z 29 dodań i 29 usunięć
  1. +1
    -1
      CHANGELOG.md
  2. +3
    -3
      README.md
  3. +8
    -8
      package.json
  4. +17
    -17
      src/views/explorerCommands.ts

+ 1
- 1
CHANGELOG.md Wyświetl plik

@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds experimental support for providing blame annotations, code lens, etc on files with unsaved changes (enabled via `"gitlens.insiders": true`) -- closes [#112](https://github.com/eamodio/vscode-gitlens/issues/112)
- Adds `gitlens.defaultDateStyle` setting to specify how dates will be displayed by default -- closes [#89](https://github.com/eamodio/vscode-gitlens/issues/89)
- Adds *Compare with Working* command (`gitlens.explorers.compareWithWorking`) to branch, tag, and revision (commit) nodes in the **GitLens** view to compare the current selection with the current working tree in the **GitLens Results** view
- Adds *Compare Selected Base with Working* command (`gitlens.explorers.compareSelectedBaseWithWorking`) to branch nodes in the **GitLens** view once another branch within the same repository has been selected to compare the [merge base](https://git-scm.com/docs/git-merge-base) of current and previously selected branches with the working tree in the **GitLens Results** view -- closes [#240](https://github.com/eamodio/vscode-gitlens/issues/240)
- Adds *Compare Selected Ancestor with Working* command (`gitlens.explorers.compareSelectedAncestorWithWorking`) to branch nodes in the **GitLens** view once another branch within the same repository has been selected to compare the [merge base](https://git-scm.com/docs/git-merge-base) of current and previously selected branches with the working tree in the **GitLens Results** view -- closes [#240](https://github.com/eamodio/vscode-gitlens/issues/240)
- Adds *Merge Branch (via Terminal)* command (`gitlens.explorers.terminalMergeBranch`) to branch nodes in the **GitLens** view
- Adds *Rebase (Interactive) Branch (via Terminal)* command (`gitlens.explorers.terminalRebaseBranch`) to branch nodes in the **GitLens** view
- Adds *Cherry Pick Commit (via Terminal)* command (`gitlens.explorers.terminalRebaseBranch`) to revision (commit) nodes in the **GitLens** & **GitLens Results** views

+ 3
- 3
README.md Wyświetl plik

@ -169,7 +169,7 @@ While GitLens is highly customizable and provides many [configuration settings](
- 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*, *Compare with Index (HEAD)*, *Compare with Working*, *Compare with Selected*, *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
- 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*, *Compare with Index (HEAD)*, *Compare with Working*, *Compare with Remote*, *Compare with Selected*, *Compare Selected Base with Working*, *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
- Provides a context menu on each branch with *Open Branch in Remote*, *Compare with Index (HEAD)*, *Compare with Working*, *Compare with Remote*, *Compare with Selected*, *Compare Selected Ancestor with Working*, *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
- Provides a context menu with *Open Branches in Remote*, and *Refresh* commands
- **Remotes** node — provides a list of remotes
@ -179,7 +179,7 @@ While GitLens is highly customizable and provides many [configuration settings](
- 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*, *Compare with Index (HEAD)*, *Compare with Working*, *Compare with Selected*, *Select for Compare*, *Cherry Pick Commit (via Terminal)*, *Create Branch (via Terminal)...*, *Create Tag (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*, *Show File History*, and *Show Commit File Details* commands
- Provides a context menu on each remote branch with *Open Branch in Remote*, *Compare with Index (HEAD)*, *Compare with Working*, *Compare with Selected*, *Compare Selected Base with Working*, *Select for Compare*, *Open Directory Compare with Working Tree*, *Checkout Branch (via Terminal)*, *Merge Branch (via Terminal)*, *Rebase (Interactive) Branch (via Terminal)*, *Squash Branch into Commit (via Terminal)*, *Create Branch (via Terminal)...*, *Delete Branch (via Terminal)*, *Create Tag (via Terminal)...*, and *Refresh* commands
- Provides a context menu on each remote branch with *Open Branch in Remote*, *Compare with Index (HEAD)*, *Compare with Working*, *Compare with Selected*, *Compare Selected Ancestor with Working*, *Select for Compare*, *Open Directory Compare with Working Tree*, *Checkout Branch (via Terminal)*, *Merge Branch (via Terminal)*, *Rebase (Interactive) Branch (via Terminal)*, *Squash Branch into Commit (via Terminal)*, *Create Branch (via Terminal)...*, *Delete Branch (via Terminal)*, *Create Tag (via Terminal)...*, and *Refresh* commands
- Provides a context menu on each remote with *Open Branches in Remote*, *Open Repository in Remote*, *Remove Remote (via Terminal)*, and *Refresh* commands
- Provides a context menu with a *Refresh* command
@ -226,7 +226,7 @@ While GitLens is highly customizable and provides many [configuration settings](
- 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 semi-persistent results for revision comparison operations
- Accessible via the following: *Compare with Index (HEAD)* command (`gitlens.explorers.compareWithHead`), *Compare with Remote* command (`gitlens.explorers.compareWithRemote`), *Compare with Working* command (`gitlens.explorers.compareWithWorking`), *Compare with Selected* command (`gitlens.explorers.compareWithSelected`), and *Compare Selected Base with Working* command (`gitlens.explorers.compareSelectedBaseWithWorking`)
- Accessible via the following: *Compare with Index (HEAD)* command (`gitlens.explorers.compareWithHead`), *Compare with Remote* command (`gitlens.explorers.compareWithRemote`), *Compare with Working* command (`gitlens.explorers.compareWithWorking`), *Compare with Selected* command (`gitlens.explorers.compareWithSelected`), and *Compare Selected Ancestor with Working* command (`gitlens.explorers.compareSelectedAncestorWithWorking`)
- **Commits** node — provides a list of the commits between the compared revisions (branches or commits)
- 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*, *Compare with Index (HEAD)*, *Compare with Working*, *Compare with Selected*, *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

+ 8
- 8
package.json Wyświetl plik

@ -1451,8 +1451,8 @@
"category": "GitLens"
},
{
"command": "gitlens.explorers.compareSelectedBaseWithWorking",
"title": "Compare Selected Base with Working",
"command": "gitlens.explorers.compareSelectedAncestorWithWorking",
"title": "Compare Selected Ancestor with Working",
"category": "GitLens"
},
{
@ -1884,7 +1884,7 @@
"when": "false"
},
{
"command": "gitlens.explorers.compareSelectedBaseWithWorking",
"command": "gitlens.explorers.compareSelectedAncestorWithWorking",
"when": "false"
},
{
@ -2363,7 +2363,7 @@
"group": "7_gitlens_@1"
},
{
"command": "gitlens.explorers.compareSelectedBaseWithWorking",
"command": "gitlens.explorers.compareSelectedAncestorWithWorking",
"when": "viewItem == gitlens:branch && gitlens:explorers:canCompare == branch",
"group": "7_gitlens_@2"
},
@ -2438,7 +2438,7 @@
"group": "7_gitlens_@1"
},
{
"command": "gitlens.explorers.compareSelectedBaseWithWorking",
"command": "gitlens.explorers.compareSelectedAncestorWithWorking",
"when": "viewItem == gitlens:branch:tracking && gitlens:explorers:canCompare == branch",
"group": "7_gitlens_@2"
},
@ -2503,7 +2503,7 @@
"group": "7_gitlens_@1"
},
{
"command": "gitlens.explorers.compareSelectedBaseWithWorking",
"command": "gitlens.explorers.compareSelectedAncestorWithWorking",
"when": "viewItem == gitlens:current-branch && gitlens:explorers:canCompare == branch",
"group": "7_gitlens_@2"
},
@ -2548,7 +2548,7 @@
"group": "7_gitlens_@1"
},
{
"command": "gitlens.explorers.compareSelectedBaseWithWorking",
"command": "gitlens.explorers.compareSelectedAncestorWithWorking",
"when": "viewItem == gitlens:current-branch:tracking && gitlens:explorers:canCompare == branch",
"group": "7_gitlens_@2"
},
@ -2593,7 +2593,7 @@
"group": "7_gitlens_@1"
},
{
"command": "gitlens.explorers.compareSelectedBaseWithWorking",
"command": "gitlens.explorers.compareSelectedAncestorWithWorking",
"when": "viewItem == gitlens:remote-branch && gitlens:explorers:canCompare == branch",
"group": "7_gitlens_@2"
},

+ 17
- 17
src/views/explorerCommands.ts Wyświetl plik

@ -38,7 +38,7 @@ export class ExplorerCommands extends Disposable {
commands.registerCommand('gitlens.explorers.openChangedFileChangesWithWorking', this.openChangedFileChangesWithWorking, this);
commands.registerCommand('gitlens.explorers.openChangedFileRevisions', this.openChangedFileRevisions, this);
commands.registerCommand('gitlens.explorers.applyChanges', this.applyChanges, this);
commands.registerCommand('gitlens.explorers.compareSelectedBaseWithWorking', this.compareSelectedBaseWithWorking, this);
commands.registerCommand('gitlens.explorers.compareSelectedAncestorWithWorking', this.compareSelectedAncestorWithWorking, this);
commands.registerCommand('gitlens.explorers.compareWithHead', this.compareWithHead, this);
commands.registerCommand('gitlens.explorers.compareWithRemote', this.compareWithRemote, this);
commands.registerCommand('gitlens.explorers.compareWithSelected', this.compareWithSelected, this);
@ -69,16 +69,6 @@ export class ExplorerCommands extends Disposable {
return this.openFile(node);
}
private async compareSelectedBaseWithWorking(node: BranchNode) {
if (this._selection === undefined || !(node instanceof BranchNode)) return;
if (this._selection.repoPath !== node.repoPath || this._selection.type !== 'branch') return;
const base = await this.git.getMergeBase(this._selection.repoPath, this._selection.ref, node.ref);
if (base === undefined) return;
ResultsExplorer.instance.showComparisonInResults(this._selection.repoPath, base, '');
}
private compareWithHead(node: ExplorerNode) {
if (!(node instanceof ExplorerRefNode)) return;
@ -91,6 +81,22 @@ export class ExplorerCommands extends Disposable {
ResultsExplorer.instance.showComparisonInResults(node.repoPath, node.branch.tracking, node.ref);
}
private compareWithWorking(node: ExplorerNode) {
if (!(node instanceof ExplorerRefNode)) return;
ResultsExplorer.instance.showComparisonInResults(node.repoPath, node.ref, '');
}
private async compareSelectedAncestorWithWorking(node: BranchNode) {
if (this._selection === undefined || !(node instanceof BranchNode)) return;
if (this._selection.repoPath !== node.repoPath || this._selection.type !== 'branch') return;
const commonAncestor = await this.git.getMergeBase(this._selection.repoPath, this._selection.ref, node.ref);
if (commonAncestor === undefined) return;
ResultsExplorer.instance.showComparisonInResults(this._selection.repoPath, commonAncestor, '');
}
private compareWithSelected(node: ExplorerNode) {
if (this._selection === undefined || !(node instanceof ExplorerRefNode)) return;
if (this._selection.repoPath !== node.repoPath) return;
@ -98,12 +104,6 @@ export class ExplorerCommands extends Disposable {
ResultsExplorer.instance.showComparisonInResults(this._selection.repoPath, this._selection.ref, node.ref);
}
private compareWithWorking(node: ExplorerNode) {
if (!(node instanceof ExplorerRefNode)) return;
ResultsExplorer.instance.showComparisonInResults(node.repoPath, node.ref, '');
}
private _selection: ICompareSelected | undefined;
private selectForCompare(node: ExplorerNode) {

Ładowanie…
Anuluj
Zapisz