Browse Source

Fixes Share as Cloud Patch being broken in the graph

main
Ramin Tadayon 1 year ago
parent
commit
f4d58edc50
No known key found for this signature in database GPG Key ID: 79D60DDE3DFB95F5
2 changed files with 23 additions and 1 deletions
  1. +10
    -1
      package.json
  2. +13
    -0
      src/plus/webviews/graph/graphWebview.ts

+ 10
- 1
package.json View File

@ -8229,6 +8229,11 @@
"category": "GitLens"
},
{
"command": "gitlens.graph.shareAsCloudPatch",
"title": "Share as Cloud Patch...",
"category": "GitLens"
},
{
"command": "gitlens.timeline.refresh",
"title": "Refresh",
"category": "GitLens",
@ -10753,6 +10758,10 @@
"when": "false"
},
{
"command": "gitlens.graph.shareAsCloudPatch",
"when": "false"
},
{
"command": "gitlens.enableDebugLogging",
"when": "config.gitlens.outputLevel != debug"
},
@ -13986,7 +13995,7 @@
"group": "1_a_gitlens@1"
},
{
"command": "gitlens.shareAsCloudPatch",
"command": "gitlens.graph.shareAsCloudPatch",
"when": "!gitlens:untrusted && !gitlens:hasVirtualFolders && config.gitlens.cloudPatches.enabled && webviewItem =~ /gitlens:(commit|stash)\\b/",
"group": "1_a_gitlens@1"
},

+ 13
- 0
src/plus/webviews/graph/graphWebview.ts View File

@ -8,6 +8,7 @@ import type { CopyMessageToClipboardCommandArgs } from '../../../commands/copyMe
import type { CopyShaToClipboardCommandArgs } from '../../../commands/copyShaToClipboard';
import type { OpenOnRemoteCommandArgs } from '../../../commands/openOnRemote';
import type { OpenPullRequestOnRemoteCommandArgs } from '../../../commands/openPullRequestOnRemote';
import type { CreatePatchCommandArgs } from '../../../commands/patches';
import type { ShowCommitsInViewCommandArgs } from '../../../commands/showCommitsInView';
import type { Config, GraphMinimapMarkersAdditionalTypes, GraphScrollMarkersAdditionalTypes } from '../../../config';
import type { StoredGraphFilters, StoredGraphIncludeOnlyRef, StoredGraphRefType } from '../../../constants';
@ -530,6 +531,7 @@ export class GraphWebviewProvider implements WebviewProvider
this.host.registerWebviewCommand('gitlens.graph.copyDeepLinkToCommit', this.copyDeepLinkToCommit),
this.host.registerWebviewCommand('gitlens.graph.copyDeepLinkToRepo', this.copyDeepLinkToRepo),
this.host.registerWebviewCommand('gitlens.graph.copyDeepLinkToTag', this.copyDeepLinkToTag),
this.host.registerWebviewCommand('gitlens.graph.shareAsCloudPatch', this.shareAsCloudPatch),
this.host.registerWebviewCommand('gitlens.graph.openChangedFiles', this.openFiles),
this.host.registerWebviewCommand('gitlens.graph.openOnlyChangedFiles', this.openOnlyChangedFiles),
@ -2436,6 +2438,17 @@ export class GraphWebviewProvider implements WebviewProvider
}
@debug()
private async shareAsCloudPatch(item?: GraphItemContext) {
const ref = this.getGraphItemRef(item, 'revision') ?? this.getGraphItemRef(item, 'stash');
if (ref == null) return Promise.resolve();
return executeCommand<CreatePatchCommandArgs>(Commands.CreateCloudPatch, {
ref1: ref.ref,
repoPath: ref.repoPath,
});
}
@debug()
private resetCommit(item?: GraphItemContext) {
const ref = this.getGraphItemRef(item, 'revision');
if (ref == null) return Promise.resolve();

Loading…
Cancel
Save