Ver código fonte

Adds Open on Remote to root comparison

main
Eric Amodio 1 ano atrás
pai
commit
1399d7cff1
3 arquivos alterados com 20 adições e 5 exclusões
  1. +9
    -3
      package.json
  2. +8
    -2
      src/commands/openComparisonOnRemote.ts
  3. +3
    -0
      src/views/nodes/viewNode.ts

+ 9
- 3
package.json Ver arquivo

@ -12964,9 +12964,15 @@
"group": "1_gitlens_actions@2"
},
{
"command": "gitlens.openComparisonOnRemote",
"when": "viewItem =~ /gitlens:compare:results(?!:)\\b/",
"group": "2_gitlens_quickopen@1 && gitlens:hasRemotes",
"alt": "gitlens.copyRemoteComparisonUrl"
},
{
"command": "gitlens.views.openDirectoryDiff",
"when": "viewItem =~ /gitlens:compare:results(?!:)\\b/",
"group": "2_gitlens_quickopen@1"
"group": "2_gitlens_quickopen@2"
},
{
"command": "gitlens.views.setResultsCommitsFilterOff",
@ -12990,13 +12996,13 @@
},
{
"command": "gitlens.openComparisonOnRemote",
"when": "viewItem =~ /gitlens:compare:results:commits\\b/",
"when": "viewItem =~ /gitlens:compare:results:commits\\b/ && gitlens:hasRemotes",
"group": "inline@99",
"alt": "gitlens.copyRemoteComparisonUrl"
},
{
"command": "gitlens.openComparisonOnRemote",
"when": "viewItem =~ /gitlens:compare:results:commits\\b/",
"when": "viewItem =~ /gitlens:compare:results:commits\\b/ && gitlens:hasRemotes",
"group": "3_gitlens_explore@0",
"alt": "gitlens.copyRemoteComparisonUrl"
},

+ 8
- 2
src/commands/openComparisonOnRemote.ts Ver arquivo

@ -4,7 +4,6 @@ import { RemoteResourceType } from '../git/models/remoteResource';
import { showGenericErrorMessage } from '../messages';
import { command, executeCommand } from '../system/command';
import { Logger } from '../system/logger';
import { ResultsCommitsNode } from '../views/nodes/resultsCommitsNode';
import type { CommandContext } from './base';
import { Command } from './base';
import type { OpenOnRemoteCommandArgs } from './openOnRemote';
@ -25,13 +24,20 @@ export class OpenComparisonOnRemoteCommand extends Command {
protected override preExecute(context: CommandContext, args?: OpenComparisonOnRemoteCommandArgs) {
if (context.type === 'viewItem') {
if (context.node instanceof ResultsCommitsNode) {
if (context.node.is('results-commits')) {
args = {
...args,
repoPath: context.node.repoPath,
ref1: context.node.ref1,
ref2: context.node.ref2,
};
} else if (context.node.is('compare-results')) {
args = {
...args,
repoPath: context.node.repoPath,
ref1: context.node.ahead.ref1,
ref2: context.node.ahead.ref2,
};
}
}

+ 3
- 0
src/views/nodes/viewNode.ts Ver arquivo

@ -47,6 +47,7 @@ import type { FolderNode } from './folderNode';
import type { LineHistoryTrackerNode } from './lineHistoryTrackerNode';
import type { MergeConflictFileNode } from './mergeConflictFileNode';
import type { RepositoryNode } from './repositoryNode';
import type { ResultsCommitsNode } from './resultsCommitsNode';
import type { ResultsFileNode } from './resultsFileNode';
import type { StashFileNode } from './stashFileNode';
import type { StashNode } from './stashNode';
@ -857,6 +858,8 @@ type TreeViewNodesByType = {
? RepositoryNode
: T extends 'repo-folder'
? RepositoryFolderNode
: T extends 'results-commits'
? ResultsCommitsNode
: T extends 'results-file'
? ResultsFileNode
: T extends 'stash'

Carregando…
Cancelar
Salvar