Sfoglia il codice sorgente

Adds ability to hide a whole remote from the graph

main
Eric Amodio 2 anni fa
parent
commit
9e05a9c450
2 ha cambiato i file con 21 aggiunte e 6 eliminazioni
  1. +15
    -1
      package.json
  2. +6
    -5
      src/plus/webviews/graph/graphWebview.ts

+ 15
- 1
package.json Vedi File

@ -6359,6 +6359,11 @@
"category": "GitLens"
},
{
"command": "gitlens.graph.hideRemote",
"title": "Hide Remote",
"category": "GitLens"
},
{
"command": "gitlens.graph.hideTag",
"title": "Hide Tag",
"category": "GitLens"
@ -8400,6 +8405,10 @@
"when": "false"
},
{
"command": "gitlens.graph.hideRemote",
"when": "false"
},
{
"command": "gitlens.graph.hideTag",
"when": "false"
},
@ -11039,12 +11048,17 @@
{
"command": "gitlens.graph.hideLocalBranch",
"when": "webviewItem =~ /gitlens:branch\\b(?!.*?\\b\\+(current|remote)\\b)/",
"group": "8_gitlens_actions@11"
},
{
"command": "gitlens.graph.hideRemote",
"when": "webviewItem =~ /gitlens:branch\\b(?=.*?\\b\\+remote\\b)(?!.*?\\b\\+current\\b)/",
"group": "8_gitlens_actions@10"
},
{
"command": "gitlens.graph.hideRemoteBranch",
"when": "webviewItem =~ /gitlens:branch\\b(?=.*?\\b\\+remote\\b)(?!.*?\\b\\+current\\b)/",
"group": "8_gitlens_actions@10"
"group": "8_gitlens_actions@11"
},
{
"command": "gitlens.graph.hideRefGroup",

+ 6
- 5
src/plus/webviews/graph/graphWebview.ts Vedi File

@ -326,8 +326,9 @@ export class GraphWebview extends WebviewBase {
registerCommand('gitlens.graph.hideLocalBranch', this.hideRef, this),
registerCommand('gitlens.graph.hideRemoteBranch', this.hideRef, this),
registerCommand('gitlens.graph.hideRemote', item => this.hideRef(item, { remote: true }), this),
registerCommand('gitlens.graph.hideRefGroup', item => this.hideRef(item, { group: true }), this),
registerCommand('gitlens.graph.hideTag', this.hideRef, this),
registerCommand('gitlens.graph.hideRefGroup', item => this.hideRef(item, true), this),
registerCommand('gitlens.graph.cherryPick', this.cherryPick, this),
registerCommand('gitlens.graph.copyRemoteCommitUrl', item => this.openCommitOnRemote(item, true), this),
@ -1654,11 +1655,11 @@ export class GraphWebview extends WebviewBase {
}
@debug()
private hideRef(item: GraphItemContext, group?: boolean) {
private hideRef(item: GraphItemContext, options?: { group?: boolean; remote?: boolean }) {
let refs;
if (group && isGraphItemRefGroupContext(item)) {
if (options?.group && isGraphItemRefGroupContext(item)) {
({ refs } = item.webviewItemGroupValue);
} else if (!group && isGraphItemRefContext(item)) {
} else if (!options?.group && isGraphItemRefContext(item)) {
const { ref } = item.webviewItemValue;
if (ref.id != null) {
refs = [ref];
@ -1671,7 +1672,7 @@ export class GraphWebview extends WebviewBase {
const remoteBranch = r.refType === 'branch' && r.remote;
return {
id: r.id!,
name: remoteBranch ? getBranchNameWithoutRemote(r.name) : r.name,
name: remoteBranch ? (options?.remote ? '*' : getBranchNameWithoutRemote(r.name)) : r.name,
owner: remoteBranch ? getRemoteNameFromBranchName(r.name) : undefined,
type: r.refType === 'branch' ? (r.remote ? 'remote' : 'head') : 'tag',
};

Caricamento…
Annulla
Salva