ソースを参照

Adds swap comparision command to results view

main
Eric Amodio 6年前
コミット
7a61eb1f40
10個のファイルの変更53行の追加9行の削除
  1. +3
    -2
      CHANGELOG.md
  2. +6
    -1
      README.md
  3. +3
    -0
      images/dark/icon-swap.svg
  4. +3
    -0
      images/light/icon-swap.svg
  5. +26
    -3
      package.json
  6. +1
    -1
      src/views/commitsResultsNode.ts
  7. +1
    -1
      src/views/comparisonResultsNode.ts
  8. +2
    -0
      src/views/explorerNode.ts
  9. +7
    -0
      src/views/resultsExplorer.ts
  10. +1
    -1
      src/views/statusFilesResultsNode.ts

+ 3
- 2
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

+ 6
- 1
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

+ 3
- 0
images/dark/icon-swap.svg ファイルの表示

@ -0,0 +1,3 @@
<svg width="16" height="22" xmlns="http://www.w3.org/2000/svg">
<path fill="#C5C5C5" d="M8.27 6.03a8.61 8.61 0 0 0-1.3 1.37c0 .48 2.68 2.57 3.36 2.57.86 0 1-.41.24-1.03-.89-.72-.58-1.03 1.03-1.03 1.13 0 1.55.14 1.55.52 0 .27.24.51.5.51.35 0 .52.35.52 1.03 0 .69-.17 1.03-.51 1.03a.53.53 0 0 0-.52.51c0 .72-2.91.72-3.22 0-.1-.27-.58-.51-1.06-.51-.55 0-.86-.2-.86-.51 0-.35-.34-.52-1.03-.52-.68 0-1.03-.17-1.03-.51 0-.38-.41-.52-1.54-.52-1.13 0-1.55.14-1.55.52 0 .27-.24.51-.5.51a.53.53 0 0 0-.52.52c0 .27-.24.51-.52.51-.34 0-.51.34-.51 1.03s.17 1.03.51 1.03c.28 0 .52.24.52.51 0 .28.24.52.51.52s.52.24.52.51c0 .38.4.52 1.54.52 1.61 0 1.92.3 1.03 1.03-.76.61-.62 1.02.27 1.02.65 0 3.33-2.09 3.33-2.57s-2.68-2.57-3.33-2.57c-.89 0-1.03.41-.27 1.03.89.72.58 1.03-1.03 1.03-1.13 0-1.55-.14-1.55-.52a.53.53 0 0 0-.5-.51c-.35 0-.52-.35-.52-1.03 0-.69.17-1.03.51-1.03.27 0 .52-.24.52-.51 0-.72 2.91-.72 3.22 0 .1.27.58.51 1.06.51.55 0 .86.2.86.51 0 .35.34.52 1.03.52s1.03.17 1.03.51c0 .38.41.52 1.54.52 1.13 0 1.55-.14 1.55-.52 0-.27.24-.51.5-.51.28 0 .52-.24.52-.52 0-.27.24-.51.52-.51.34 0 .51-.34.51-1.03s-.17-1.03-.51-1.03a.53.53 0 0 1-.52-.51.53.53 0 0 0-.51-.52.53.53 0 0 1-.52-.51c0-.38-.4-.52-1.54-.52-1.61 0-1.92-.3-1.03-1.02.76-.62.62-1.03-.24-1.03-.44 0-1.37.54-2.06 1.2z"/>
</svg>

+ 3
- 0
images/light/icon-swap.svg ファイルの表示

