From b58dc49d07e46c949ed29ee29df4501c29e6f157 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Fri, 31 Aug 2018 23:37:39 -0400 Subject: [PATCH] Adds diffWithWorking to editor toolbar when diffing Renanes "Compare x with" commands --- CHANGELOG.md | 17 +++++++-- README.md | 34 ++++++++--------- images/dark/icon-compare.svg | 4 ++ images/light/icon-compare.svg | 4 ++ package.json | 70 +++++++++++++++++------------------ src/quickpicks/commitFileQuickPick.ts | 2 +- 6 files changed, 75 insertions(+), 56 deletions(-) create mode 100644 images/dark/icon-compare.svg create mode 100644 images/light/icon-compare.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 426c7ae..d7b239e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] +### Added + +- Adds _Open Changes with Working File_ (`gitlens.diffWithWorking`) command to the editor toolbar when comparing revisions + ### Changed +- Renames _Compare File with Branch or Tag..._ (`gitlens.diffWithBranch`) command to _Open Changes with Branch or Tag..._ +- Renames _Compare File with Next Revision_ (`gitlens.diffWithNext`) command to _Open Changes with Next Revision_ +- Renames _Compare File with Previous Revision_ (`gitlens.diffWithPrevious`) command to _Open Changes with Previous Revision_ +- Renames _Compare Commit with Previous_ (`gitlens.diffLineWithPrevious`) command to _Open Line Changes with Previous Revision_ +- Renames _Compare File with Revision..._ (`gitlens.diffWithRevision`) command to _Open Changes with Revision..._ +- Renames _Compare File with Working Revision_ (`gitlens.diffWithWorking`) command to _Open Changes with Working File_ +- Renames _Compare Commit with Working File_ (`gitlens.diffLineWithWorking`) command to _Open Line Changes with Working File_ - Switches to use the new git extension's api to get the git path ### Fixed @@ -1212,10 +1223,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ![Hover Annotations](https://raw.githubusercontent.com/eamodio/vscode-gitlens/master/images/ss-hovers-annotations.png) - Adds the following command-links to the **details** hover annotation - - Clicking the commit id will run the _Show Commit Details_ command (`gitlens.showQuickCommitDetails`) + - Clicking the commit id will run the _Show Commit Details_ command - Adds the following command-links to the **changes** hover annotation - - Clicking on **Changes** will run the _Compare File Revisions_ command (`gitlens.diffWith`) - - Clicking the current and previous commit ids will run the _Show Commit Details_ command (`gitlens.showQuickCommitDetails`) + - Clicking on **Changes** will run the _Open Changes_ command + - Clicking the current and previous commit ids will run the _Show Commit Details_ command - Adds support for remote services with custom domains — closes [#120](https://github.com/eamodio/vscode-gitlens/issues/120) - Adds support for the Bitbucket Server (previously called Stash) remote service — closes [#120](https://github.com/eamodio/vscode-gitlens/issues/120) diff --git a/README.md b/README.md index e0798d1..a0ec12c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ - Adds _Compare with Selected_ and _Select for Compare_ commands to file nodes in the _GitLens_, _GitLens File History_, and _GitLens Results_ explorers — closes [#446](https://github.com/eamodio/vscode-gitlens/issues/446) - Adds tag annotations to the tag tooltips in the _GitLens_ explorer — closes [#431](https://github.com/eamodio/vscode-gitlens/issues/431) - Adds _Choose from Branch or Tag History..._ to the quick pick menu shown by the _Show File History..._ command (`gitlens.showQuickFileHistory`) — closes [#316](https://github.com/eamodio/vscode-gitlens/issues/316) -- Adds the _Compare File with Revision..._ command (`gitlens.diffWithRevision`) as an alternate (`alt+click`) for the _Compare File with Previous Revision_ command in the editor toolbar +- Adds the _Open Changes with Revision..._ command (`gitlens.diffWithRevision`) as an alternate (`alt+click`) for the _Open Changes with Previous Revision_ command in the editor toolbar - Adds _Checkout Commit (via Terminal)_ command (`gitlens.terminalCheckoutCommit`) to commit node(s) of the _GitLens_ explorer — closes [#463](https://github.com/eamodio/vscode-gitlens/issues/463) - Adds `gitlens.historyExplorer.avatars` setting to specify whether to show avatar images instead of status icons in the _GitLens File History_ explorer — allows for an independent value from the other explorers - Adds a `gitlens.hovers.avatars` setting to specify whether to show avatar images in hovers — closes [#432](https://github.com/eamodio/vscode-gitlens/issues/432) thanks to [PR #441](https://github.com/eamodio/vscode-gitlens/pull/441) by Segev Finer ([@segevfiner](https://github.com/segevfiner)) @@ -32,7 +32,7 @@ - Changes commit search by sha to jump directly to the commit (if one is found), rather than having to click through to the commit - Renames the _GitLens History_ explorer to _GitLens File History_ explorer for better clarity - Changes the _GitLens File History_ explorer to always show the full file history even when reviewing revisions -- Changes the behavior of and renames the _Show Branches and Tags_ command and on the quick pick menu shown by the _Compare File with Revision..._ command (`gitlens.diffWithRevision`) to _Choose from Branch or Tag History..._ +- Changes the behavior of and renames the _Show Branches and Tags_ command and on the quick pick menu shown by the _Open Changes with Revision..._ command (`gitlens.diffWithRevision`) to _Choose from Branch or Tag History..._ - Changes the behavior of and renames the _Show Branches and Tags_ command on the quick pick menu shown by the _Open Revision..._ command (`gitlens.openFileRevision`) to _Choose from Branch or Tag History..._ - Changes _Rebase to Commit (via Terminal)_ command (`gitlens.terminalRebaseCommit`) to apply to all commit node(s) of the _GitLens_ explorer - Changes _Reset to Commit (via Terminal)_ command (`gitlens.terminalResetCommit`) to apply to all commit node(s) of the _GitLens_ explorer @@ -57,8 +57,8 @@ - Fixes [#482](https://github.com/eamodio/vscode-gitlens/issues/482) - UI displays "undefined" in results panel when comparing - Fixes issues with GitLens Welcome and the interactive settings editor with light themes - Fixes issue where commands in the editor toolbar would flash unnecessarily when navigating history or switching tabs -- Fixes issue where the _Compare File with Previous Revision_ command wouldn't work properly when the file had been renamed in some cases -- Fixes issue where the _Compare File with Next Revision_ command wouldn't work properly when the file had been renamed in some cases +- Fixes issue where the _Open Changes with Previous Revision_ command wouldn't work properly when the file had been renamed in some cases +- Fixes issue where the _Open Changes with Next Revision_ command wouldn't work properly when the file had been renamed in some cases - Fixes issue where changed files count was wrong when the branch was behind the upstream - Fixes issue where the _GitLens File History_ explorer wasn't being updated automatically for working changes - Fixes issue where the _Compare File with \* Revision_ commands in the editor toolbar would show and hide too often because of insignificant focus changes @@ -393,7 +393,7 @@ An on-demand, [customizable](#gitlens-results-explorer-settings 'Jump to the Git - Adds a **details hover** annotation to the current line to show more commit details ([optional](#hover-settings 'Jump to the Hover settings'), on by default) - Provides automatic issue linking to Bitbucket, GitHub, GitLab, and Visual Studio Team Services in commit messages - Provides a **quick-access command bar** with _Open Changes_, _Blame Previous Revision_, _Open in Remote_, and _Show More Actions_ command buttons - - Click the commit id to execute the _Show Commit Details_ command (`gitlens.showQuickCommitDetails`) + - Click the commit id to execute the _Show Commit Details_ command ##### Changes (diff) Hover @@ -402,8 +402,8 @@ An on-demand, [customizable](#gitlens-results-explorer-settings 'Jump to the Git

