Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### v0.28.0

- **[#1013] 超过 1000 个分支/远程跟踪引用时仍可访问提交历史**:界面显示明确标注的提交列表,保留提交选择与详情。列表读取本地分支、远程分支和当前 HEAD;分页通过 Git 引用、HEAD 与 shallow 边界的状态指纹校验,状态变化时要求刷新。引用输出上限为 8 MiB,引用数量上限为 100,000,shallow 元数据上限为 1 MiB。
- **正式版支持线前移到 DSH 0.2.1-rc.1+**:13 条 DSH peer 下限统一为 `^0.2.1-rc.1`,开发依赖、CI 与安装脚本使用精确 RC 基线。不新增运行时兼容层、不改功能实现。
- **沿用已发布 alpha 的功能**:上游 alpha.5 → rc.1 完整源码树差异共 355 项,全部为 `package.json`,源码零变化;本次仅同步版本、依赖声明与文档。伴随依赖调整为 Cordis peer `^4.0.5` / dev `4.0.5`、group `1.0.5`、schemastery `~3.18.5`,include 保持 `1.0.10`。
- **发布渠道切换至 npm `latest`**:插件 v0.28.0 即将接管 `latest`,现有 workflow 按正式版本号自动选择该标签,无需修改。**宿主 npm `latest` 此时仍是 0.2.0-rc.2,不能安装本版**;该宿主必须固定插件 **v0.26.1**。DSH 0.2.1-alpha.5 用户固定 **v0.28.0-alpha.0**;0.2.0-rc.1、0.1.7 及更早支持线保持原指引。用户已明确接受两个包的 `latest` 不对齐风险。
Expand Down
3 changes: 3 additions & 0 deletions src/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ export const api = {
/** Read-only topological history; stale cursors require a fresh first page. */
gitGraph: (scope: SessionScope, options: GitGraphOptions = {}, worktree?: string, signal?: AbortSignal) =>
call<GitGraphResult>('git.graph', gitPayload(scope, worktree, { ...options }), signal),
/** 图形界面超过分支上限时读取经状态指纹校验的分页历史。 */
gitHistory: (scope: SessionScope, options: { count?: number; cursor?: string } = {}, worktree?: string, signal?: AbortSignal) =>
call<{ isRepo: boolean; root?: string; entries: GitGraphResult['entries']; hasMore: boolean; nextCursor?: string; snapshot: string }>('git.history', gitPayload(scope, worktree, options), signal),
/** Recent commit history, lazily pageable (skip/count; defaults 0/30). */
gitLog: (scope: SessionScope, count?: number, skip?: number, worktree?: string, signal?: AbortSignal) =>
call<GitLogEntry[]>('git.log', gitPayload(scope, worktree, {
Expand Down
37 changes: 28 additions & 9 deletions src/client/changes/GitGraphSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export function GitGraphSection({ scope, worktree, visible, refreshTick = 0, onP
const [branch, setBranch] = useState('')
const [page, setPage] = useState<GraphPage | null>(null)
const [branches, setBranches] = useState<GraphPage['branches']>([])
const [linearFallback, setLinearFallback] = useState(false)
const selectionRef = useRef(selectedRef)
selectionRef.current = selectedRef
const clearPreviewRef = useRef(onClearPreview)
Expand Down Expand Up @@ -162,11 +163,27 @@ export function GitGraphSection({ scope, worktree, visible, refreshTick = 0, onP
setError(null)
setStale(false)
try {
const result = await api.gitGraph(scope, {
branch: branch || undefined, count: 50,
cursor: append ? previous?.nextCursor : undefined,
}, worktree, controller.signal)
let result: GraphPage
let fallback = linearFallback
if (append && linearFallback) {
const history = await api.gitHistory(scope, { count: 50, cursor: previous?.nextCursor }, worktree, controller.signal)
result = { ...history, branches: [] }
} else {
try {
result = await api.gitGraph(scope, {
branch: branch || undefined, count: 50,
cursor: append ? previous?.nextCursor : undefined,
}, worktree, controller.signal)
fallback = false
} catch (reason) {
if (append || !(reason instanceof SidebarApiError) || reason.code !== 'graph-limit') throw reason
const history = await api.gitHistory(scope, { count: 50 }, worktree, controller.signal)
result = { ...history, branches: [] }
fallback = true
}
}
if (controller.signal.aborted || gen !== generation.current) return
if (!append) setLinearFallback(fallback)
const next = append && previous ? {
...result,
entries: [...previous.entries, ...result.entries.filter(entry => !previous.entries.some(old => old.hashFull === entry.hashFull))],
Expand Down Expand Up @@ -199,6 +216,7 @@ export function GitGraphSection({ scope, worktree, visible, refreshTick = 0, onP
setPage(null)
setBranch('')
setBranches([])
setLinearFallback(false)
}, [scope.sessionId, scope.cwd, scope.repoRoot, worktree])
useEffect(() => {
if (visible) void request(false)
Expand Down Expand Up @@ -264,12 +282,13 @@ export function GitGraphSection({ scope, worktree, visible, refreshTick = 0, onP

return <section className={css.root} aria-label={t('gitGraph')} data-git-graph>
<div className={css.toolbar}>
<select className={css.select} aria-label={t('graphBranchFilter')}
{linearFallback && <div role="status">{t('graphLinearFallback')}</div>}
{!linearFallback && <select className={css.select} aria-label={t('graphBranchFilter')}
value={branch} onChange={event => { chooseBranch(event.target.value) }}>
<option value="">{t('graphAllBranches')}</option>
{branches.map(item => <option key={item.ref} value={item.ref}>{item.name}</option>)}
{branch && !branches.some(item => item.ref === branch) && <option value={branch}>{branch}</option>}
</select>
</select>}
</div>
<div className={css.scroll} aria-busy={loading} ref={scrollRef}>
{error !== null && <div className={css.notice} role="alert">
Expand All @@ -291,11 +310,11 @@ export function GitGraphSection({ scope, worktree, visible, refreshTick = 0, onP
onMouseLeave={cancelHover}
onClick={() => { cancelHover(); select(entry) }}
onContextMenu={onContextMenu === undefined ? undefined : (event) => { onContextMenu(event, entry) }}>
<svg width={width} height={ROW_HEIGHT} viewBox={`0 0 ${width} ${ROW_HEIGHT}`} preserveAspectRatio="none" className={css.graph} aria-hidden="true">
{!linearFallback && <svg width={width} height={ROW_HEIGHT} viewBox={`0 0 ${width} ${ROW_HEIGHT}`} preserveAspectRatio="none" className={css.graph} aria-hidden="true">
{row.segments.map((edge, i) => <path key={i} data-color={colorSlot(edge.colorIndex)}
d={edgePath(edge, laneX, ROW_HEIGHT)} />)}
<circle cx={laneX(row.lane)} cy={ROW_HEIGHT / 2} r={3} data-color={slot} />
</svg>
</svg>}
{entry.refs.length > 0 && <span className={css.refs}>
{refPills(entry.refs, remotes).map(pill => <RefPill key={pill.name} pill={pill} slot={slot} />)}
</span>}
Expand All @@ -320,4 +339,4 @@ export function GitGraphSection({ scope, worktree, visible, refreshTick = 0, onP
</div>}
</AnchoredPopover>
</section>
}
}
1 change: 1 addition & 0 deletions src/client/locales-ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export const ar: Record<string, string> = {
graphBranchFilter: 'تصفية حسب الفرع',
graphEmpty: 'لا توجد التزامات',
graphLoadError: 'تعذر تحميل سجل الالتزامات',
graphLinearFallback: 'عدد الفروع كبير جدًا؛ يُعرض سجل الالتزامات كقائمة دون رسم للفروع',
graphStale: 'تغيّر السجل. يرجى التحديث للمتابعة.',
graphDetails: 'تفاصيل الالتزام',
graphParents: 'الالتزامات الأصلية',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export const de: Record<string, string> = {
graphBranchFilter: 'Branch-Filter',
graphEmpty: 'Keine Commits',
graphLoadError: 'Commit-Verlauf konnte nicht geladen werden',
graphLinearFallback: 'Zu viele Branches; der Commit-Verlauf wird als Liste ohne Branch-Grafik angezeigt',
graphStale: 'Der Verlauf hat sich geändert. Bitte aktualisieren.',
graphDetails: 'Commit-Details',
graphParents: 'Übergeordnete Commits',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export const fr: Record<string, string> = {
graphBranchFilter: 'Filtre par branche',
graphEmpty: 'Aucun commit',
graphLoadError: 'Impossible de charger l’historique des commits',
graphLinearFallback: 'Trop de branches ; l’historique des commits est affiché sans graphe des branches',
graphStale: 'L’historique a changé. Veuillez actualiser.',
graphDetails: 'Détails du commit',
graphParents: 'Commits parents',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-hi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export const hi: Record<string, string> = {
graphBranchFilter: 'ब्रांच फ़िल्टर',
graphEmpty: 'कोई कमिट नहीं',
graphLoadError: 'कमिट इतिहास लोड नहीं हो सका',
graphLinearFallback: 'बहुत अधिक ब्रांच हैं; कमिट इतिहास ब्रांच ग्राफ़ के बिना सूची में दिखाया जा रहा है',
graphStale: 'इतिहास बदल गया है। कृपया रीफ़्रेश करें।',
graphDetails: 'कमिट का विवरण',
graphParents: 'पैरेंट कमिट',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export const id: Record<string, string> = {
graphBranchFilter: 'Filter branch',
graphEmpty: 'Tidak ada commit',
graphLoadError: 'Gagal memuat riwayat commit',
graphLinearFallback: 'Terlalu banyak branch; riwayat commit ditampilkan sebagai daftar tanpa grafik branch',
graphStale: 'Riwayat telah berubah. Silakan muat ulang.',
graphDetails: 'Detail commit',
graphParents: 'Commit induk',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export const it: Record<string, string> = {
graphBranchFilter: 'Filtro per ramo',
graphEmpty: 'Nessun commit',
graphLoadError: 'Impossibile caricare la cronologia dei commit',
graphLinearFallback: 'Troppi branch; la cronologia dei commit è mostrata come elenco senza grafico dei rami',
graphStale: 'La cronologia è cambiata. Aggiorna per continuare.',
graphDetails: 'Dettagli del commit',
graphParents: 'Commit genitori',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export const ja: Record<string, string> = {
graphBranchFilter: 'ブランチの絞り込み',
graphEmpty: 'コミットはありません',
graphLoadError: 'コミット履歴を読み込めませんでした',
graphLinearFallback: 'ブランチが多すぎるため、ブランチ構造を示さない履歴リストを表示しています',
graphStale: '履歴が変更されました。更新してください。',
graphDetails: 'コミットの詳細',
graphParents: '親コミット',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ export const ko: Record<string, string> = {
graphBranchFilter: '브랜치 필터',
graphEmpty: '커밋이 없습니다',
graphLoadError: '커밋 기록을 불러오지 못했습니다',
graphLinearFallback: '브랜치가 너무 많아 브랜치 그래프 없이 커밋 기록을 목록으로 표시합니다',
graphStale: '기록이 변경되었습니다. 새로고침하세요.',
graphDetails: '커밋 상세 정보',
graphParents: '부모 커밋',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export const nl: Record<string, string> = {
graphBranchFilter: 'Branchfilter',
graphEmpty: 'Geen commits',
graphLoadError: 'Commitgeschiedenis laden mislukt',
graphLinearFallback: 'Te veel branches; de commitgeschiedenis wordt als lijst zonder vertakkingsgrafiek weergegeven',
graphStale: 'De geschiedenis is gewijzigd. Vernieuw om door te gaan.',
graphDetails: 'Commitdetails',
graphParents: 'Bovenliggende commits',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export const pl: Record<string, string> = {
graphBranchFilter: 'Filtr gałęzi',
graphEmpty: 'Brak commitów',
graphLoadError: 'Nie udało się wczytać historii commitów',
graphLinearFallback: 'Zbyt wiele gałęzi; historia commitów jest wyświetlana jako lista bez grafu gałęzi',
graphStale: 'Historia uległa zmianie. Odśwież, aby kontynuować.',
graphDetails: 'Szczegóły commita',
graphParents: 'Commity nadrzędne',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-pt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export const pt: Record<string, string> = {
graphBranchFilter: 'Filtro de branch',
graphEmpty: 'Nenhum commit',
graphLoadError: 'Falha ao carregar o histórico de commits',
graphLinearFallback: 'Ramos demais; o histórico de commits é exibido como lista sem gráfico de ramificações',
graphStale: 'O histórico mudou. Atualize para continuar.',
graphDetails: 'Detalhes do commit',
graphParents: 'Commits pais',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export const ru: Record<string, string> = {
graphBranchFilter: 'Фильтр по ветке',
graphEmpty: 'Нет коммитов',
graphLoadError: 'Не удалось загрузить историю коммитов',
graphLinearFallback: 'Слишком много веток; история коммитов показана списком без графа веток',
graphStale: 'История изменилась. Обновите для продолжения.',
graphDetails: 'Сведения о коммите',
graphParents: 'Родительские коммиты',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-sv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export const sv: Record<string, string> = {
graphBranchFilter: 'Grenfilter',
graphEmpty: 'Inga commits',
graphLoadError: 'Kunde inte läsa in commit-historiken',
graphLinearFallback: 'För många grenar; commit-historiken visas som en lista utan grengraf',
graphStale: 'Historiken har ändrats. Uppdatera för att fortsätta.',
graphDetails: 'Commit-detaljer',
graphParents: 'Föräldracommits',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-th.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export const th: Record<string, string> = {
graphBranchFilter: 'ตัวกรอง branch',
graphEmpty: 'ไม่มี commit',
graphLoadError: 'โหลดประวัติ commit ไม่สำเร็จ',
graphLinearFallback: 'มีบรานช์มากเกินไป จึงแสดงประวัติ commit เป็นรายการโดยไม่มีกราฟบรานช์',
graphStale: 'ประวัติมีการเปลี่ยนแปลง โปรดรีเฟรช',
graphDetails: 'รายละเอียด commit',
graphParents: 'commit แม่',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export const tr: Record<string, string> = {
graphBranchFilter: 'Dal filtresi',
graphEmpty: 'Commit yok',
graphLoadError: 'Commit geçmişi yüklenemedi',
graphLinearFallback: 'Çok fazla dal var; commit geçmişi dal grafiği olmadan liste olarak gösteriliyor',
graphStale: 'Geçmiş değişti. Devam etmek için yenileyin.',
graphDetails: 'Commit ayrıntıları',
graphParents: 'Üst commit’ler',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-vi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export const vi: Record<string, string> = {
graphBranchFilter: 'Bộ lọc nhánh',
graphEmpty: 'Không có commit',
graphLoadError: 'Không thể tải lịch sử commit',
graphLinearFallback: 'Quá nhiều nhánh; lịch sử commit được hiển thị thành danh sách không có đồ thị nhánh',
graphStale: 'Lịch sử đã thay đổi. Vui lòng làm mới.',
graphDetails: 'Chi tiết commit',
graphParents: 'Commit cha',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-zh-HK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export const zhHK: Record<string, string> = {
graphBranchFilter: '分支篩選',
graphEmpty: '尚無提交',
graphLoadError: '載入提交歷史失敗',
graphLinearFallback: '分支過多,目前顯示不含分支圖的提交列表',
graphStale: '提交歷史已變更,請重新整理',
graphDetails: '提交詳情',
graphParents: '父提交',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-zh-MO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export const zhMO: Record<string, string> = {
graphBranchFilter: '分支篩選',
graphEmpty: '尚無提交',
graphLoadError: '載入提交歷史失敗',
graphLinearFallback: '分支過多,目前顯示不含分支圖的提交列表',
graphStale: '提交歷史已變更,請重新整理',
graphDetails: '提交詳情',
graphParents: '父提交',
Expand Down
1 change: 1 addition & 0 deletions src/client/locales-zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export const zhTW: Record<string, string> = {
graphBranchFilter: '分支篩選',
graphEmpty: '尚無提交',
graphLoadError: '載入提交歷史失敗',
graphLinearFallback: '分支過多,目前顯示不含分支圖的提交列表',
graphStale: '提交歷史已變更,請重新整理',
graphDetails: '提交詳情',
graphParents: '父提交',
Expand Down
2 changes: 2 additions & 0 deletions src/client/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export const zh = {
graphBranchFilter: '分支筛选',
graphEmpty: '暂无提交',
graphLoadError: '加载提交历史失败',
graphLinearFallback: '分支过多,当前显示线性历史列表(不表示分支拓扑)',
graphStale: '提交历史已变化,请刷新',
graphDetails: '提交详情',
graphParents: '父提交',
Expand Down Expand Up @@ -891,6 +892,7 @@ export const en: Record<keyof typeof zh, string> = {
graphBranchFilter: 'Branch filter',
graphEmpty: 'No commits',
graphLoadError: 'Failed to load commit history',
graphLinearFallback: 'Too many branches; showing a linear history list (not branch topology)',
graphStale: 'History has changed. Refresh to continue.',
graphDetails: 'Commit details',
graphParents: 'Parents',
Expand Down
Loading
Loading