@ -0,0 +1,3 @@
<svg width="16" height="22" xmlns="http://www.w3.org/2000/svg">
<path fill="#424242" d="M8.27 6.03a8.61 8.61 0 0 0-1.3 1.37c0 .48 2.68 2.57 3.36 2.57.86 0 1-.41.24-1.03-.89-.72-.58-1.03 1.03-1.03 1.13 0 1.55.14 1.55.52 0 .27.24.51.5.51.35 0 .52.35.52 1.03 0 .69-.17 1.03-.51 1.03a.53.53 0 0 0-.52.51c0 .72-2.91.72-3.22 0-.1-.27-.58-.51-1.06-.51-.55 0-.86-.2-.86-.51 0-.35-.34-.52-1.03-.52-.68 0-1.03-.17-1.03-.51 0-.38-.41-.52-1.54-.52-1.13 0-1.55.14-1.55.52 0 .27-.24.51-.5.51a.53.53 0 0 0-.52.52c0 .27-.24.51-.52.51-.34 0-.51.34-.51 1.03s.17 1.03.51 1.03c.28 0 .52.24.52.51 0 .28.24.52.51.52s.52.24.52.51c0 .38.4.52 1.54.52 1.61 0 1.92.3 1.03 1.03-.76.61-.62 1.02.27 1.02.65 0 3.33-2.09 3.33-2.57s-2.68-2.57-3.33-2.57c-.89 0-1.03.41-.27 1.03.89.72.58 1.03-1.03 1.03-1.13 0-1.55-.14-1.55-.52a.53.53 0 0 0-.5-.51c-.35 0-.52-.35-.52-1.03 0-.69.17-1.03.51-1.03.27 0 .52-.24.52-.51 0-.72 2.91-.72 3.22 0 .1.27.58.51 1.06.51.55 0 .86.2.86.51 0 .35.34.52 1.03.52s1.03.17 1.03.51c0 .38.41.52 1.54.52 1.13 0 1.55-.14 1.55-.52 0-.27.24-.51.5-.51.28 0 .52-.24.52-.52 0-.27.24-.51.52-.51.34 0 .51-.34.51-1.03s-.17-1.03-.51-1.03a.53.53 0 0 1-.52-.51.53.53 0 0 0-.51-.52.53.53 0 0 1-.52-.51c0-.38-.4-.52-1.54-.52-1.61 0-1.92-.3-1.03-1.02.76-.62.62-1.03-.24-1.03-.44 0-1.37.54-2.06 1.2z"/>
</svg>

+ 26
- 3
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"

+ 1
- 1
src/views/commitsResultsNode.ts ファイルの表示

@ -16,7 +16,7 @@ export class CommitsResultsNode extends ExplorerNode {
private readonly labelFn: (log: GitLog | undefined) => Promise<string>,
private readonly logFn: (maxCount: number | undefined) => Promise<GitLog | undefined>,
private readonly explorer: Explorer,
private readonly contextValue: ResourceType = ResourceType.Results
private readonly contextValue: ResourceType = ResourceType.ResultsCommits
) {
super(GitUri.fromRepoPath(repoPath));
}

+ 1
- 1
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

+ 2
- 0
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',

+ 7
- 0
src/views/resultsExplorer.ts ファイルの表示

@ -36,6 +36,7 @@ export class ResultsExplorer extends Disposable implements TreeDataProvider
commands.registerCommand('gitlens.resultsExplorer.close', this.close, this);
commands.registerCommand('gitlens.resultsExplorer.setKeepResultsToOn', () => 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
Container.context.workspaceState.update(WorkspaceState.ResultsExplorerKeepResults, enabled);
setCommandContext(CommandContext.ResultsExplorerKeepResults, enabled);
}
private swapComparision(node: ExplorerNode) {
if (!(node instanceof ComparisonResultsNode)) return;
this.showComparisonInResults(node.repoPath, node.ref2, node.ref1);
}
}

+ 1
- 1
src/views/statusFilesResultsNode.ts ファイルの表示

@ -49,7 +49,7 @@ export class StatusFilesResultsNode extends ExplorerNode {
const diff = await this.getDiff();
const item = new TreeItem(await this.getLabel(), diff && diff.length > 0 ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.None);
item.contextValue = ResourceType.Results;
item.contextValue = ResourceType.ResultsFiles;
return item;
}

読み込み中…
キャンセル
保存