Skip to content

Commit 9dc6e29

Browse files
committed
Closes #234 - adds directory compare to views
1 parent 261b216 commit 9dc6e29

File tree

8 files changed

+103
-42
lines changed

8 files changed

+103
-42
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1010
- Automatically updates to track the repository of the active editor
1111
- Only visible if there is more than 1 repository within the workspace
1212

13-
- Adds a new `Tags` node to the `Repository View` of the `GitLens` view
13+
- Adds a new `Tags` node to the `Repository View` of the `GitLens` view -- closes [#234](https://github.com/eamodio/vscode-gitlens/issues/234)
1414
- Provides a list of tags
1515
- Expand each tag to easily see its revision (commit) history
1616
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
1717
- 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 Selected`, `Select for Compare`, `Rebase Commit (via Terminal)`, `Reset Commit (via Terminal)`, and `Refresh` commands
1818
- 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
19-
- Provides a context menu on each tag with `Compare with Selected`, `Select for Compare`, and `Refresh` commands
19+
- Provides a context menu on each tag with `Compare with Selected`, `Select for Compare`, `Open Directory Compare with Working Tree`, and `Refresh` commands
2020
- Provides a context menu with a `Refresh` command
2121

2222
- Adds [Gravatar](https://en.gravatar.com/) support to the `GitLens` view
@@ -43,7 +43,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
4343
- `Changed Files` node — provides a list of all the files changed between the compared revisions (branches or commits)
4444
- Expands to a file-based view of all changed files
4545
- 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
46-
46+
- Provides a context menu with `Open Directory Compare` and `Refresh` commands
4747
- Provides toolbar commands to `Search Commits`, `Keep Results`, `Refresh`, `Show Files in Automatic View` or `Show Files in List View` or `Show Files in Tree View`, and `Close`
4848

4949
- Adds `Apply Changes` option to the commit/stash file quick pick menu -- closes [#232](https://github.com/eamodio/vscode-gitlens/issues/232)
@@ -53,6 +53,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
5353

5454
### Changed
5555
- Improves startup performance a bit
56+
- Renames `Compare Directory with Branch...` command (`gitlens.diffDirectory`) to `Directory Compare Working Tree with...`
57+
- Renames `Compare Directory with Previous Revision` in quick pick menus to `Open Directory Compare with Previous Revision`
58+
- Renames `Compare Directory with Working Tree` in quick pick menus to `Open Directory Compare with Working Tree`
5659

5760
### Fixed
5861
- Fixes [#228](https://github.com/eamodio/vscode-gitlens/issues/228) - Gutter blame spills over heatmap

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ While GitLens is highly customizable and provides many [configuration settings](
160160
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
161161
- 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 Selected`, `Select for Compare`, `Rebase Commit (via Terminal)`, `Reset Commit (via Terminal)`, and `Refresh` commands
162162
- 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
163-
- Provides a context menu on each branch with `Open Branch in Remote`, `Compare with Selected`, `Select for Compare`, `Checkout Branch (via Terminal)`, `Create Branch (via Terminal)...`, `Delete Branch (via Terminal)`, `Rebase Branch to Remote (via Terminal)`, `Squash Branch into Commit (via Terminal)`, and `Refresh` commands
163+
- Provides a context menu on each branch with `Open Branch in Remote`, `Compare with Selected`, `Select for Compare`, `Open Directory Compare with Working Tree`, `Checkout Branch (via Terminal)`, `Create Branch (via Terminal)...`, `Delete Branch (via Terminal)`, `Rebase Branch to Remote (via Terminal)`, `Squash Branch into Commit (via Terminal)`, and `Refresh` commands
164164
- Provides a context menu with `Open Branches in Remote`, and `Refresh` commands
165165

166166
- `Remotes` node — provides a list of remotes
@@ -170,7 +170,7 @@ While GitLens is highly customizable and provides many [configuration settings](
170170
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
171171
- 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 Selected`, `Select for Compare`, and `Refresh` commands
172172
- 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
173-
- Provides a context menu on each remote branch with `Open Branch in Remote`, `Compare with Selected`, `Select for Compare`, `Checkout Branch (via Terminal)`, `Create Branch (via Terminal)...`, `Delete Branch (via Terminal)`, `Squash Branch into Commit (via Terminal)`, and `Refresh` commands
173+
- Provides a context menu on each remote branch with `Open Branch in Remote`, `Compare with Selected`, `Select for Compare`, `Open Directory Compare with Working Tree`, `Checkout Branch (via Terminal)`, `Create Branch (via Terminal)...`, `Delete Branch (via Terminal)`, `Squash Branch into Commit (via Terminal)`, and `Refresh` commands
174174
- Provides a context menu on each remote with `Open Branches in Remote`, `Open Repository in Remote`, `Remove Remote (via Terminal)`, and `Refresh` commands
175175
- Provides a context menu with a `Refresh` command
176176

@@ -185,7 +185,7 @@ While GitLens is highly customizable and provides many [configuration settings](
185185
- Expand each revision (commit) to quickly see the set of files changed, complete with status indicators for adds, changes, renames, and deletes
186186
- 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 Selected`, `Select for Compare`, `Rebase Commit (via Terminal)`, `Reset Commit (via Terminal)`, and `Refresh` commands
187187
- 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
188-
- Provides a context menu on each tag with `Compare with Selected`, `Select for Compare`, and `Refresh` commands
188+
- Provides a context menu on each tag with `Compare with Selected`, `Select for Compare`, `Open Directory Compare with Working Tree`, and `Refresh` commands
189189
- Provides a context menu with a `Refresh` command
190190

191191
- `History View` - provides the revision history of the active file
@@ -223,7 +223,7 @@ While GitLens is highly customizable and provides many [configuration settings](
223223
- `Changed Files` node — provides a list of all the files changed between the compared revisions (branches or commits)
224224
- Expands to a file-based view of all changed files
225225
- 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
226-
226+
- Provides a context menu with `Open Directory Compare` and `Refresh` commands
227227
- Provides toolbar commands to `Search Commits`, `Keep Results`, `Refresh`, `Show Files in Automatic View` or `Show Files in List View` or `Show Files in Tree View`, and `Close`
228228

229229
- Adds commands to open files, commits, branches, and the repository in the supported remote services, **BitBucket, GitHub, GitLab, and Visual Studio Team Services** or a [**user-defined** remote services](#custom-remotes-settings) — only available if a Git upstream service is configured in the repository
@@ -258,7 +258,7 @@ While GitLens is highly customizable and provides many [configuration settings](
258258
![Commit Details Quick Pick Menu](https://raw.githubusercontent.com/eamodio/vscode-gitlens/master/images/screenshot-commit-details.png)
259259

260260
- Quickly see the set of files changed in the commit, complete with status indicators for adds, changes, renames, and deletes
261-
- Provides additional entries to `Open Commit in <remote-service>` when available, `Open Files`, `Open Revisions`, `Compare Directory with Previous Revision`, `Compare Directory with Working Tree`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`
261+
- Provides additional entries to `Open Commit in <remote-service>` when available, `Open Files`, `Open Revisions`, `Open Directory Compare with Previous Revision`, `Open Directory Compare with Working Tree`, `Copy Commit ID to Clipboard`, `Copy Commit Message to Clipboard`
262262
- Navigate back to the previous quick pick menu via `alt+left arrow`, if available
263263
- Use the `alt+right arrow` shortcut on an entry to execute it without closing the quick pick menu, if possible — commands that open windows outside of VS Code will still close the quick pick menu unless [`"gitlens.advanced.quickPick.closeOnFocusOut": false`](#extension-settings) is set
264264
- Use the `alt+right arrow` shortcut on a file entry in the `Changed Files` section to preview the comparison of the current revision with the previous one
@@ -295,7 +295,7 @@ While GitLens is highly customizable and provides many [configuration settings](
295295
![Stash Details Quick Pick Menu](https://raw.githubusercontent.com/eamodio/vscode-gitlens/master/images/screenshot-stash-details.png)
296296

297297
- Quickly see the set of files changed in the stash, complete with status indicators for adds, changes, renames, and deletes
298-
- Provides additional entries to `Apply Stashed Changes` (requires confirmation), `Delete Stashed Changes` (requires confirmation), `Open Files`, `Open Revisions`, `Compare Directory with Previous Revision`, `Compare Directory with Working Tree`, `Copy Commit Message to Clipboard`
298+
- Provides additional entries to `Apply Stashed Changes` (requires confirmation), `Delete Stashed Changes` (requires confirmation), `Open Files`, `Open Revisions`, `Open Directory Compare with Previous Revision`, `Open Directory Compare with Working Tree`, `Copy Commit Message to Clipboard`
299299
- Navigate back to the previous quick pick menu via `alt+left arrow`, if available
300300
- Use the `alt+right arrow` shortcut on an entry to execute it without closing the quick pick menu, if possible — commands that open windows outside of VS Code will still close the quick pick menu unless [`"gitlens.advanced.quickPick.closeOnFocusOut": false`](#extension-settings) is set
301301
- Use the `alt+right arrow` shortcut on a file entry in the `Changed Files` section to preview the comparison of the current revision with the previous one
@@ -308,7 +308,7 @@ While GitLens is highly customizable and provides many [configuration settings](
308308

309309
- Provides easy access to the following comparison commands via the `Command Palette` as well as in context via the many provided quick pick menus
310310

311-
- Adds a `Compare Directory with Branch...` command (`gitlens.diffDirectory`) to open the configured Git difftool to compare directories between branches
311+
- Adds a `Directory Compare Working Tree with...` command (`gitlens.diffDirectory`) to open the configured Git difftool to compare the working tree with the selected branch
312312

313313
- Adds a `Compare File with Branch...` command (`gitlens.diffWithBranch`) to compare the active file with the same file on the selected branch
314314

package.json

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@
11371137
"commands": [
11381138
{
11391139
"command": "gitlens.diffDirectory",
1140-
"title": "Compare Directory with Branch...",
1140+
"title": "Directory Compare Working Tree with...",
11411141
"category": "GitLens"
11421142
},
11431143
{
@@ -1364,6 +1364,16 @@
13641364
"title": "Reset Suppressed Warnings",
13651365
"category": "GitLens"
13661366
},
1367+
{
1368+
"command": "gitlens.explorers.openDirectoryDiff",
1369+
"title": "Open Directory Compare",
1370+
"category": "GitLens"
1371+
},
1372+
{
1373+
"command": "gitlens.explorers.openDirectoryDiffWithWorking",
1374+
"title": "Open Directory Compare with Working Tree",
1375+
"category": "GitLens"
1376+
},
13671377
{
13681378
"command": "gitlens.explorers.openChanges",
13691379
"title": "Open Changes",
@@ -1741,6 +1751,14 @@
17411751
"command": "gitlens.explorers.openChanges",
17421752
"when": "false"
17431753
},
1754+
{
1755+
"command": "gitlens.explorers.openDirectoryDiff",
1756+
"when": "false"
1757+
},
1758+
{
1759+
"command": "gitlens.explorers.openDirectoryDiffWithWorking",
1760+
"when": "false"
1761+
},
17441762
{
17451763
"command": "gitlens.explorers.openChangesWithWorking",
17461764
"when": "false"
@@ -2206,6 +2224,11 @@
22062224
"when": "viewItem == gitlens:branch",
22072225
"group": "7_gitlens@2"
22082226
},
2227+
{
2228+
"command": "gitlens.explorers.openDirectoryDiffWithWorking",
2229+
"when": "viewItem == gitlens:branch",
2230+
"group": "7_gitlens_diff@1"
2231+
},
22092232
{
22102233
"command": "gitlens.explorers.terminalCheckoutBranch",
22112234
"when": "viewItem == gitlens:branch",
@@ -2241,6 +2264,11 @@
22412264
"when": "viewItem == gitlens:branch:tracking",
22422265
"group": "7_gitlens@2"
22432266
},
2267+
{
2268+
"command": "gitlens.explorers.openDirectoryDiffWithWorking",
2269+
"when": "viewItem == gitlens:branch:tracking",
2270+
"group": "7_gitlens_diff@1"
2271+
},
22442272
{
22452273
"command": "gitlens.explorers.terminalCheckoutBranch",
22462274
"when": "viewItem == gitlens:branch:tracking",
@@ -2316,6 +2344,11 @@
23162344
"when": "viewItem == gitlens:remote-branch",
23172345
"group": "7_gitlens@2"
23182346
},
2347+
{
2348+
"command": "gitlens.explorers.openDirectoryDiffWithWorking",
2349+
"when": "viewItem == gitlens:remote-branch",
2350+
"group": "7_gitlens_diff@1"
2351+
},
23192352
{
23202353
"command": "gitlens.explorers.terminalCheckoutBranch",
23212354
"when": "viewItem == gitlens:remote-branch",
@@ -2526,6 +2559,11 @@
25262559
"when": "viewItem == gitlens:comparison-results",
25272560
"group": "1_gitlens@1"
25282561
},
2562+
{
2563+
"command": "gitlens.explorers.openDirectoryDiff",
2564+
"when": "viewItem == gitlens:comparison-results",
2565+
"group": "7_gitlens@1"
2566+
},
25292567
{
25302568
"command": "gitlens.resultsExplorer.clearResultsNode",
25312569
"when": "viewItem == gitlens:search-results",
@@ -2681,6 +2719,11 @@
26812719
"when": "viewItem == gitlens:tag",
26822720
"group": "7_gitlens@2"
26832721
},
2722+
{
2723+
"command": "gitlens.explorers.openDirectoryDiffWithWorking",
2724+
"when": "viewItem == gitlens:tag",
2725+
"group": "7_gitlens_diff@1"
2726+
},
26842727
{
26852728
"command": "gitlens.gitExplorer.refreshNode",
26862729
"when": "view == gitlens.gitExplorer && viewItem != gitlens:commit-file && viewItem != gitlens:stash-file && viewItem != gitlens:status-file",

src/commands/common.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
import { commands, Disposable, SourceControlResourceGroup, SourceControlResourceState, TextDocumentShowOptions, TextEditor, TextEditorEdit, Uri, window, workspace } from 'vscode';
3-
import { ExplorerNode } from '../views/explorerNodes';
3+
import { ExplorerNode, ExplorerRefNode } from '../views/explorerNodes';
44
import { GitBranch, GitCommit, GitRemote, GitUri } from '../gitService';
55
import { Logger } from '../logger';
66
import { Telemetry } from '../telemetry';
@@ -21,6 +21,8 @@ export enum Commands {
2121
DiffWithWorking = 'gitlens.diffWithWorking',
2222
DiffLineWithWorking = 'gitlens.diffLineWithWorking',
2323
ExternalDiff = 'gitlens.externalDiff',
24+
ExplorersOpenDirectoryDiff = 'gitlens.explorers.openDirectoryDiff',
25+
ExplorersOpenDirectoryDiffWithWorking = 'gitlens.explorers.openDirectoryDiffWithWorking',
2426
OpenChangedFiles = 'gitlens.openChangedFiles',
2527
OpenBranchesInRemote = 'gitlens.openBranchesInRemote',
2628
OpenBranchInRemote = 'gitlens.openBranchInRemote',
@@ -94,12 +96,12 @@ export function isCommandViewContextWithBranch(context: CommandContext): context
9496
return context.type === 'view' && (context.node as any).branch && (context.node as any).branch instanceof GitBranch;
9597
}
9698

97-
interface ICommandViewContextWithCommit<T extends GitCommit> extends CommandViewContext {
98-
node: (ExplorerNode & { commit: T });
99+
export function isCommandViewContextWithCommit<T extends GitCommit>(context: CommandContext): context is CommandViewContext & { node: (ExplorerNode & { commit: T }) } {
100+
return context.type === 'view' && (context.node as any).commit && (context.node as any).commit instanceof GitCommit;
99101
}
100102

101-
export function isCommandViewContextWithCommit<T extends GitCommit>(context: CommandContext): context is ICommandViewContextWithCommit<T> {
102-
return context.type === 'view' && (context.node as any).commit && (context.node as any).commit instanceof GitCommit;
103+
export function isCommandViewContextWithRef(context: CommandContext): context is CommandViewContext & { node: (ExplorerNode & { ref: string }) } {
104+
return context.type === 'view' && (context.node instanceof ExplorerRefNode);
103105
}
104106

105107
export function isCommandViewContextWithRemote(context: CommandContext): context is CommandViewContext & { node: (ExplorerNode & { remote: GitRemote }) } {

0 commit comments

Comments
 (0)