- Adds a **changes (diff) hover** annotation to the current line to show the line's previous version ([optional](#hover-settings 'Jump to the Hover settings'), on by default) - - Click the **Changes** to execute the _Compare File Revisions_ command (`gitlens.diffWith`) - - Click the current and previous commit ids to execute the _Show Commit Details_ command (`gitlens.showQuickCommitDetails`) + - Click the **Changes** to execute the _Open Changes_ command + - Click the current and previous commit ids to execute the _Show Commit Details_ command #### Annotation Hovers @@ -422,7 +422,7 @@ An on-demand, [customizable](#gitlens-results-explorer-settings 'Jump to the Git - Adds a **details hover** annotation to each line while annotating to show more commit details ([optional](#hover-settings 'Jump to the Hover settings'), on by default) - Provides automatic issue linking to Bitbucket, GitHub, GitLab, and Visual Studio Team Services in commit messages - Provides a **quick-access command bar** with _Open Changes_, _Blame Previous Revision_, _Open in Remote_, and _Show More Actions_ command buttons - - Click the commit id to execute the _Show Commit Details_ command (`gitlens.showQuickCommitDetails`) + - Click the commit id to execute the _Show Commit Details_ command ##### Changes (diff) Hover @@ -431,8 +431,8 @@ An on-demand, [customizable](#gitlens-results-explorer-settings 'Jump to the Git

- Adds a **changes (diff) hover** annotation to each line while annotating to show the line's previous version ([optional](#hover-settings 'Jump to the Hover settings'), on by default) - - Click the **Changes** to execute the _Compare File Revisions_ command (`gitlens.diffWith`) - - Click the current and previous commit ids to execute the _Show Commit Details_ command (`gitlens.showQuickCommitDetails`) + - Click the **Changes** to execute the _Open Changes_ command + - Click the current and previous commit ids to execute the _Show Commit Details_ command --- @@ -615,19 +615,19 @@ An on-demand, [customizable](#gitlens-results-explorer-settings 'Jump to the Git - Adds a _Compare Working Tree with Branch or Tag..._ command (`gitlens.diffWorkingWithBranch`) to compare the working tree with the selected branch or tag -- Adds a _Compare File with Branch or Tag..._ command (`gitlens.diffWithBranch`) to compare the current file with the same file on the selected branch or tag +- Adds a _Open Changes with Branch or Tag..._ command (`gitlens.diffWithBranch`) to compare the current file with the same file on the selected branch or tag -- Adds a _Compare File with Next Revision_ command (`gitlens.diffWithNext`) with a shortcut of `alt+.` to compare the current file/diff with the next commit revision +- Adds a _Open Changes with Next Revision_ command (`gitlens.diffWithNext`) with a shortcut of `alt+.` to compare the current file/diff with the next commit revision -- Adds a _Compare File with Previous Revision_ command (`gitlens.diffWithPrevious`) with a shortcut of `alt+,` to compare the current file/diff with the previous commit revision +- Adds a _Open Changes with Previous Revision_ command (`gitlens.diffWithPrevious`) with a shortcut of `alt+,` to compare the current file/diff with the previous commit revision -- Adds a _Compare Line Revision with Previous_ command (`gitlens.diffLineWithPrevious`) with a shortcut of `shift+alt+,` to compare the current file/diff with the previous line commit revision +- Adds a _Open Line Changes with Previous Revision_ command (`gitlens.diffLineWithPrevious`) with a shortcut of `shift+alt+,` to compare the current file/diff with the previous line commit revision -- Adds a _Compare File with Revision..._ command (`gitlens.diffWithRevision`) to compare the current file with the selected revision of the same file +- Adds a _Open Changes with Revision..._ command (`gitlens.diffWithRevision`) to compare the current file with the selected revision of the same file -- Adds a _Compare File with Working Revision_ command (`gitlens.diffWithWorking`) with a shortcut of `shift+alt+w` to compare the most recent commit revision of the current file/diff with the working tree +- Adds a _Open Changes with Working File_ command (`gitlens.diffWithWorking`) with a shortcut of `shift+alt+w` to compare the most recent commit revision of the current file/diff with the working tree -- Adds a _Compare Line Revision with Working File_ command (`gitlens.diffLineWithWorking`) with a shortcut of `alt+w` to compare the commit revision of the current line with the working tree +- Adds a _Open Line Changes with Working File_ command (`gitlens.diffLineWithWorking`) with a shortcut of `alt+w` to compare the commit revision of the current line with the working tree --- diff --git a/images/dark/icon-compare.svg b/images/dark/icon-compare.svg new file mode 100644 index 0000000..a920e58 --- /dev/null +++ b/images/dark/icon-compare.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/images/light/icon-compare.svg b/images/light/icon-compare.svg new file mode 100644 index 0000000..e825363 --- /dev/null +++ b/images/light/icon-compare.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/package.json b/package.json index 9e6947b..b123d85 100644 --- a/package.json +++ b/package.json @@ -1528,18 +1528,13 @@ "category": "GitLens" }, { - "command": "gitlens.diffWith", - "title": "Compare File Revisions", - "category": "GitLens" - }, - { "command": "gitlens.diffWithBranch", - "title": "Compare File with Branch or Tag...", + "title": "Open Changes with Branch or Tag...", "category": "GitLens" }, { "command": "gitlens.diffWithNext", - "title": "Compare File with Next Revision", + "title": "Open Changes with Next Revision", "category": "GitLens", "icon": { "dark": "images/dark/icon-next-commit.svg", @@ -1548,7 +1543,7 @@ }, { "command": "gitlens.diffWithPrevious", - "title": "Compare File with Previous Revision", + "title": "Open Changes with Previous Revision", "category": "GitLens", "icon": { "dark": "images/dark/icon-prev-commit.svg", @@ -1557,7 +1552,7 @@ }, { "command": "gitlens.diffWithPreviousInDiff", - "title": "Compare File with Previous Revision", + "title": "Open Changes with Previous Revision", "category": "GitLens", "icon": { "dark": "images/dark/icon-prev-commit.svg", @@ -1566,12 +1561,12 @@ }, { "command": "gitlens.diffLineWithPrevious", - "title": "Compare Commit with Previous", + "title": "Open Line Changes with Previous Revision", "category": "GitLens" }, { "command": "gitlens.diffWithRevision", - "title": "Compare File with Revision...", + "title": "Open Changes with Revision...", "category": "GitLens", "icon": { "dark": "images/dark/icon-prev-commit-menu.svg", @@ -1580,12 +1575,16 @@ }, { "command": "gitlens.diffWithWorking", - "title": "Compare File with Working Revision", - "category": "GitLens" + "title": "Open Changes with Working File", + "category": "GitLens", + "icon": { + "dark": "images/dark/icon-compare.svg", + "light": "images/light/icon-compare.svg" + } }, { "command": "gitlens.diffLineWithWorking", - "title": "Compare Commit with Working File", + "title": "Open Line Changes with Working File", "category": "GitLens" }, { @@ -2204,10 +2203,6 @@ "when": "gitlens:enabled" }, { - "command": "gitlens.diffWith", - "when": "false" - }, - { "command": "gitlens.diffWithBranch", "when": "gitlens:activeFileStatus =~ /tracked/" }, @@ -2694,35 +2689,40 @@ ], "editor/title": [ { - "command": "gitlens.diffWithPrevious", - "alt": "gitlens.diffWithRevision", - "when": "!isInDiffEditor && gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare", - "group": "navigation@97" - }, - { - "command": "gitlens.diffWithPreviousInDiff", - "alt": "gitlens.diffWithRevision", - "when": "isInDiffEditor && gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare", - "group": "navigation@97" - }, - { - "command": "gitlens.diffWithNext", - "when": "gitlens:activeFileStatus =~ /tracked/ && gitlens:activeFileStatus =~ /tracked/ && gitlens:activeFileStatus =~ /revision/ && config.gitlens.menus.editorGroup.compare", - "group": "navigation@98" + "command": "gitlens.diffWithWorking", + "when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git", + "group": "navigation@0" }, { "command": "gitlens.openWorkingFile", "when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git", - "group": "navigation@99" + "group": "navigation@0" }, { "command": "gitlens.openWorkingFile", "when": "!gitlens:activeFileStatus =~ /revision/ && resourceScheme != git && isInDiffEditor", - "group": "navigation@99" + "group": "navigation@0" }, { "command": "gitlens.openWorkingFile", "when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme == git && !isInDiffEditor", + "group": "navigation@0" + }, + { + "command": "gitlens.diffWithPrevious", + "alt": "gitlens.diffWithRevision", + "when": "!isInDiffEditor && gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare", + "group": "navigation@98" + }, + { + "command": "gitlens.diffWithPreviousInDiff", + "alt": "gitlens.diffWithRevision", + "when": "isInDiffEditor && gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare", + "group": "navigation@98" + }, + { + "command": "gitlens.diffWithNext", + "when": "gitlens:activeFileStatus =~ /tracked/ && gitlens:activeFileStatus =~ /tracked/ && gitlens:activeFileStatus =~ /revision/ && config.gitlens.menus.editorGroup.compare", "group": "navigation@99" }, { diff --git a/src/quickpicks/commitFileQuickPick.ts b/src/quickpicks/commitFileQuickPick.ts index a8df7ae..ebe4e30 100644 --- a/src/quickpicks/commitFileQuickPick.ts +++ b/src/quickpicks/commitFileQuickPick.ts @@ -142,7 +142,7 @@ export class CommitFileQuickPick { items.push( new CommandQuickPickItem( { - label: `$(git-compare) Open Changes with Working Tree`, + label: `$(git-compare) Open Changes with Working File`, description: `${Strings.pad(GlyphChars.Dash, 2, 3)} $(git-commit) ${commit.shortSha} ${ GlyphChars.Space } $(git-compare) ${GlyphChars.Space} $(file-text) ${workingName}`