forked from superset-sh/superset
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(desktop): CodeMirrorDiffViewer統一、git blame、GitGraph、マージコンフリクト解消UIの追加 #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d38a910
feat(desktop): CodeMirrorDiffViewerに統一 + 差分表示改善
MocA-Love 5c670d7
feat(desktop): ChangesHeaderにブランチセレクターとAI生成ボタンを追加
MocA-Love b5128b9
feat(desktop): ブランチ切り替え時の確認ダイアログと英語メッセージ対応
MocA-Love c5a5ead
feat(desktop): GitGraphビューアを実装
MocA-Love 06b872f
feat(desktop): git blame インライン表示とホバーポップアップを追加
MocA-Love 7b9a8f7
feat(desktop): VSCodeインラインスタイルのマージコンフリクト解消UIを追加
MocA-Love 5deca1a
fix(desktop): GitGraphの詳細パネルがpane外にはみ出る問題を修正
MocA-Love 431a537
fix(desktop): git blame トリップの表示タイミングを修正
MocA-Love fb05bc2
fix(desktop): ConflictViewerの表示・スタイル修正
MocA-Love f0785d8
docs: README にフォーク固有変更(#38)を追記
MocA-Love c51b1c4
fix: lint エラーを修正(biome-ignore・フォーマット)
MocA-Love 96a1f6e
fix(desktop): PRレビュー指摘の修正
MocA-Love ef1161e
fix(desktop): CodeRabbitレビュー指摘の修正
MocA-Love 0cfa2a5
chore: test-conflict-repoをgitignoreに追加
MocA-Love e4e71e1
fix(desktop): CodeRabbitレビュー指摘の修正(第2回)
MocA-Love 0633b9e
fix(desktop): CodeRabbitレビュー指摘の修正(第3回)
MocA-Love File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,3 +85,4 @@ superset-dev-data/ | |
| !.codex/config.toml | ||
| !.codex/commands | ||
| !.codex/prompts | ||
| test-conflict-repo/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| import { z } from "zod"; | ||
| import { publicProcedure, router } from "../.."; | ||
| import { toRegisteredWorktreeRelativePath } from "../workspace-fs-service"; | ||
| import { getSimpleGitWithShellPath } from "../workspaces/utils/git-client"; | ||
| import { assertRegisteredWorktree } from "./security/path-validation"; | ||
|
|
||
| export interface BlameEntry { | ||
| line: number; | ||
| commitHash: string; | ||
| author: string; | ||
| timestamp: number; | ||
| summary: string; | ||
| } | ||
|
|
||
| function parseGitBlamePorcelain(output: string): BlameEntry[] { | ||
| const lines = output.split("\n"); | ||
| const commitCache = new Map< | ||
| string, | ||
| { author: string; timestamp: number; summary: string } | ||
| >(); | ||
| const result: BlameEntry[] = []; | ||
|
|
||
| let i = 0; | ||
| while (i < lines.length) { | ||
| const header = lines[i]; | ||
| if (!header || header.length < 40) { | ||
| i++; | ||
| continue; | ||
| } | ||
|
|
||
| const commitHash = header.substring(0, 40); | ||
| if (!/^[0-9a-f]{40}$/.test(commitHash)) { | ||
| i++; | ||
| continue; | ||
| } | ||
|
|
||
| const parts = header.split(" "); | ||
| const finalLine = Number.parseInt(parts[2] ?? "", 10); | ||
|
|
||
| i++; | ||
|
|
||
| let author = ""; | ||
| let timestamp = 0; | ||
| let summary = ""; | ||
|
|
||
| if (!commitCache.has(commitHash)) { | ||
| while (i < lines.length && !lines[i].startsWith("\t")) { | ||
| const line = lines[i]; | ||
| if (line.startsWith("author ")) { | ||
| author = line.substring(7); | ||
| } else if (line.startsWith("author-time ")) { | ||
| timestamp = Number.parseInt(line.substring(12), 10); | ||
| } else if (line.startsWith("summary ")) { | ||
| summary = line.substring(8); | ||
| } | ||
| i++; | ||
| } | ||
| commitCache.set(commitHash, { author, timestamp, summary }); | ||
| } else { | ||
| while (i < lines.length && !lines[i].startsWith("\t")) { | ||
| i++; | ||
| } | ||
| // biome-ignore lint/style/noNonNullAssertion: commitHash is guaranteed to exist in cache at this point | ||
| const cached = commitCache.get(commitHash)!; | ||
| author = cached.author; | ||
| timestamp = cached.timestamp; | ||
| summary = cached.summary; | ||
| } | ||
|
|
||
| // skip the tab+content line | ||
| i++; | ||
|
|
||
| if (!Number.isNaN(finalLine)) { | ||
| result.push({ line: finalLine, commitHash, author, timestamp, summary }); | ||
| } | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| export const createGitBlameRouter = () => { | ||
| return router({ | ||
| getGitBlame: publicProcedure | ||
| .input( | ||
| z.object({ | ||
| worktreePath: z.string(), | ||
| absolutePath: z.string(), | ||
| }), | ||
| ) | ||
| .query(async ({ input }): Promise<{ entries: BlameEntry[] }> => { | ||
| assertRegisteredWorktree(input.worktreePath); | ||
|
|
||
| const filePath = toRegisteredWorktreeRelativePath( | ||
| input.worktreePath, | ||
| input.absolutePath, | ||
| ); | ||
|
|
||
| const git = await getSimpleGitWithShellPath(input.worktreePath); | ||
|
|
||
| try { | ||
| const output = await git.raw([ | ||
| "blame", | ||
| "--porcelain", | ||
| "--", | ||
| filePath, | ||
| ]); | ||
| return { entries: parseGitBlamePorcelain(output) }; | ||
| } catch { | ||
| return { entries: [] }; | ||
| } | ||
| }), | ||
| }); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.