Browse Source

Adds opening/showing specific commit in the Graph

- Adds Show Commit in Graph to the Commit Details view
Attempts to fix Graph data paging using `--boundary`
main
Eric Amodio 2 years ago
parent
commit
084f580fc4
15 changed files with 237 additions and 44 deletions
  1. +1
    -0
      src/constants.ts
  2. +14
    -0
      src/env/node/git/git.ts
  3. +153
    -15
      src/env/node/git/localGitProvider.ts
  4. +1
    -0
      src/git/models/graph.ts
  5. +2
    -1
      src/git/parsers/logParser.ts
  6. +3
    -2
      src/plus/github/githubGitProvider.ts
  7. +22
    -5
      src/plus/webviews/graph/graphWebview.ts
  8. +1
    -0
      src/plus/webviews/graph/protocol.ts
  9. +14
    -3
      src/webviews/apps/commitDetails/commitDetails.html
  10. +8
    -16
      src/webviews/apps/commitDetails/commitDetails.ts
  11. +4
    -0
      src/webviews/apps/plus/graph/GraphWrapper.tsx
  12. +4
    -0
      src/webviews/apps/shared/components/codicon.ts
  13. +1
    -1
      src/webviews/apps/shared/theme.ts
  14. +8
    -0
      src/webviews/commitDetails/commitDetailsWebviewView.ts
  15. +1
    -1
      src/webviews/commitDetails/protocol.ts

+ 1
- 0
src/constants.ts View File

