diff --git a/CHANGELOG.md b/CHANGELOG.md index 34e24ff..c63f1ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,9 @@ 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 *Compare Index (HEAD) with Branch or Tag...* (`gitlens.explorers.diffHeadWithBranch`) command - compares the index (HEAD) to the selected branch or tag — thanks to [PR #278](https://github.com/eamodio/vscode-gitlens/pull/278) by Geoffrey ([@g3offrey](https://github.com/g3offrey))! - Adds *Compare Working Tree with Branch or Tag...* (`gitlens.explorers.diffWorkingWithBranch`) command - compares the working tree to the selected branch or tag -- 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 the *Open File* (`gitlens.explorers.openFile`) command to the *GitLens* explorer's inline toolbar for file nodes +- Adds the *Clear Results* (`gitlen.resultsExplorer.clearResultsNode`) command to the *GitLens Results* view's inline toolbar for results nodes +- Adds the *Swap Comparision* (`gitlen.resultsExplorer.swapComparision`) command to the *GitLens Results* view's inline toolbar and context menu for comparision results nodes - Adds *Push to Commit (via Terminal)* (`gitlens.explorers.terminalPushCommit`) command to commit nodes on the current branch in the *GitLens* explorer ## Changed diff --git a/README.md b/README.md index 98717c4..0fa95c2 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ The repository view provides a full Git repository explorer, which has the follo - *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 + - Inline toolbars for each changed file provide an *Open File* command - **Remotes** — lists the remotes - Indicates the direction of the remote (fetch, push, both), remote service (if applicable), and repository path @@ -147,6 +148,7 @@ The repository view provides a full Git repository explorer, which has the follo The history view provides the revision history of the active file, which has the following features, - Automatically updates to track the active editor - A context menu provides *Open File*, *Open File in Remote* (if available), and *Refresh* commands +- An inline toolbar provides an *Open File* command - Context menus for each revision (commit) provides - *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote* (if available), *Open Revision in Remote* (if available), *Apply Changes*, and *Show Commit File Details* commands @@ -166,6 +168,8 @@ An on-demand, [customizable](#gitlens-results-view-settings "Jump to the GitLens - *Show Commit Search* command (`gitlens.showCommitSearch`) - *Show File History* command (`gitlens.showQuickFileHistory`) - *Show Commit Details* command (`gitlens.showQuickCommitDetails`) + - An inline toolbar provides a *Clear Results* command + - A context menu provides *Clear Results*, and *Refresh* commands - 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)* (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 @@ -180,7 +184,8 @@ An on-demand, [customizable](#gitlens-results-view-settings "Jump to the GitLens - *Compare with Working Tree* command (`gitlens.explorers.compareWithWorking`) - *Compare with Selected* command (`gitlens.explorers.compareWithSelected`) - *Compare Selected Ancestor with Working Tree* command (`gitlens.explorers.compareSelectedAncestorWithWorking`) - - A context menu provides *Clear Results*, *Open Directory Compare*, and *Refresh* commands + - An inline toolbar provides *Swap Comparision*, and *Clear Results* commands + - A context menu provides *Clear Results*, *Swap Comparision*, *Open Directory Compare*, and *Refresh* commands - **Commits** — lists the commits between the compared revisions (branches or commits) - Revisions (commits) expand to show the set of files changed, complete with status indicators for adds, changes, renames, and deletes diff --git a/images/dark/icon-swap.svg b/images/dark/icon-swap.svg new file mode 100644 index 0000000..bccab3b --- /dev/null +++ b/images/dark/icon-swap.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/images/light/icon-swap.svg b/images/light/icon-swap.svg new file mode 100644 index 0000000..b84ebb7 --- /dev/null +++ b/images/light/icon-swap.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/package.json b/package.json index 836e616..3e1f0fa 100644 --- a/package.json +++ b/package.json @@ -1654,6 +1654,15 @@ "dark": "images/dark/icon-locked.svg", "light": "images/light/icon-locked.svg" } + }, + { + "command": "gitlens.resultsExplorer.swapComparision", + "title": "Swap Comparision", + "category": "GitLens", + "icon": { + "dark": "images/dark/icon-swap.svg", + "light": "images/light/icon-swap.svg" + } } ], "menus": { @@ -2053,6 +2062,10 @@ { "command": "gitlens.resultsExplorer.setKeepResultsToOff", "when": "false" + }, + { + "command": "gitlens.resultsExplorer.swapComparision", + "when": "false" } ], "editor/context": [ @@ -2607,16 +2620,26 @@ "group": "1_gitlens@1" }, { + "command": "gitlens.resultsExplorer.swapComparision", + "when": "viewItem == gitlens:results:comparison", + "group": "inline@1" + }, + { "command": "gitlens.resultsExplorer.clearResultsNode", - "when": "viewItem =~ /gitlens:results\\b/", - "group": "inline" + "when": "viewItem =~ /gitlens:results\\b(?!:(commits|files))/", + "group": "inline@2" }, { "command": "gitlens.resultsExplorer.clearResultsNode", - "when": "viewItem =~ /gitlens:results\\b/", + "when": "viewItem =~ /gitlens:results\\b(?!:(commits|files))/", "group": "1_gitlens@1" }, { + "command": "gitlens.resultsExplorer.swapComparision", + "when": "viewItem == gitlens:results:comparison", + "group": "1_gitlens@2" + }, + { "command": "gitlens.explorers.openDirectoryDiff", "when": "viewItem == gitlens:results:comparison", "group": "7_gitlens@1" diff --git a/src/views/commitsResultsNode.ts b/src/views/commitsResultsNode.ts index 2be59a7..e868493 100644 --- a/src/views/commitsResultsNode.ts +++ b/src/views/commitsResultsNode.ts @@ -16,7 +16,7 @@ export class CommitsResultsNode extends ExplorerNode { private readonly labelFn: (log: GitLog | undefined) => Promise, private readonly logFn: (maxCount: number | undefined) => Promise, private readonly explorer: Explorer, - private readonly contextValue: ResourceType = ResourceType.Results + private readonly contextValue: ResourceType = ResourceType.ResultsCommits ) { super(GitUri.fromRepoPath(repoPath)); } diff --git a/src/views/comparisonResultsNode.ts b/src/views/comparisonResultsNode.ts index 8b8e678..25d5685 100644 --- a/src/views/comparisonResultsNode.ts +++ b/src/views/comparisonResultsNode.ts @@ -11,7 +11,7 @@ import { StatusFilesResultsNode } from './statusFilesResultsNode'; export class ComparisonResultsNode extends ExplorerNode { constructor( - repoPath: string, + public readonly repoPath: string, public readonly ref1: string, public readonly ref2: string, private readonly explorer: Explorer diff --git a/src/views/explorerNode.ts b/src/views/explorerNode.ts index 836b8d7..bd96629 100644 --- a/src/views/explorerNode.ts +++ b/src/views/explorerNode.ts @@ -41,6 +41,8 @@ export enum ResourceType { Repositories = 'gitlens:repositories', Repository = 'gitlens:repository', Results = 'gitlens:results', + ResultsCommits = 'gitlens:results:commits', + ResultsFiles = 'gitlens:results:files', SearchResults = 'gitlens:results:search', Stash = 'gitlens:stash', StashFile = 'gitlens:file:stash', diff --git a/src/views/resultsExplorer.ts b/src/views/resultsExplorer.ts index 45160e4..ee021ec 100644 --- a/src/views/resultsExplorer.ts +++ b/src/views/resultsExplorer.ts @@ -36,6 +36,7 @@ export class ResultsExplorer extends Disposable implements TreeDataProvider this.setKeepResults(true), this); commands.registerCommand('gitlens.resultsExplorer.setKeepResultsToOff', () => this.setKeepResults(false), this); + commands.registerCommand('gitlens.resultsExplorer.swapComparision', this.swapComparision, this); setCommandContext(CommandContext.ResultsExplorerKeepResults, this.keepResults); @@ -216,4 +217,10 @@ export class ResultsExplorer extends Disposable implements TreeDataProvider 0 ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.None); - item.contextValue = ResourceType.Results; + item.contextValue = ResourceType.ResultsFiles; return item; }