Browse Source

Closes #569 - Adds directory compare with head command

main
Eric Amodio 6 years ago
parent
commit
1fc6ac322c
5 changed files with 46 additions and 13 deletions
  1. +10
    -0
      CHANGELOG.md
  2. +17
    -3
      package.json
  3. +1
    -0
      src/commands/common.ts
  4. +11
    -1
      src/commands/diffDirectory.ts
  5. +7
    -9
      src/commands/externalDiff.ts

+ 10
- 0
CHANGELOG.md View File

@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- Adds a _Directory Compare All Changes_ (`gitlens.diffDirectoryWithHead`) command to open the configured git difftool to compare the working directory with HEAD — closes [#569](https://github.com/eamodio/vscode-gitlens/issues/569)
### Changed
- Renames _Open Changes (with difftool)_ command to _Open All Changes (with difftool)_ when shown on the SCM group context menu
## [9.0.1] - 2018-12-02
### Fixed

+ 17
- 3
package.json View File

@ -1644,6 +1644,11 @@
"category": "GitLens"
},
{
"command": "gitlens.diffDirectoryWithHead",
"title": "Directory Compare All Changes",
"category": "GitLens"
},
{
"command": "gitlens.diffHeadWithBranch",
"title": "Compare HEAD with Branch or Tag...",
"category": "GitLens"
@ -2587,6 +2592,10 @@
"when": "gitlens:enabled"
},
{
"command": "gitlens.diffDirectoryWithHead",
"when": "gitlens:enabled"
},
{
"command": "gitlens.diffHeadWithBranch",
"when": "gitlens:enabled"
},
@ -3319,14 +3328,19 @@
"group": "2_gitlens@2"
},
{
"command": "gitlens.externalDiff",
"command": "gitlens.externalDiffAll",
"when": "gitlens:enabled",
"group": "2_gitlens@3"
"group": "3_gitlens@3"
},
{
"command": "gitlens.diffDirectoryWithHead",
"when": "gitlens:enabled",
"group": "3_gitlens@4"
},
{
"command": "gitlens.stashSave",
"when": "gitlens:enabled && !gitlens:readonly",
"group": "3_gitlens@1"
"group": "4_gitlens@1"
}
],
"scm/resourceState/context": [

+ 1
- 0
src/commands/common.ts View File

@ -30,6 +30,7 @@ export enum Commands {
CopyRemoteFileUrlToClipboard = 'gitlens.copyRemoteFileUrlToClipboard',
CopyShaToClipboard = 'gitlens.copyShaToClipboard',
DiffDirectory = 'gitlens.diffDirectory',
DiffDirectoryWithHead = 'gitlens.diffDirectoryWithHead',
DiffHeadWithBranch = 'gitlens.diffHeadWithBranch',
DiffWorkingWithBranch = 'gitlens.diffWorkingWithBranch',
ExternalDiffAll = 'gitlens.externalDiffAll',

+ 11
- 1
src/commands/diffDirectory.ts View File

@ -24,11 +24,21 @@ export interface DiffDirectoryCommandArgs {
@command()
export class DiffDirectoryCommand extends ActiveEditorCommand {
constructor() {
super([Commands.DiffDirectory, Commands.ViewsOpenDirectoryDiff, Commands.ViewsOpenDirectoryDiffWithWorking]);
super([
Commands.DiffDirectory,
Commands.DiffDirectoryWithHead,
Commands.ViewsOpenDirectoryDiff,
Commands.ViewsOpenDirectoryDiffWithWorking
]);
}
protected async preExecute(context: CommandContext, args: DiffDirectoryCommandArgs = {}): Promise<any> {
switch (context.command) {
case Commands.DiffDirectoryWithHead:
args.ref1 = 'HEAD';
args.ref2 = undefined;
break;
case Commands.ViewsOpenDirectoryDiff:
if (context.type === 'viewItem' && context.node instanceof CompareResultsNode) {
args.ref1 = context.node.ref1.ref;

+ 7
- 9
src/commands/externalDiff.ts View File

@ -111,15 +111,13 @@ export class ExternalDiffCommand extends Command {
}
else if (context.type === 'scm-groups') {
args = { ...args };
args.files = Arrays.filterMap(
context.scmResourceGroups[0].resourceStates,
r =>
this.isModified(r)
? {
uri: r.resourceUri,
staged: (r as Resource).resourceGroupType === ResourceGroupType.Index
}
: undefined
args.files = Arrays.filterMap(context.scmResourceGroups[0].resourceStates, r =>
this.isModified(r)
? {
uri: r.resourceUri,
staged: (r as Resource).resourceGroupType === ResourceGroupType.Index
}
: undefined
);
}
}

Loading…
Cancel
Save