@ -163,6 +163,7 @@ export const enum Commands {
SearchCommitsInView = 'gitlens.views.searchAndCompare.searchCommits', SearchCommitsInView = 'gitlens.views.searchAndCompare.searchCommits',
SetViewsLayout = 'gitlens.setViewsLayout', SetViewsLayout = 'gitlens.setViewsLayout',
ShowBranchesView = 'gitlens.showBranchesView', ShowBranchesView = 'gitlens.showBranchesView',
ShowCommitInGraph = 'gitlens.showCommitInGraph',
ShowCommitInView = 'gitlens.showCommitInView', ShowCommitInView = 'gitlens.showCommitInView',
ShowCommitsInView = 'gitlens.showCommitsInView', ShowCommitsInView = 'gitlens.showCommitsInView',
ShowCommitsView = 'gitlens.showCommitsView', ShowCommitsView = 'gitlens.showCommitsView',

+ 14
- 0
src/env/node/git/git.ts View File

@ -769,6 +769,20 @@ export class Git {
); );
} }
log2(repoPath: string, ref: string | undefined, ...args: unknown[]) {
const params = ['log', ...args];
if (ref && !GitRevision.isUncommittedStaged(ref)) {
params.push(ref);
}
return this.git<string>(
{ cwd: repoPath, configs: ['-c', 'diff.renameLimit=0', '-c', 'log.showSignature=false'] },
...params,
'--',
);
}
log__file( log__file(
repoPath: string, repoPath: string,
fileName: string, fileName: string,

+ 153
- 15
src/env/node/git/localGitProvider.ts View File

@ -1609,8 +1609,75 @@ export class LocalGitProvider implements GitProvider, Disposable {
ref?: string; ref?: string;
}, },
): Promise<GitGraph> { ): Promise<GitGraph> {
const scope = getLogScope();
let getLogForRefFn;
if (options?.ref != null) {
async function getLogForRef(this: LocalGitProvider): Promise<GitLog | undefined> {
let log;
const parser = GitLogParser.create<{ sha: string; date: string }>({ sha: '%H', date: '%ct' });
const data = await this.git.log(repoPath, options?.ref, { argsOrFormat: parser.arguments, limit: 0 });
let commit = first(parser.parse(data));
if (commit != null) {
log = await this.getLog(repoPath, {
all: options!.mode !== 'single',
ordering: 'date',
limit: 0,
extraArgs: [`--since="${Number(commit.date)}"`, '--boundary'],
});
let found = log?.commits.has(commit.sha) ?? false;
if (!found) {
Logger.debug(scope, `Could not find commit ${options!.ref}`);
debugger;
}
if (log?.more != null) {
const defaultItemLimit = configuration.get('graph.defaultItemLimit');
if (!found || log.commits.size < defaultItemLimit) {
Logger.debug(scope, 'Loading next page...');
log = await log.more(
(log.commits.size < defaultItemLimit
? defaultItemLimit
: configuration.get('graph.pageItemLimit')) ?? options?.limit,
);
// We need to clear the "pagedCommits", since we want to return the entire set
if (log != null) {
(log as Mutable<typeof log>).pagedCommits = undefined;
}
found = log?.commits.has(commit.sha) ?? false;
if (!found) {
Logger.debug(scope, `Still could not find commit ${options!.ref}`);
commit = undefined;
debugger;
}
}
}
if (!found) {
commit = undefined;
}
options!.ref = commit?.sha;
}
return (
log ??
this.getLog(repoPath, { all: options?.mode !== 'single', ordering: 'date', limit: options?.limit })
);
}
getLogForRefFn = getLogForRef;
}
const [logResult, stashResult, remotesResult] = await Promise.allSettled([ const [logResult, stashResult, remotesResult] = await Promise.allSettled([
this.getLog(repoPath, { all: true, ordering: 'date', limit: options?.limit }),
getLogForRefFn?.call(this) ??
this.getLog(repoPath, { all: options?.mode !== 'single', ordering: 'date', limit: options?.limit }),
this.getStash(repoPath), this.getStash(repoPath),
this.getRemotes(repoPath), this.getRemotes(repoPath),
]); ]);
@ -1632,9 +1699,10 @@ export class LocalGitProvider implements GitProvider, Disposable {
stash: GitStash | undefined, stash: GitStash | undefined,
remotes: GitRemote[] | undefined, remotes: GitRemote[] | undefined,
options?: { options?: {
ref?: string;
mode?: 'single' | 'local' | 'all';
branch?: string; branch?: string;
limit?: number;
mode?: 'single' | 'local' | 'all';
ref?: string;
}, },
): Promise<GitGraph> { ): Promise<GitGraph> {
if (log == null) { if (log == null) {
@ -1763,6 +1831,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
more: log.hasMore, more: log.hasMore,
}, },
rows: rows, rows: rows,
sha: options?.ref,
more: async (limit: number | { until: string } | undefined): Promise<GitGraph | undefined> => { more: async (limit: number | { until: string } | undefined): Promise<GitGraph | undefined> => {
const moreLog = await log.more?.(limit); const moreLog = await log.more?.(limit);
@ -2256,23 +2325,79 @@ export class LocalGitProvider implements GitProvider, Disposable {
ref?: string; ref?: string;
since?: number | string; since?: number | string;
until?: number | string; until?: number | string;
extraArgs?: string[];
}, },
): Promise<GitLog | undefined> { ): Promise<GitLog | undefined> {
const scope = getLogScope(); const scope = getLogScope();
const limit = options?.limit ?? configuration.get('advanced.maxListItems') ?? 0;
try { try {
const limit = options?.limit ?? configuration.get('advanced.maxListItems') ?? 0;
const merges = options?.merges == null ? true : options.merges;
const ordering = options?.ordering ?? configuration.get('advanced.commitOrdering');
const similarityThreshold = configuration.get('advanced.similarityThreshold');
const args = [
`--format=${options?.all ? GitLogParser.allFormat : GitLogParser.defaultFormat}`,
'--name-status',
'--full-history',
`-M${similarityThreshold == null ? '' : `${similarityThreshold}%`}`,
'-m',
];
if (options?.all) {
args.push('--all');
}
if (!merges) {
args.push('--first-parent');
}
if (ordering) {
args.push(`--${ordering}-order`);
}
if (options?.authors?.length) {
args.push(
'--use-mailmap',
'--author',
...options.authors.map(a => `--author=^${a.name} <${a.email}>$`),
);
}
let hasMoreOverride;
if (options?.since) {
hasMoreOverride = true;
args.push(`--since="${options.since}"`);
}
if (options?.until) {
hasMoreOverride = true;
args.push(`--until="${options.until}"`);
}
if (options?.extraArgs?.length) {
if (
options.extraArgs.some(
arg => arg.startsWith('-n') || arg.startsWith('--until=') || arg.startsWith('--since='),
)
) {
hasMoreOverride = true;
}
args.push(...options.extraArgs);
}
if (limit) {
hasMoreOverride = undefined;
args.push(`-n${limit + 1}`);
}
const data = await this.git.log2(repoPath, options?.ref, ...args);
// const parser = GitLogParser.defaultParser; // const parser = GitLogParser.defaultParser;
const data = await this.git.log(repoPath, options?.ref, {
...options,
// args: parser.arguments,
limit: limit,
merges: options?.merges == null ? true : options.merges,
ordering: options?.ordering ?? configuration.get('advanced.commitOrdering'),
similarityThreshold: configuration.get('advanced.similarityThreshold'),
});
// const data = await this.git.log2(repoPath, options?.ref, {
// ...options,
// // args: parser.arguments,
// limit: limit,
// merges: options?.merges == null ? true : options.merges,
// ordering: options?.ordering ?? configuration.get('advanced.commitOrdering'),
// similarityThreshold: configuration.get('advanced.similarityThreshold'),
// });
// const commits = []; // const commits = [];
// const entries = parser.parse(data); // const entries = parser.parse(data);
@ -2311,12 +2436,18 @@ export class LocalGitProvider implements GitProvider, Disposable {
limit, limit,
false, false,
undefined, undefined,
hasMoreOverride,
); );
if (log != null) { if (log != null) {
log.query = (limit: number | undefined) => this.getLog(repoPath, { ...options, limit: limit }); log.query = (limit: number | undefined) => this.getLog(repoPath, { ...options, limit: limit });
if (log.hasMore) { if (log.hasMore) {
log.more = this.getLogMoreFn(log, options);
let opts;
if (options != null) {
let extraArgs;
({ extraArgs, ...opts } = options);
}
log.more = this.getLogMoreFn(log, opts);
} }
} }
@ -2414,12 +2545,19 @@ export class LocalGitProvider implements GitProvider, Disposable {
...options, ...options,
limit: moreUntil == null ? moreLimit : 0, limit: moreUntil == null ? moreLimit : 0,
...(timestamp ...(timestamp
? { until: timestamp }
? {
until: timestamp,
extraArgs: ['--boundary'],
}
: { ref: moreUntil == null ? `${ref}^` : `${moreUntil}^..${ref}^` }), : { ref: moreUntil == null ? `${ref}^` : `${moreUntil}^..${ref}^` }),
}); });
// If we can't find any more, assume we have everything // If we can't find any more, assume we have everything
if (moreLog == null) return { ...log, hasMore: false, more: undefined }; if (moreLog == null) return { ...log, hasMore: false, more: undefined };
if (timestamp != null && ref != null && !moreLog.commits.has(ref)) {
debugger;
}
const commits = new Map([...log.commits, ...moreLog.commits]); const commits = new Map([...log.commits, ...moreLog.commits]);
const mergedLog: GitLog = { const mergedLog: GitLog = {

+ 1
- 0
src/git/models/graph.ts View File

@ -22,6 +22,7 @@ export interface GitGraphRow extends GraphRow {
export interface GitGraph { export interface GitGraph {
readonly repoPath: string; readonly repoPath: string;
readonly rows: GitGraphRow[]; readonly rows: GitGraphRow[];
readonly sha?: string;
readonly paging?: { readonly paging?: {
readonly limit: number | undefined; readonly limit: number | undefined;

+ 2
- 1
src/git/parsers/logParser.ts View File

@ -295,6 +295,7 @@ export class GitLogParser {
limit: number | undefined, limit: number | undefined,
reverse: boolean, reverse: boolean,
range: Range | undefined, range: Range | undefined,
hasMoreOverride?: boolean,
): GitLog | undefined { ): GitLog | undefined {
if (!data) return undefined; if (!data) return undefined;
@ -595,7 +596,7 @@ export class GitLogParser {
count: i, count: i,
limit: limit, limit: limit,
range: range, range: range,
hasMore: Boolean(truncationCount && i > truncationCount && truncationCount !== 1),
hasMore: hasMoreOverride ?? Boolean(truncationCount && i > truncationCount && truncationCount !== 1),
}; };
return log; return log;
} }

+ 3
- 2
src/plus/github/githubGitProvider.ts View File

@ -1076,9 +1076,10 @@ export class GitHubGitProvider implements GitProvider, Disposable {
remote: GitRemote | undefined, remote: GitRemote | undefined,
tags: GitTag[] | undefined, tags: GitTag[] | undefined,
options?: { options?: {
ref?: string;
mode?: 'single' | 'local' | 'all';
branch?: string; branch?: string;
limit?: number;
mode?: 'single' | 'local' | 'all';
ref?: string;
}, },
): Promise<GitGraph> { ): Promise<GitGraph> {
if (log == null) { if (log == null) {

+ 22
- 5
src/plus/webviews/graph/graphWebview.ts View File

@ -38,6 +38,10 @@ import {
UpdateSelectionCommandType, UpdateSelectionCommandType,
} from './protocol'; } from './protocol';
export interface ShowCommitInGraphCommandArgs {
sha: string;
}
export interface GraphSelectionChangeEvent { export interface GraphSelectionChangeEvent {
readonly selection: GitCommit[]; readonly selection: GitCommit[];
} }
@ -74,6 +78,7 @@ export class GraphWebview extends WebviewBase {
private _etagSubscription?: number; private _etagSubscription?: number;
private _etagRepository?: number; private _etagRepository?: number;
private _selectedSha?: string;
private _repositoryEventsDisposable: Disposable | undefined; private _repositoryEventsDisposable: Disposable | undefined;
private _repositoryGraph?: GitGraph; private _repositoryGraph?: GitGraph;
@ -101,6 +106,15 @@ export class GraphWebview extends WebviewBase {
}, },
}, },
this.container.subscription.onDidChange(this.onSubscriptionChanged, this), this.container.subscription.onDidChange(this.onSubscriptionChanged, this),
registerCommand(Commands.ShowCommitInGraph, (args: ShowCommitInGraphCommandArgs) => {
this._selectedSha = args.sha;
if (this._panel == null) {
void this.show();
} else {
// TODO@eamodio we should be smarter here an look for the commit in the saved data before refreshing and only send the selectedSha
this.updateState();
}
}),
); );
this.onConfigurationChanged(); this.onConfigurationChanged();
@ -123,7 +137,6 @@ export class GraphWebview extends WebviewBase {
} }
if (this.repository != null) { if (this.repository != null) {
this.resetRepositoryState();
this.updateState(); this.updateState();
} }
} }
@ -301,11 +314,12 @@ export class GraphWebview extends WebviewBase {
} }
private async onSelectionChanged(selection: string[]) { private async onSelectionChanged(selection: string[]) {
const ref = selection[0];
const sha = selection[0];
this._selectedSha = sha;
let commits: GitCommit[] | undefined; let commits: GitCommit[] | undefined;
if (ref != null) {
const commit = await this.repository?.getCommit(ref);
if (sha != null) {
const commit = await this.repository?.getCommit(sha);
if (commit != null) { if (commit != null) {
commits = [commit]; commits = [commit];
} }
@ -421,14 +435,16 @@ export class GraphWebview extends WebviewBase {
const data = await this.container.git.getCommitsForGraph( const data = await this.container.git.getCommitsForGraph(
this.repository.path, this.repository.path,
this._panel!.webview.asWebviewUri, this._panel!.webview.asWebviewUri,
{ limit: limit },
{ limit: limit, ref: this._selectedSha ?? 'HEAD' },
); );
this._repositoryGraph = data; this._repositoryGraph = data;
this._selectedSha = data.sha;
return { return {
previewBanner: this.previewBanner, previewBanner: this.previewBanner,
repositories: formatRepositories(this.container.git.openRepositories), repositories: formatRepositories(this.container.git.openRepositories),
selectedRepository: this.repository.path, selectedRepository: this.repository.path,
selectedSha: this._selectedSha,
selectedVisibility: access.visibility, selectedVisibility: access.visibility,
subscription: access.subscription.current, subscription: access.subscription.current,
allowed: access.allowed, allowed: access.allowed,
@ -445,6 +461,7 @@ export class GraphWebview extends WebviewBase {
private resetRepositoryState() { private resetRepositoryState() {
this._repositoryGraph = undefined; this._repositoryGraph = undefined;
this._selectedSha = undefined;
} }
} }

+ 1
- 0
src/plus/webviews/graph/protocol.ts View File

@ -7,6 +7,7 @@ import { IpcCommandType, IpcNotificationType } from '../../../webviews/protocol'
export interface State { export interface State {
repositories?: GraphRepository[]; repositories?: GraphRepository[];
selectedRepository?: string; selectedRepository?: string;
selectedSha?: string;
selectedVisibility?: RepositoryVisibility; selectedVisibility?: RepositoryVisibility;
subscription?: Subscription; subscription?: Subscription;
allowed?: boolean; allowed?: boolean;

+ 14
- 3
src/webviews/apps/commitDetails/commitDetails.html View File

@ -43,7 +43,7 @@
<a <a
class="commit-details__commit-action" class="commit-details__commit-action"
href="#" href="#"
data-action="commit-actions-pin"
data-action="pin"
aria-label="Pin Commit to View" aria-label="Pin Commit to View"
title="Pin Commit to View" title="Pin Commit to View"
><code-icon icon="pin" data-region="commit-pin"></code-icon ><code-icon icon="pin" data-region="commit-pin"></code-icon
@ -51,7 +51,8 @@
<a <a
class="commit-details__commit-action" class="commit-details__commit-action"
href="#" href="#"
data-action="commit-actions-sha"
data-action="commit-actions"
data-action-type="sha"
aria-label="Copy SHA aria-label="Copy SHA
[⌥] Pick Commit..." [⌥] Pick Commit..."
title="Copy SHA title="Copy SHA
@ -63,7 +64,17 @@
<a <a
class="commit-details__commit-action" class="commit-details__commit-action"
href="#" href="#"
data-action="commit-actions-more"
data-action="commit-actions"
data-action-type="graph"
aria-label="Show Commit on Commit Graph"
title="Show Commit on Commit Graph"
><code-icon icon="graph"></code-icon
></a>
<a
class="commit-details__commit-action"
href="#"
data-action="commit-actions"
data-action-type="more"
aria-label="Show Commit Actions" aria-label="Show Commit Actions"
title="Show Commit Actions" title="Show Commit Actions"
><code-icon icon="kebab-vertical"></code-icon ><code-icon icon="kebab-vertical"></code-icon

+ 8
- 16
src/webviews/apps/commitDetails/commitDetails.ts View File

@ -2,7 +2,7 @@
import type { Serialized } from '../../../system/serialize'; import type { Serialized } from '../../../system/serialize';
import type { IpcMessage } from '../../../webviews/protocol'; import type { IpcMessage } from '../../../webviews/protocol';
import { onIpc } from '../../../webviews/protocol'; import { onIpc } from '../../../webviews/protocol';
import type { State } from '../../commitDetails/protocol';
import type { CommitActionsParams, State } from '../../commitDetails/protocol';
import { import {
AutolinkSettingsCommandType, AutolinkSettingsCommandType,
CommitActionsCommandType, CommitActionsCommandType,
@ -64,8 +64,7 @@ export class CommitDetailsApp extends App> {
DOM.on<FileChangeItem, FileChangeItemEventDetail>('file-change-item', 'file-more-actions', e => DOM.on<FileChangeItem, FileChangeItemEventDetail>('file-change-item', 'file-more-actions', e =>
this.onFileMoreActions(e.detail), this.onFileMoreActions(e.detail),
), ),
DOM.on('[data-action="commit-actions-sha"]', 'click', e => this.onCommitShaActions(e)),
DOM.on('[data-action="commit-actions-more"]', 'click', e => this.onCommitMoreActions(e)),
DOM.on('[data-action="commit-actions"]', 'click', e => this.onCommitActions(e)),
DOM.on('[data-action="pick-commit"]', 'click', e => this.onPickCommit(e)), DOM.on('[data-action="pick-commit"]', 'click', e => this.onPickCommit(e)),
DOM.on('[data-action="search-commit"]', 'click', e => this.onSearchCommit(e)), DOM.on('[data-action="search-commit"]', 'click', e => this.onSearchCommit(e)),
DOM.on('[data-action="autolink-settings"]', 'click', e => this.onAutolinkSettings(e)), DOM.on('[data-action="autolink-settings"]', 'click', e => this.onAutolinkSettings(e)),
@ -82,7 +81,7 @@ export class CommitDetailsApp extends App> {
$next?.focus(); $next?.focus();
} }
}), }),
DOM.on('[data-action="commit-actions-pin"]', 'click', e => this.onTogglePin(e)),
DOM.on('[data-action="pin"]', 'click', e => this.onTogglePin(e)),
DOM.on<WebviewPane, WebviewPaneExpandedChangeEventDetail>( DOM.on<WebviewPane, WebviewPaneExpandedChangeEventDetail>(
'[data-region="rich-pane"]', '[data-region="rich-pane"]',
'expanded-change', 'expanded-change',
@ -173,24 +172,17 @@ export class CommitDetailsApp extends App> {
this.sendCommand(FileActionsCommandType, e); this.sendCommand(FileActionsCommandType, e);
} }
private onCommitMoreActions(e: MouseEvent) {
private onCommitActions(e: MouseEvent) {
e.preventDefault(); e.preventDefault();
if (this.state.selected === undefined) { if (this.state.selected === undefined) {
e.stopPropagation(); e.stopPropagation();
return; return;
} }
this.sendCommand(CommitActionsCommandType, { action: 'more' });
}
private onCommitShaActions(e: MouseEvent) {
e.preventDefault();
if (this.state.selected === undefined) {
e.stopPropagation();
return;
}
const action = (e.target as HTMLElement)?.getAttribute('data-action-type');
if (action == null) return;
this.sendCommand(CommitActionsCommandType, { action: 'sha', alt: e.altKey });
this.sendCommand(CommitActionsCommandType, { action: action as CommitActionsParams['action'], alt: e.altKey });
} }
renderCommit(state: Serialized<State>): state is CommitState { renderCommit(state: Serialized<State>): state is CommitState {
@ -228,7 +220,7 @@ export class CommitDetailsApp extends App> {
} }
renderPin(state: CommitState) { renderPin(state: CommitState) {
const $el = document.querySelector<HTMLElement>('[data-action="commit-actions-pin"]');
const $el = document.querySelector<HTMLElement>('[data-action="pin"]');
if ($el == null) { if ($el == null) {
return; return;
} }

+ 4
- 0
src/webviews/apps/plus/graph/GraphWrapper.tsx View File

@ -117,6 +117,7 @@ export function GraphWrapper({
repositories = [], repositories = [],
rows = [], rows = [],
selectedRepository, selectedRepository,
selectedSha,
subscription, subscription,
allowed, allowed,
config, config,
@ -135,6 +136,7 @@ export function GraphWrapper({
const [currentRepository, setCurrentRepository] = useState<GraphRepository | undefined>( const [currentRepository, setCurrentRepository] = useState<GraphRepository | undefined>(
reposList.find(item => item.path === selectedRepository), reposList.find(item => item.path === selectedRepository),
); );
const [currentSha, setSelectedSha] = useState(selectedSha);
const [graphColSettings, setGraphColSettings] = useState(getGraphColSettingsModel(config)); const [graphColSettings, setGraphColSettings] = useState(getGraphColSettingsModel(config));
const [pagingState, setPagingState] = useState(paging); const [pagingState, setPagingState] = useState(paging);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
@ -179,6 +181,7 @@ export function GraphWrapper({
setGraphList(state.rows ?? []); setGraphList(state.rows ?? []);
setReposList(state.repositories ?? []); setReposList(state.repositories ?? []);
setCurrentRepository(reposList.find(item => item.path === state.selectedRepository)); setCurrentRepository(reposList.find(item => item.path === state.selectedRepository));
setSelectedSha(state.selectedSha);
setGraphColSettings(getGraphColSettingsModel(state.config)); setGraphColSettings(getGraphColSettingsModel(state.config));
setPagingState(state.paging); setPagingState(state.paging);
setIsLoading(false); setIsLoading(false);
@ -402,6 +405,7 @@ export function GraphWrapper({
getExternalIcon={getIconElementLibrary} getExternalIcon={getIconElementLibrary}
graphRows={graphList} graphRows={graphList}
height={mainHeight} height={mainHeight}
isSelectedBySha={currentSha ? { [currentSha]: true } : undefined}
hasMoreCommits={pagingState?.more} hasMoreCommits={pagingState?.more}
isLoadingRows={isLoading} isLoadingRows={isLoading}
nonce={nonce} nonce={nonce}

+ 4
- 0
src/webviews/apps/shared/components/codicon.ts View File

@ -1500,6 +1500,10 @@ export class CodeIcon extends LitElement {
position: relative; position: relative;
left: 1px; left: 1px;
} }
:host([icon='graph']):before {
font-family: 'glicons';
content: '\\f102';
}
`; `;
@property() @property()

+ 1
- 1
src/webviews/apps/shared/theme.ts View File

@ -8,7 +8,7 @@ export function initializeAndWatchThemeColors(callback?: () => void) {
const isLightTheme = const isLightTheme =
body.classList.contains('vscode-light') || body.classList.contains('vscode-high-contrast-light'); body.classList.contains('vscode-light') || body.classList.contains('vscode-high-contrast-light');
const isHighContrastTheme = body.classList.contains('vscode-high-contrast');
// const isHighContrastTheme = body.classList.contains('vscode-high-contrast');
const bodyStyle = body.style; const bodyStyle = body.style;

+ 8
- 0
src/webviews/commitDetails/commitDetailsWebviewView.ts View File

@ -9,6 +9,7 @@ import type { GitFileChange } from '../../git/models/file';
import { GitFile } from '../../git/models/file'; import { GitFile } from '../../git/models/file';
import type { IssueOrPullRequest } from '../../git/models/issue'; import type { IssueOrPullRequest } from '../../git/models/issue';
import type { PullRequest } from '../../git/models/pullRequest'; import type { PullRequest } from '../../git/models/pullRequest';
import type { ShowCommitInGraphCommandArgs } from '../../plus/webviews/graph/graphWebview';
import { executeCommand } from '../../system/command'; import { executeCommand } from '../../system/command';
import { debug } from '../../system/decorators/log'; import { debug } from '../../system/decorators/log';
import type { Deferrable } from '../../system/function'; import type { Deferrable } from '../../system/function';
@ -180,6 +181,13 @@ export class CommitDetailsWebviewView extends WebviewViewBase
case CommitActionsCommandType.method: case CommitActionsCommandType.method:
onIpc(CommitActionsCommandType, e, params => { onIpc(CommitActionsCommandType, e, params => {
switch (params.action) { switch (params.action) {
case 'graph':
if (this._context.commit == null) return;
void executeCommand<ShowCommitInGraphCommandArgs>(Commands.ShowCommitInGraph, {
sha: this._context.commit.sha,
});
break;
case 'more': case 'more':
this.showCommitActions(); this.showCommitActions();
break; break;

+ 1
- 1
src/webviews/commitDetails/protocol.ts View File

@ -45,7 +45,7 @@ export type ShowCommitDetailsViewCommandArgs = string[];
// COMMANDS // COMMANDS
export interface CommitActionsParams { export interface CommitActionsParams {
action: 'sha' | 'more';
action: 'graph' | 'more' | 'sha';
alt?: boolean; alt?: boolean;
} }
export const CommitActionsCommandType = new IpcCommandType<CommitActionsParams>('commit/actions'); export const CommitActionsCommandType = new IpcCommandType<CommitActionsParams>('commit/actions');

Loading…
Cancel
Save