Browse Source

💄

main
Eric Amodio 2 years ago
parent
commit
ab4796c3b3
4 changed files with 39 additions and 26 deletions
  1. +19
    -17
      src/env/node/git/localGitProvider.ts
  2. +14
    -2
      src/git/models/reference.ts
  3. +3
    -6
      src/plus/webviews/graph/graphWebview.ts
  4. +3
    -1
      src/webviews/apps/plus/graph/graph.tsx

+ 19
- 17
src/env/node/git/localGitProvider.ts View File

@ -1893,23 +1893,25 @@ export class LocalGitProvider implements GitProvider, Disposable {
}), }),
}, },
}), }),
contextGroup: groupedRefs.length > 0
? serializeWebviewItemContext<GraphItemRefContext>({
webviewItem: `gitlens:branch+grouped${head ? '+current' : ''}${
branch?.upstream != null ? '+tracking' : ''
}`,
webviewItemValue: {
type: 'branch',
ref: GitReference.create(tip, repoPath, {
id: branchId,
refType: 'branch',
name: tip,
remote: false,
upstream: branch?.upstream,
groupedRefs: groupedRefs,
}),
},
}) : undefined,
contextGroup:
groupedRefs.length > 0
? serializeWebviewItemContext<GraphItemRefContext>({
webviewItem: `gitlens:branch+grouped${head ? '+current' : ''}${
branch?.upstream != null ? '+tracking' : ''
}`,
webviewItemValue: {
type: 'branch',
ref: GitReference.create(tip, repoPath, {
id: branchId,
refType: 'branch',
name: tip,
remote: false,
upstream: branch?.upstream,
groupedRefs: groupedRefs,
}),
},
})
: undefined,
}); });
} }
} }

+ 14
- 2
src/git/models/reference.ts View File

@ -144,7 +144,12 @@ export interface GitTagReference {
repoPath: string; repoPath: string;
} }
export type GitReference = GitBranchReference | GraphGitBranchReference | GitRevisionReference | GitStashReference | GitTagReference;
export type GitReference =
| GitBranchReference
| GraphGitBranchReference
| GitRevisionReference
| GitStashReference
| GitTagReference;
export namespace GitReference { export namespace GitReference {
export function create( export function create(
@ -179,7 +184,14 @@ export namespace GitReference {
ref: string, ref: string,
repoPath: string, repoPath: string,
options: options:
| { id?: string; refType: 'branch'; name: string; remote: boolean; avatarUrl?: string; groupedRefs?: GitReference[] }
| {
id?: string;
refType: 'branch';
name: string;
remote: boolean;
avatarUrl?: string;
groupedRefs?: GitReference[];
}
| { refType?: 'revision'; name?: string; message?: string } | { refType?: 'revision'; name?: string; message?: string }
| { refType: 'stash'; name: string; number: string | undefined; message?: string } | { refType: 'stash'; name: string; number: string | undefined; message?: string }
| { id?: string; refType: 'tag'; name: string } = { refType: 'revision' }, | { id?: string; refType: 'tag'; name: string } = { refType: 'revision' },

+ 3
- 6
src/plus/webviews/graph/graphWebview.ts View File

@ -1,4 +1,4 @@
import type { GraphRefType} from '@gitkraken/gitkraken-components';
import type { GraphRefType } from '@gitkraken/gitkraken-components';
import type { import type {
ColorTheme, ColorTheme,
ConfigurationChangeEvent, ConfigurationChangeEvent,
@ -1125,7 +1125,7 @@ export class GraphWebview extends WebviewBase {
} }
private async getHiddenRefsById( private async getHiddenRefsById(
hiddenRefs: Record<string, GraphHiddenRef> | undefined
hiddenRefs: Record<string, GraphHiddenRef> | undefined,
): Promise<GraphHiddenRefs | undefined> { ): Promise<GraphHiddenRefs | undefined> {
if (hiddenRefs == null) return undefined; if (hiddenRefs == null) return undefined;
@ -1629,10 +1629,7 @@ export class GraphWebview extends WebviewBase {
if (isGraphItemRefContext(item)) { if (isGraphItemRefContext(item)) {
const { ref } = item.webviewItemValue; const { ref } = item.webviewItemValue;
const groupedRefs: GitReference[] = (ref as any).groupedRefs ?? []; const groupedRefs: GitReference[] = (ref as any).groupedRefs ?? [];
const refsToHide: GitReference[] = [
...groupedRefs,
ref
];
const refsToHide: GitReference[] = [...groupedRefs, ref];
const graphHiddenRefs: GraphHiddenRef[] = []; const graphHiddenRefs: GraphHiddenRef[] = [];
for (const refToHide of refsToHide) { for (const refToHide of refsToHide) {

+ 3
- 1
src/webviews/apps/plus/graph/graph.tsx View File

@ -87,7 +87,9 @@ export class GraphApp extends App {
(name, settings) => this.onColumnChanged(name, settings), (name, settings) => this.onColumnChanged(name, settings),
250, 250,
)} )}
onRefsVisibilityChange={(refs: GraphHiddenRef[], visible: boolean) => this.onRefsVisibilityChanged(refs, visible)}
onRefsVisibilityChange={(refs: GraphHiddenRef[], visible: boolean) =>
this.onRefsVisibilityChanged(refs, visible)
}
onSelectRepository={debounce<GraphApp['onRepositorySelectionChanged']>( onSelectRepository={debounce<GraphApp['onRepositorySelectionChanged']>(
path => this.onRepositorySelectionChanged(path), path => this.onRepositorySelectionChanged(path),
250, 250,

Loading…
Cancel
Save