Skip to content

Commit f2c2bad

Browse files
committed
Closes #690 - reworks reference pickers
Removes "Branch or Tag" from all commands Changes openFileRevisionFrom allow entering references Fixes missing views.compare.selectForCompare from command palette
1 parent 6158ff4 commit f2c2bad

24 files changed

+210
-194
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,22 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
2525

2626
### Changed
2727

28+
- Changes _Open Revision from..._ (`gitlens.openFileRevisionFrom`) command to allow entering references
2829
- Improves the behavior of the _Show More Commits_ & _Show More Results_ commands - no longer loses the context of the last selected item before showing more
2930
- Improves the behavior of the _Open Changes with Next Revision_ (`gitlens.diffWithNext`) command when in the diff editor
3031
- Improves the behavior of the _Open Changes with Previous Revision_ (`gitlens.diffWithPrevious`) command when in the diff editor
3132
- Improves the behavior of the _Open Changes with Working File_ (`gitlens.diffWithWorking`) command when in the diff editor
33+
- Renames _Compare HEAD with Branch or Tag..._ (`gitlens.diffHeadWithBranch`) command to _Compare HEAD with..._ (`gitlens.diffHeadWith`)
34+
- Renames _Compare Working Tree with Branch or Tag..._ (`gitlens.diffWorkingWithBranch`) command to _Compare Working Tree with..._ (`gitlens.diffWorkingWith`)
35+
- Renames _Open Changes with Branch or Tag..._ (`gitlens.diffWithBranch`) command to _Open Changes with..._ (`gitlens.diffWithRef`)
36+
- Renames _Open Revision from Branch or Tag..._ (`gitlens.openFileRevisionFromBranch`) command to _Open Revision from..._ (`gitlens.openFileRevisionFrom`)
37+
- Renames _Compare Branch or Tag with..._ (`gitlens.views.compare.selectForCompare`) command to _Compare References..._ (`gitlens.views.compare.selectForCompare`)
38+
- Renames _Choose from Branch or Tag History..._ quick pick item to _Show File History from..._ for better clarity and to reflect that references are now allowed
3239
- Updates the invite link to the [VS Code Development Community Slack](https://vscode-slack.amod.io)
3340

3441
### Removed
3542

43+
- Removes the requirement of prefixing reference comparisons with `#` — closes [#690](https://github.com/eamodio/vscode-gitlens/issues/690)
3644
- Removes the automatic suspension of the current line blame annotations while debugging — closes [#382](https://github.com/eamodio/vscode-gitlens/issues/382)
3745

3846
### Fixed
@@ -41,6 +49,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
4149
- Fixes [#683](https://github.com/eamodio/vscode-gitlens/issues/683) - log.showSignature leads to stray files being displayed
4250
- Fixes [#691](https://github.com/eamodio/vscode-gitlens/issues/691) - Auto-expand tree view on Swap Comparison
4351
- Fixes the behavior of the _Open Line Changes with Previous Revision_ (`gitlens.diffLineWithPrevious`) command to follow the line history much better
52+
- Fixes missing _Compare References..._ (`gitlens.views.compare.selectForCompare`) from the command palette
4453

4554
## [9.5.1] - 2019-02-13
4655

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ The search commits view provides the following features,
442442

443443
A [customizable](#compare-view-settings- 'Jump to the Compare view settings') view to visualize comparisons between branches, tags, commits, and more
444444

445-
- A toolbar provides quick access to the _Compare Branch or Tag with..._, _Keep Results_, _Clear Results_, and _Refresh_ commands
445+
- A toolbar provides quick access to the _Compare with..._, _Keep Results_, _Clear Results_, and _Refresh_ commands
446446
- A context menu provides _Automatic Layout_, _List Layout_, _Tree Layout_, _Open Settings_ commands
447447

448448
The compare view provides the following features,
@@ -593,13 +593,13 @@ The compare view provides the following features,
593593

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

596-
- 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 or tag
596+
- Adds a _Directory Compare Working Tree with..._ command (`gitlens.diffDirectory`) to open the configured Git difftool to compare the working tree with the selected reference
597597

598-
- Adds a _Compare HEAD with Branch or Tag..._ command (`gitlens.diffHeadWithBranch`) to compare the index (HEAD) with the selected branch or tag
598+
- Adds a _Compare HEAD with..._ command (`gitlens.diffHeadWith`) to compare the index (HEAD) with the selected reference
599599

600-
- Adds a _Compare Working Tree with Branch or Tag..._ command (`gitlens.diffWorkingWithBranch`) to compare the working tree with the selected branch or tag
600+
- Adds a _Compare Working Tree with..._ command (`gitlens.diffWorkingWith`) to compare the working tree with the selected reference
601601

602-
- Adds an _Open Changes with Branch or Tag..._ command (`gitlens.diffWithBranch`) to compare the current file with the same file on the selected branch or tag
602+
- Adds an _Open Changes with..._ command (`gitlens.diffWithRef`) to compare the current file with the same file on the selected reference
603603

604604
- Adds an _Open Changes with Next Revision_ command (`gitlens.diffWithNext`) with a shortcut of `alt+.` to compare the current file/diff with the next commit revision
605605

@@ -625,7 +625,7 @@ The compare view provides the following features,
625625

626626
- Adds an _Open Revision..._ command (`gitlens.openFileRevision`) to open the selected revision for the current file
627627

628-
- Adds an _Open Revision from Branch or Tag..._ command (`gitlens.openFileRevisionFromBranch`) to open the revision of the current file from the selected branch
628+
- Adds an _Open Revision from..._ command (`gitlens.openFileRevisionFrom`) to open the revision of the current file from the selected reference
629629

630630
- Adds an _Open Changes (with difftool)_ command (`gitlens.externalDiff`) to the source control group and source control resource context menus to open the changes of a file or set of files with the configured git difftool
631631

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,18 +1834,18 @@
18341834
"category": "GitLens"
18351835
},
18361836
{
1837-
"command": "gitlens.diffHeadWithBranch",
1838-
"title": "Compare HEAD with Branch or Tag...",
1837+
"command": "gitlens.diffHeadWith",
1838+
"title": "Compare HEAD with...",
18391839
"category": "GitLens"
18401840
},
18411841
{
1842-
"command": "gitlens.diffWorkingWithBranch",
1843-
"title": "Compare Working Tree with Branch or Tag...",
1842+
"command": "gitlens.diffWorkingWith",
1843+
"title": "Compare Working Tree with...",
18441844
"category": "GitLens"
18451845
},
18461846
{
1847-
"command": "gitlens.diffWithBranch",
1848-
"title": "Open Changes with Branch or Tag...",
1847+
"command": "gitlens.diffWithRef",
1848+
"title": "Open Changes with...",
18491849
"category": "GitLens"
18501850
},
18511851
{
@@ -2138,8 +2138,8 @@
21382138
"category": "GitLens"
21392139
},
21402140
{
2141-
"command": "gitlens.openFileRevisionFromBranch",
2142-
"title": "Open Revision from Branch or Tag...",
2141+
"command": "gitlens.openFileRevisionFrom",
2142+
"title": "Open Revision from...",
21432143
"category": "GitLens"
21442144
},
21452145
{
@@ -2704,7 +2704,7 @@
27042704
},
27052705
{
27062706
"command": "gitlens.views.compare.selectForCompare",
2707-
"title": "Compare Branch or Tag with...",
2707+
"title": "Compare References...",
27082708
"category": "GitLens",
27092709
"icon": {
27102710
"dark": "images/dark/icon-compare-refs.svg",
@@ -2904,15 +2904,15 @@
29042904
"when": "gitlens:enabled"
29052905
},
29062906
{
2907-
"command": "gitlens.diffHeadWithBranch",
2907+
"command": "gitlens.diffHeadWith",
29082908
"when": "gitlens:enabled"
29092909
},
29102910
{
2911-
"command": "gitlens.diffWorkingWithBranch",
2911+
"command": "gitlens.diffWorkingWith",
29122912
"when": "gitlens:enabled"
29132913
},
29142914
{
2915-
"command": "gitlens.diffWithBranch",
2915+
"command": "gitlens.diffWithRef",
29162916
"when": "gitlens:activeFileStatus =~ /tracked/"
29172917
},
29182918
{
@@ -3088,7 +3088,7 @@
30883088
"when": "gitlens:activeFileStatus =~ /tracked/"
30893089
},
30903090
{
3091-
"command": "gitlens.openFileRevisionFromBranch",
3091+
"command": "gitlens.openFileRevisionFrom",
30923092
"when": "gitlens:activeFileStatus =~ /tracked/"
30933093
},
30943094
{
@@ -3421,7 +3421,7 @@
34213421
},
34223422
{
34233423
"command": "gitlens.views.compare.selectForCompare",
3424-
"when": "gitlens:enabled && gitlens.views.compare.enabled"
3424+
"when": "gitlens:enabled && config.gitlens.views.compare.enabled"
34253425
},
34263426
{
34273427
"command": "gitlens.views.compare.clear",
@@ -3758,7 +3758,7 @@
37583758
"group": "1_gitlens@1"
37593759
},
37603760
{
3761-
"command": "gitlens.diffWithBranch",
3761+
"command": "gitlens.diffWithRef",
37623762
"when": "gitlens:enabled && config.gitlens.menus.scmItem.compare",
37633763
"group": "1_gitlens@2"
37643764
},

src/commands.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ export * from './commands/common';
66
export * from './commands/copyMessageToClipboard';
77
export * from './commands/copyRemoteFileUrlToClipboard';
88
export * from './commands/copyShaToClipboard';
9-
export * from './commands/diffBranchWithBranch';
9+
export * from './commands/diffBranchWith';
1010
export * from './commands/diffDirectory';
1111
export * from './commands/diffLineWithPrevious';
1212
export * from './commands/diffLineWithWorking';
1313
export * from './commands/diffWith';
14-
export * from './commands/diffWithBranch';
1514
export * from './commands/diffWithNext';
1615
export * from './commands/diffWithPrevious';
16+
export * from './commands/diffWithRef';
1717
export * from './commands/diffWithRevision';
1818
export * from './commands/diffWithWorking';
1919
export * from './commands/externalDiff';
@@ -23,7 +23,7 @@ export * from './commands/openChangedFiles';
2323
export * from './commands/openCommitInRemote';
2424
export * from './commands/openFileInRemote';
2525
export * from './commands/openFileRevision';
26-
export * from './commands/openFileRevisionFromBranch';
26+
export * from './commands/openFileRevisionFrom';
2727
export * from './commands/openInRemote';
2828
export * from './commands/openRepoInRemote';
2929
export * from './commands/openWorkingFile';

src/commands/common.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,17 @@ export enum Commands {
3131
CopyShaToClipboard = 'gitlens.copyShaToClipboard',
3232
DiffDirectory = 'gitlens.diffDirectory',
3333
DiffDirectoryWithHead = 'gitlens.diffDirectoryWithHead',
34+
DiffHeadWith = 'gitlens.diffHeadWith',
35+
// DEPRECATED
3436
DiffHeadWithBranch = 'gitlens.diffHeadWithBranch',
37+
DiffWorkingWith = 'gitlens.diffWorkingWith',
38+
// DEPRECATED
3539
DiffWorkingWithBranch = 'gitlens.diffWorkingWithBranch',
3640
ExternalDiffAll = 'gitlens.externalDiffAll',
3741
DiffWith = 'gitlens.diffWith',
42+
// DEPRECATED
3843
DiffWithBranch = 'gitlens.diffWithBranch',
44+
DiffWithRef = 'gitlens.diffWithRef',
3945
DiffWithNext = 'gitlens.diffWithNext',
4046
DiffWithNextInDiff = 'gitlens.diffWithNextInDiff',
4147
DiffWithPrevious = 'gitlens.diffWithPrevious',
@@ -53,6 +59,8 @@ export enum Commands {
5359
OpenCommitInRemote = 'gitlens.openCommitInRemote',
5460
OpenFileInRemote = 'gitlens.openFileInRemote',
5561
OpenFileRevision = 'gitlens.openFileRevision',
62+
OpenFileRevisionFrom = 'gitlens.openFileRevisionFrom',
63+
// DEPRECATED
5664
OpenFileRevisionFromBranch = 'gitlens.openFileRevisionFromBranch',
5765
OpenInRemote = 'gitlens.openInRemote',
5866
OpenRepoInRemote = 'gitlens.openRepoInRemote',

src/commands/diffBranchWithBranch.ts renamed to src/commands/diffBranchWith.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { GlyphChars } from '../constants';
44
import { Container } from '../container';
55
import { Logger } from '../logger';
66
import { Messages } from '../messages';
7-
import { BranchesAndTagsQuickPick, CommandQuickPickItem } from '../quickpicks';
7+
import { CommandQuickPickItem, ReferencesQuickPick } from '../quickpicks';
88
import {
99
ActiveEditorCommand,
1010
command,
@@ -14,23 +14,30 @@ import {
1414
getRepoPathOrActiveOrPrompt
1515
} from './common';
1616

17-
export interface DiffBranchWithBranchCommandArgs {
17+
export interface DiffBranchWithCommandArgs {
1818
ref1?: string;
1919
ref2?: string;
2020
}
2121

2222
@command()
23-
export class DiffBranchWithBranchCommand extends ActiveEditorCommand {
23+
export class DiffBranchWithCommand extends ActiveEditorCommand {
2424
constructor() {
25-
super([Commands.DiffHeadWithBranch, Commands.DiffWorkingWithBranch]);
25+
super([
26+
Commands.DiffHeadWith,
27+
Commands.DiffWorkingWith,
28+
Commands.DiffHeadWithBranch,
29+
Commands.DiffWorkingWithBranch
30+
]);
2631
}
2732

28-
protected preExecute(context: CommandContext, args: DiffBranchWithBranchCommandArgs = {}) {
33+
protected preExecute(context: CommandContext, args: DiffBranchWithCommandArgs = {}) {
2934
switch (context.command) {
35+
case Commands.DiffHeadWith:
3036
case Commands.DiffHeadWithBranch:
3137
args.ref2 = 'HEAD';
3238
break;
3339

40+
case Commands.DiffWorkingWith:
3441
case Commands.DiffWorkingWithBranch:
3542
args.ref2 = '';
3643
break;
@@ -39,7 +46,7 @@ export class DiffBranchWithBranchCommand extends ActiveEditorCommand {
3946
return this.execute(context.editor, context.uri, args);
4047
}
4148

42-
async execute(editor?: TextEditor, uri?: Uri, args: DiffBranchWithBranchCommandArgs = {}) {
49+
async execute(editor?: TextEditor, uri?: Uri, args: DiffBranchWithCommandArgs = {}) {
4350
if (args.ref2 === undefined) return undefined;
4451

4552
uri = getCommandUri(uri, editor);
@@ -48,7 +55,7 @@ export class DiffBranchWithBranchCommand extends ActiveEditorCommand {
4855
const repoPath = await getRepoPathOrActiveOrPrompt(
4956
uri,
5057
editor,
51-
`Compare with branch or tag in which repository${GlyphChars.Ellipsis}`
58+
`Compare in which repository${GlyphChars.Ellipsis}`
5259
);
5360
if (!repoPath) return undefined;
5461

@@ -66,8 +73,8 @@ export class DiffBranchWithBranchCommand extends ActiveEditorCommand {
6673
break;
6774
}
6875

69-
const pick = await new BranchesAndTagsQuickPick(repoPath).show(placeHolder, {
70-
allowCommitId: true
76+
const pick = await new ReferencesQuickPick(repoPath).show(placeHolder, {
77+
allowEnteringRefs: true
7178
});
7279
if (pick === undefined) return undefined;
7380

src/commands/diffDirectory.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { BuiltInCommands, GlyphChars } from '../constants';
44
import { Container } from '../container';
55
import { Logger } from '../logger';
66
import { Messages } from '../messages';
7-
import { BranchesAndTagsQuickPick, CommandQuickPickItem } from '../quickpicks';
7+
import { CommandQuickPickItem, ReferencesQuickPick } from '../quickpicks';
88
import { CompareResultsNode } from '../views/nodes';
99
import {
1010
ActiveEditorCommand,
@@ -71,9 +71,9 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
7171
if (!args.ref1) {
7272
args = { ...args };
7373

74-
const pick = await new BranchesAndTagsQuickPick(repoPath).show(
74+
const pick = await new ReferencesQuickPick(repoPath).show(
7575
`Compare Working Tree with${GlyphChars.Ellipsis}`,
76-
{ allowCommitId: true }
76+
{ allowEnteringRefs: true }
7777
);
7878
if (pick === undefined) return undefined;
7979

src/commands/diffWithBranch.ts renamed to src/commands/diffWithRef.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ import { GlyphChars } from '../constants';
55
import { Container } from '../container';
66
import { GitService, GitUri } from '../git/gitService';
77
import { Messages } from '../messages';
8-
import { BranchesAndTagsQuickPick, CommandQuickPickItem } from '../quickpicks';
8+
import { CommandQuickPickItem, ReferencesQuickPick } from '../quickpicks';
99
import { Strings } from '../system';
1010
import { ActiveEditorCommand, command, Commands, getCommandUri } from './common';
1111
import { DiffWithCommandArgs } from './diffWith';
1212

13-
export interface DiffWithBranchCommandArgs {
13+
export interface DiffWithRefCommandArgs {
1414
line?: number;
1515
showOptions?: TextDocumentShowOptions;
1616

1717
goBackCommand?: CommandQuickPickItem;
1818
}
1919

2020
@command()
21-
export class DiffWithBranchCommand extends ActiveEditorCommand {
21+
export class DiffWithRefCommand extends ActiveEditorCommand {
2222
constructor() {
23-
super(Commands.DiffWithBranch);
23+
super([Commands.DiffWithRef, Commands.DiffWithBranch]);
2424
}
2525

26-
async execute(editor?: TextEditor, uri?: Uri, args: DiffWithBranchCommandArgs = {}) {
26+
async execute(editor?: TextEditor, uri?: Uri, args: DiffWithRefCommandArgs = {}) {
2727
uri = getCommandUri(uri, editor);
2828
if (uri == null) return undefined;
2929

@@ -35,10 +35,10 @@ export class DiffWithBranchCommand extends ActiveEditorCommand {
3535
const gitUri = await GitUri.fromUri(uri);
3636
if (!gitUri.repoPath) return Messages.showNoRepositoryWarningMessage('Unable to open file compare');
3737

38-
const pick = await new BranchesAndTagsQuickPick(gitUri.repoPath).show(
38+
const pick = await new ReferencesQuickPick(gitUri.repoPath).show(
3939
`Compare ${paths.basename(gitUri.fsPath)} with${GlyphChars.Ellipsis}`,
4040
{
41-
allowCommitId: true,
41+
allowEnteringRefs: true,
4242
goBack: args.goBackCommand
4343
}
4444
);

0 commit comments

Comments
 (0)