@lapis-notes/history 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/dist/repository/NOTICE.md +11 -0
- package/dist/repository/components/RepositoryAuthorAvatar.svelte +77 -0
- package/dist/repository/components/RepositoryAuthorAvatar.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryBackupStatus.svelte +236 -0
- package/dist/repository/components/RepositoryBackupStatus.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryChangedFiles.svelte +104 -0
- package/dist/repository/components/RepositoryChangedFiles.svelte.d.ts +13 -0
- package/dist/repository/components/RepositoryCommitMessage.svelte +93 -0
- package/dist/repository/components/RepositoryCommitMessage.svelte.d.ts +6 -0
- package/dist/repository/components/RepositoryCommitPicker.svelte +205 -0
- package/dist/repository/components/RepositoryCommitPicker.svelte.d.ts +17 -0
- package/dist/repository/components/RepositoryComparisonBar.svelte +71 -0
- package/dist/repository/components/RepositoryComparisonBar.svelte.d.ts +9 -0
- package/dist/repository/components/RepositoryComparisonTime.svelte +32 -0
- package/dist/repository/components/RepositoryComparisonTime.svelte.d.ts +6 -0
- package/dist/repository/components/RepositoryDiff.svelte +56 -0
- package/dist/repository/components/RepositoryDiff.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryDiffColumn.svelte +78 -0
- package/dist/repository/components/RepositoryDiffColumn.svelte.d.ts +14 -0
- package/dist/repository/components/RepositoryDiffControls.svelte +117 -0
- package/dist/repository/components/RepositoryDiffControls.svelte.d.ts +8 -0
- package/dist/repository/components/RepositoryFileHistory.svelte +170 -0
- package/dist/repository/components/RepositoryFileHistory.svelte.d.ts +10 -0
- package/dist/repository/components/RepositoryFileTitle.svelte +30 -0
- package/dist/repository/components/RepositoryFileTitle.svelte.d.ts +6 -0
- package/dist/repository/components/RepositoryGraph.svelte +216 -0
- package/dist/repository/components/RepositoryGraph.svelte.d.ts +19 -0
- package/dist/repository/components/RepositoryGraphSvg.svelte +110 -0
- package/dist/repository/components/RepositoryGraphSvg.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryIdentifiers.svelte +221 -0
- package/dist/repository/components/RepositoryIdentifiers.svelte.d.ts +15 -0
- package/dist/repository/components/RepositoryLogHeader.svelte +90 -0
- package/dist/repository/components/RepositoryLogHeader.svelte.d.ts +23 -0
- package/dist/repository/components/RepositoryOperationArguments.svelte +52 -0
- package/dist/repository/components/RepositoryOperationArguments.svelte.d.ts +6 -0
- package/dist/repository/components/RepositoryOperationColumn.svelte +163 -0
- package/dist/repository/components/RepositoryOperationColumn.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryOperationFiles.svelte +245 -0
- package/dist/repository/components/RepositoryOperationFiles.svelte.d.ts +14 -0
- package/dist/repository/components/RepositoryOperationMessage.svelte +169 -0
- package/dist/repository/components/RepositoryOperationMessage.svelte.d.ts +10 -0
- package/dist/repository/components/RepositoryOperationOption.svelte +183 -0
- package/dist/repository/components/RepositoryOperationOption.svelte.d.ts +10 -0
- package/dist/repository/components/RepositoryOperationParentPicker.svelte +188 -0
- package/dist/repository/components/RepositoryOperationParentPicker.svelte.d.ts +14 -0
- package/dist/repository/components/RepositoryOperationPinPicker.svelte +170 -0
- package/dist/repository/components/RepositoryOperationPinPicker.svelte.d.ts +13 -0
- package/dist/repository/components/RepositoryOperationRail.svelte +136 -0
- package/dist/repository/components/RepositoryOperationRail.svelte.d.ts +9 -0
- package/dist/repository/components/RepositoryOperationTarget.svelte +99 -0
- package/dist/repository/components/RepositoryOperationTarget.svelte.d.ts +8 -0
- package/dist/repository/components/RepositoryOperations.svelte +199 -0
- package/dist/repository/components/RepositoryOperations.svelte.d.ts +12 -0
- package/dist/repository/components/RepositoryPanel.svelte +207 -0
- package/dist/repository/components/RepositoryPanel.svelte.d.ts +15 -0
- package/dist/repository/components/RepositoryParentSummary.svelte +52 -0
- package/dist/repository/components/RepositoryParentSummary.svelte.d.ts +10 -0
- package/dist/repository/components/RepositoryPickerSearch.svelte +51 -0
- package/dist/repository/components/RepositoryPickerSearch.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryRestoreDialog.svelte +81 -0
- package/dist/repository/components/RepositoryRestoreDialog.svelte.d.ts +7 -0
- package/dist/repository/components/RepositoryRevisionActions.svelte +53 -0
- package/dist/repository/components/RepositoryRevisionActions.svelte.d.ts +9 -0
- package/dist/repository/components/RepositoryRevisionFiles.svelte +110 -0
- package/dist/repository/components/RepositoryRevisionFiles.svelte.d.ts +14 -0
- package/dist/repository/components/RepositoryRevisionOption.svelte +60 -0
- package/dist/repository/components/RepositoryRevisionOption.svelte.d.ts +9 -0
- package/dist/repository/components/RepositoryRevisionPicker.svelte +165 -0
- package/dist/repository/components/RepositoryRevisionPicker.svelte.d.ts +14 -0
- package/dist/repository/components/RepositoryRevisions.svelte +115 -0
- package/dist/repository/components/RepositoryRevisions.svelte.d.ts +20 -0
- package/dist/repository/components/RepositoryShell.svelte +44 -0
- package/dist/repository/components/RepositoryShell.svelte.d.ts +11 -0
- package/dist/repository/components/RepositorySkeleton.svelte +138 -0
- package/dist/repository/components/RepositorySkeleton.svelte.d.ts +7 -0
- package/dist/repository/components/RepositorySourcePicker.svelte +114 -0
- package/dist/repository/components/RepositorySourcePicker.svelte.d.ts +7 -0
- package/dist/repository/components/RepositoryUpstreamActions.svelte +125 -0
- package/dist/repository/components/RepositoryUpstreamActions.svelte.d.ts +8 -0
- package/dist/repository/components/RepositoryWorkingCopyStatus.svelte +290 -0
- package/dist/repository/components/RepositoryWorkingCopyStatus.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryWorkspacePicker.svelte +158 -0
- package/dist/repository/components/RepositoryWorkspacePicker.svelte.d.ts +11 -0
- package/dist/repository/components/backup/AdoptionSettings.svelte +95 -0
- package/dist/repository/components/backup/AdoptionSettings.svelte.d.ts +7 -0
- package/dist/repository/components/backup/BackupCard.svelte +79 -0
- package/dist/repository/components/backup/BackupCard.svelte.d.ts +14 -0
- package/dist/repository/components/backup/BackupField.svelte +45 -0
- package/dist/repository/components/backup/BackupField.svelte.d.ts +10 -0
- package/dist/repository/components/backup/BackupSelect.svelte +71 -0
- package/dist/repository/components/backup/BackupSelect.svelte.d.ts +35 -0
- package/dist/repository/components/backup/BackupSettings.svelte +122 -0
- package/dist/repository/components/backup/BackupSettings.svelte.d.ts +18 -0
- package/dist/repository/components/backup/BackupSettingsField.svelte +13 -0
- package/dist/repository/components/backup/BackupSettingsField.svelte.d.ts +4 -0
- package/dist/repository/components/backup/ForgeAccounts.svelte +231 -0
- package/dist/repository/components/backup/ForgeAccounts.svelte.d.ts +9 -0
- package/dist/repository/components/backup/ForgeAuthorization.svelte +267 -0
- package/dist/repository/components/backup/ForgeAuthorization.svelte.d.ts +9 -0
- package/dist/repository/components/backup/ForgeIcon.svelte +21 -0
- package/dist/repository/components/backup/ForgeIcon.svelte.d.ts +7 -0
- package/dist/repository/components/backup/PublicationRecovery.svelte +129 -0
- package/dist/repository/components/backup/PublicationRecovery.svelte.d.ts +11 -0
- package/dist/repository/components/backup/RemoteSettings.svelte +288 -0
- package/dist/repository/components/backup/RemoteSettings.svelte.d.ts +11 -0
- package/dist/repository/components/backup/RepositorySettingsPage.svelte +51 -0
- package/dist/repository/components/backup/RepositorySettingsPage.svelte.d.ts +4 -0
- package/dist/repository/components/backup/StorageSettings.svelte +158 -0
- package/dist/repository/components/backup/StorageSettings.svelte.d.ts +7 -0
- package/dist/repository/components/backup/SyncConflictEditor.svelte +158 -0
- package/dist/repository/components/backup/SyncConflictEditor.svelte.d.ts +9 -0
- package/dist/repository/components/backup/SyncSettings.svelte +97 -0
- package/dist/repository/components/backup/SyncSettings.svelte.d.ts +9 -0
- package/dist/repository/components/backup/adoption-settings.d.ts +7 -0
- package/dist/repository/components/backup/adoption-settings.js +42 -0
- package/dist/repository/components/backup/backup-settings.d.ts +35 -0
- package/dist/repository/components/backup/backup-settings.js +96 -0
- package/dist/repository/components/backup/forge-icons.d.ts +10 -0
- package/dist/repository/components/backup/forge-icons.js +11 -0
- package/dist/repository/components/backup/remote-restore.d.ts +3 -0
- package/dist/repository/components/backup/remote-restore.js +17 -0
- package/dist/repository/components/backup/storage-settings.d.ts +8 -0
- package/dist/repository/components/backup/storage-settings.js +23 -0
- package/dist/repository/components/blame/RepositoryBlameCommitTitle.svelte +212 -0
- package/dist/repository/components/blame/RepositoryBlameCommitTitle.svelte.d.ts +14 -0
- package/dist/repository/components/blame/RepositoryBlameGroup.svelte +189 -0
- package/dist/repository/components/blame/RepositoryBlameGroup.svelte.d.ts +20 -0
- package/dist/repository/components/blame/RepositoryBlamePanel.svelte +148 -0
- package/dist/repository/components/blame/RepositoryBlamePanel.svelte.d.ts +13 -0
- package/dist/repository/components/blame/RepositoryBlameRows.svelte +137 -0
- package/dist/repository/components/blame/RepositoryBlameRows.svelte.d.ts +32 -0
- package/dist/repository/components/blame/RepositoryBlameView.svelte +121 -0
- package/dist/repository/components/blame/RepositoryBlameView.svelte.d.ts +16 -0
- package/dist/repository/components/blame/blame-view.d.ts +16 -0
- package/dist/repository/components/blame/blame-view.js +73 -0
- package/dist/repository/components/blame/editor-actions.d.ts +3 -0
- package/dist/repository/components/blame/editor-actions.js +53 -0
- package/dist/repository/components/conflicts/RepositoryConflictActions.svelte +83 -0
- package/dist/repository/components/conflicts/RepositoryConflictActions.svelte.d.ts +13 -0
- package/dist/repository/components/conflicts/RepositoryConflictBody.svelte +93 -0
- package/dist/repository/components/conflicts/RepositoryConflictBody.svelte.d.ts +16 -0
- package/dist/repository/components/conflicts/RepositoryConflictFileTree.svelte +84 -0
- package/dist/repository/components/conflicts/RepositoryConflictFileTree.svelte.d.ts +21 -0
- package/dist/repository/components/conflicts/RepositoryConflictPath.svelte +35 -0
- package/dist/repository/components/conflicts/RepositoryConflictPath.svelte.d.ts +9 -0
- package/dist/repository/components/conflicts/RepositoryConflictResolution.svelte +133 -0
- package/dist/repository/components/conflicts/RepositoryConflictResolution.svelte.d.ts +12 -0
- package/dist/repository/components/conflicts/RepositoryConflictSurface.svelte +105 -0
- package/dist/repository/components/conflicts/RepositoryConflictSurface.svelte.d.ts +23 -0
- package/dist/repository/components/conflicts/RepositoryConflictText.svelte +104 -0
- package/dist/repository/components/conflicts/RepositoryConflictText.svelte.d.ts +26 -0
- package/dist/repository/components/conflicts/RepositorySidebarToggleIcon.svelte +52 -0
- package/dist/repository/components/conflicts/RepositorySidebarToggleIcon.svelte.d.ts +7 -0
- package/dist/repository/components/conflicts/repository-conflict-file-tree.css +73 -0
- package/dist/repository/components/conflicts/repository-conflicts.css +125 -0
- package/dist/repository/components/file-history-view.d.ts +15 -0
- package/dist/repository/components/file-history-view.js +110 -0
- package/dist/repository/components/operation-view.d.ts +16 -0
- package/dist/repository/components/operation-view.js +95 -0
- package/dist/repository/components/repository-backup.d.ts +22 -0
- package/dist/repository/components/repository-backup.js +75 -0
- package/dist/repository/components/repository-column-chrome.css +35 -0
- package/dist/repository/components/repository-commit-picker.css +55 -0
- package/dist/repository/components/repository-feedback.d.ts +7 -0
- package/dist/repository/components/repository-feedback.js +40 -0
- package/dist/repository/components/repository-identifiers.css +199 -0
- package/dist/repository/components/repository-navigation.d.ts +4 -0
- package/dist/repository/components/repository-navigation.js +16 -0
- package/dist/repository/components/repository-operation-column.css +112 -0
- package/dist/repository/components/repository-picker-options.css +11 -0
- package/dist/repository/components/repository-plugin.d.ts +33 -0
- package/dist/repository/components/repository-plugin.js +191 -0
- package/dist/repository/components/repository-review-identifiers.css +50 -0
- package/dist/repository/components/repository-status.d.ts +13 -0
- package/dist/repository/components/repository-status.js +227 -0
- package/dist/repository/components/repository-sync.d.ts +13 -0
- package/dist/repository/components/repository-sync.js +93 -0
- package/dist/repository/components/repository-tools.d.ts +3 -0
- package/dist/repository/components/repository-tools.js +13 -0
- package/dist/repository/components/repository-view.d.ts +16 -0
- package/dist/repository/components/repository-view.js +140 -0
- package/dist/repository/components/restore-controller.d.ts +9 -0
- package/dist/repository/components/restore-controller.js +44 -0
- package/dist/repository/components/search/search-provider.d.ts +3 -0
- package/dist/repository/components/search/search-provider.js +185 -0
- package/dist/repository/controllers/adoption-controller.d.ts +29 -0
- package/dist/repository/controllers/adoption-controller.js +145 -0
- package/dist/repository/controllers/adoption.d.ts +30 -0
- package/dist/repository/controllers/adoption.js +21 -0
- package/dist/repository/controllers/ai-history.d.ts +57 -0
- package/dist/repository/controllers/ai-history.js +51 -0
- package/dist/repository/controllers/author.d.ts +2 -0
- package/dist/repository/controllers/author.js +11 -0
- package/dist/repository/controllers/background-work.d.ts +14 -0
- package/dist/repository/controllers/background-work.js +57 -0
- package/dist/repository/controllers/backup-follow.d.ts +5 -0
- package/dist/repository/controllers/backup-follow.js +29 -0
- package/dist/repository/controllers/backup.d.ts +39 -0
- package/dist/repository/controllers/backup.js +129 -0
- package/dist/repository/controllers/blame-chunks.d.ts +13 -0
- package/dist/repository/controllers/blame-chunks.js +51 -0
- package/dist/repository/controllers/blame-controller.d.ts +17 -0
- package/dist/repository/controllers/blame-controller.js +148 -0
- package/dist/repository/controllers/blame-model.d.ts +25 -0
- package/dist/repository/controllers/blame-model.js +31 -0
- package/dist/repository/controllers/blame-preferences.d.ts +3 -0
- package/dist/repository/controllers/blame-preferences.js +18 -0
- package/dist/repository/controllers/commit-cards.d.ts +4 -0
- package/dist/repository/controllers/commit-cards.js +38 -0
- package/dist/repository/controllers/conflict-menu.d.ts +2 -0
- package/dist/repository/controllers/conflict-menu.js +1 -0
- package/dist/repository/controllers/file-history-controller.d.ts +29 -0
- package/dist/repository/controllers/file-history-controller.js +182 -0
- package/dist/repository/controllers/forge-accounts.d.ts +48 -0
- package/dist/repository/controllers/forge-accounts.js +1 -0
- package/dist/repository/controllers/forge-controller.d.ts +24 -0
- package/dist/repository/controllers/forge-controller.js +168 -0
- package/dist/repository/controllers/graph/model.d.ts +20 -0
- package/dist/repository/controllers/graph/model.js +33 -0
- package/dist/repository/controllers/graph/repository-log-graph.d.ts +44 -0
- package/dist/repository/controllers/graph/repository-log-graph.js +182 -0
- package/dist/repository/controllers/graph/repository-log-lanes.d.ts +7 -0
- package/dist/repository/controllers/graph/repository-log-lanes.js +19 -0
- package/dist/repository/controllers/graph/revision-id.d.ts +3 -0
- package/dist/repository/controllers/graph/revision-id.js +10 -0
- package/dist/repository/controllers/history-canvas.d.ts +2 -0
- package/dist/repository/controllers/history-canvas.js +45 -0
- package/dist/repository/controllers/history-controller.d.ts +31 -0
- package/dist/repository/controllers/history-controller.js +238 -0
- package/dist/repository/controllers/history-files.d.ts +7 -0
- package/dist/repository/controllers/history-files.js +18 -0
- package/dist/repository/controllers/history-graph.d.ts +20 -0
- package/dist/repository/controllers/history-graph.js +89 -0
- package/dist/repository/controllers/history-index-controller.d.ts +22 -0
- package/dist/repository/controllers/history-index-controller.js +77 -0
- package/dist/repository/controllers/history-lifetime.d.ts +13 -0
- package/dist/repository/controllers/history-lifetime.js +40 -0
- package/dist/repository/controllers/history-reader.d.ts +22 -0
- package/dist/repository/controllers/history-reader.js +1 -0
- package/dist/repository/controllers/history-search-expression.d.ts +9 -0
- package/dist/repository/controllers/history-search-expression.js +86 -0
- package/dist/repository/controllers/history-selection.d.ts +5 -0
- package/dist/repository/controllers/history-selection.js +32 -0
- package/dist/repository/controllers/history-source.d.ts +10 -0
- package/dist/repository/controllers/history-source.js +7 -0
- package/dist/repository/controllers/history-state.d.ts +34 -0
- package/dist/repository/controllers/history-state.js +55 -0
- package/dist/repository/controllers/indexed-search-validation.d.ts +4 -0
- package/dist/repository/controllers/indexed-search-validation.js +64 -0
- package/dist/repository/controllers/indexed-search.d.ts +11 -0
- package/dist/repository/controllers/indexed-search.js +1 -0
- package/dist/repository/controllers/log-canvas.d.ts +2 -0
- package/dist/repository/controllers/log-canvas.js +25 -0
- package/dist/repository/controllers/native-indexed-search.d.ts +4 -0
- package/dist/repository/controllers/native-indexed-search.js +10 -0
- package/dist/repository/controllers/open-history-revision.d.ts +3 -0
- package/dist/repository/controllers/open-history-revision.js +8 -0
- package/dist/repository/controllers/operation-command.d.ts +2 -0
- package/dist/repository/controllers/operation-command.js +55 -0
- package/dist/repository/controllers/operation-controller.d.ts +33 -0
- package/dist/repository/controllers/operation-controller.js +267 -0
- package/dist/repository/controllers/operation-files.d.ts +33 -0
- package/dist/repository/controllers/operation-files.js +182 -0
- package/dist/repository/controllers/operation-graph.d.ts +17 -0
- package/dist/repository/controllers/operation-graph.js +50 -0
- package/dist/repository/controllers/operation-message.d.ts +5 -0
- package/dist/repository/controllers/operation-message.js +18 -0
- package/dist/repository/controllers/operation-metadata.d.ts +5 -0
- package/dist/repository/controllers/operation-metadata.js +26 -0
- package/dist/repository/controllers/operation-parent.d.ts +5 -0
- package/dist/repository/controllers/operation-parent.js +46 -0
- package/dist/repository/controllers/operation-state.d.ts +28 -0
- package/dist/repository/controllers/operation-state.js +26 -0
- package/dist/repository/controllers/parent-candidates.d.ts +4 -0
- package/dist/repository/controllers/parent-candidates.js +27 -0
- package/dist/repository/controllers/plugin-data.d.ts +9 -0
- package/dist/repository/controllers/plugin-data.js +33 -0
- package/dist/repository/controllers/preparation-queue.d.ts +9 -0
- package/dist/repository/controllers/preparation-queue.js +55 -0
- package/dist/repository/controllers/remote-controller.d.ts +23 -0
- package/dist/repository/controllers/remote-controller.js +98 -0
- package/dist/repository/controllers/remote.d.ts +48 -0
- package/dist/repository/controllers/remote.js +13 -0
- package/dist/repository/controllers/restore-recovery.d.ts +3 -0
- package/dist/repository/controllers/restore-recovery.js +32 -0
- package/dist/repository/controllers/restore.d.ts +66 -0
- package/dist/repository/controllers/restore.js +201 -0
- package/dist/repository/controllers/revision-comparison.d.ts +20 -0
- package/dist/repository/controllers/revision-comparison.js +89 -0
- package/dist/repository/controllers/search-controller.d.ts +19 -0
- package/dist/repository/controllers/search-controller.js +105 -0
- package/dist/repository/controllers/search-page.d.ts +2 -0
- package/dist/repository/controllers/search-page.js +39 -0
- package/dist/repository/controllers/search.d.ts +51 -0
- package/dist/repository/controllers/search.js +8 -0
- package/dist/repository/controllers/services.d.ts +7 -0
- package/dist/repository/controllers/services.js +24 -0
- package/dist/repository/controllers/storage-controller.d.ts +30 -0
- package/dist/repository/controllers/storage-controller.js +130 -0
- package/dist/repository/controllers/storage.d.ts +26 -0
- package/dist/repository/controllers/storage.js +1 -0
- package/dist/repository/controllers/sync-application.d.ts +17 -0
- package/dist/repository/controllers/sync-application.js +45 -0
- package/dist/repository/controllers/sync-controller.d.ts +31 -0
- package/dist/repository/controllers/sync-controller.js +300 -0
- package/dist/repository/controllers/sync-publication.d.ts +7 -0
- package/dist/repository/controllers/sync-publication.js +29 -0
- package/dist/repository/controllers/sync-recovery.d.ts +7 -0
- package/dist/repository/controllers/sync-recovery.js +27 -0
- package/dist/repository/controllers/sync.d.ts +62 -0
- package/dist/repository/controllers/sync.js +38 -0
- package/dist/repository/controllers/tags.d.ts +7 -0
- package/dist/repository/controllers/tags.js +71 -0
- package/dist/repository/controllers/transcript-paths.d.ts +2 -0
- package/dist/repository/controllers/transcript-paths.js +17 -0
- package/dist/repository/controllers/transcript-writers.d.ts +9 -0
- package/dist/repository/controllers/transcript-writers.js +37 -0
- package/dist/repository/controllers/working-copy-controller.d.ts +22 -0
- package/dist/repository/controllers/working-copy-controller.js +58 -0
- package/dist/repository/controllers/working-copy-status.d.ts +16 -0
- package/dist/repository/controllers/working-copy-status.js +57 -0
- package/dist/repository/controllers/workspaces.d.ts +7 -0
- package/dist/repository/controllers/workspaces.js +4 -0
- package/dist/repository/index.d.ts +9 -0
- package/dist/repository/index.js +6 -0
- package/manifest.json +2 -2
- package/package.json +41 -9
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OperationFiles } from "./operation-files.js";
|
|
2
|
+
import type { LocalGraphOperationNode } from "@lapismd/jj-history";
|
|
3
|
+
import type { HistoryReader } from "./history-reader.js";
|
|
4
|
+
import { pause } from "./history-selection.js";
|
|
5
|
+
import { type OperationState } from "./operation-state.js";
|
|
6
|
+
/** Independent operation-pinned reader; it shares no mutable history selection. */
|
|
7
|
+
export declare class OperationController {
|
|
8
|
+
#private;
|
|
9
|
+
readonly files: OperationFiles;
|
|
10
|
+
readonly reader: HistoryReader;
|
|
11
|
+
readonly feedback: {
|
|
12
|
+
report(error: unknown): void;
|
|
13
|
+
recovered(): void;
|
|
14
|
+
};
|
|
15
|
+
readonly wait: typeof pause;
|
|
16
|
+
constructor(reader: HistoryReader, feedback: OperationController["feedback"], wait?: typeof pause);
|
|
17
|
+
get state(): OperationState;
|
|
18
|
+
get pinned(): boolean;
|
|
19
|
+
subscribe(listener: (state: OperationState) => void): () => void;
|
|
20
|
+
refresh(preferred?: string): Promise<void>;
|
|
21
|
+
selectPin(operation: string): Promise<void>;
|
|
22
|
+
checkpointChanged(operation: string): Promise<void>;
|
|
23
|
+
more(): Promise<void>;
|
|
24
|
+
loadRevisions(): Promise<void>;
|
|
25
|
+
loadWorkspaces(): Promise<void>;
|
|
26
|
+
selectWorkspace(workspace: string | null): Promise<void>;
|
|
27
|
+
clearSelection(): Promise<void>;
|
|
28
|
+
select(node: LocalGraphOperationNode): Promise<void>;
|
|
29
|
+
selectId(id: string): Promise<void>;
|
|
30
|
+
loadParents(): Promise<void>;
|
|
31
|
+
selectParent(parent: string): Promise<void>;
|
|
32
|
+
close(): Promise<void>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { OperationGraph } from "./operation-graph.js";
|
|
2
|
+
import { operationRevisionCards } from "./operation-metadata.js";
|
|
3
|
+
import { operationParent, operationParents } from "./operation-parent.js";
|
|
4
|
+
import { OperationFiles } from "./operation-files.js";
|
|
5
|
+
import { HistoryLifetime } from "./history-lifetime.js";
|
|
6
|
+
import { check, pause, prepared } from "./history-selection.js";
|
|
7
|
+
import { initialOperationState, resetOperationSelection, } from "./operation-state.js";
|
|
8
|
+
/** Independent operation-pinned reader; it shares no mutable history selection. */
|
|
9
|
+
export class OperationController {
|
|
10
|
+
#state = initialOperationState();
|
|
11
|
+
files;
|
|
12
|
+
#graph;
|
|
13
|
+
#listeners = new Set();
|
|
14
|
+
#lifetime;
|
|
15
|
+
#handle;
|
|
16
|
+
#selection = 0;
|
|
17
|
+
#detail = 0;
|
|
18
|
+
#request = 0;
|
|
19
|
+
#abort = new AbortController();
|
|
20
|
+
#closed = false;
|
|
21
|
+
#pinned = false;
|
|
22
|
+
#closing;
|
|
23
|
+
reader;
|
|
24
|
+
feedback;
|
|
25
|
+
wait;
|
|
26
|
+
constructor(reader, feedback, wait = pause) {
|
|
27
|
+
this.#graph = new OperationGraph(reader, () => ({
|
|
28
|
+
handle: this.#handle,
|
|
29
|
+
state: this.#state,
|
|
30
|
+
closed: this.#closed,
|
|
31
|
+
}), (patch) => this.#set(patch));
|
|
32
|
+
this.files = new OperationFiles(async (query) => {
|
|
33
|
+
check(this.#handle);
|
|
34
|
+
return reader.read(this.#handle, query);
|
|
35
|
+
}, (action) => this.#run(action), (files) => this.#set({ files }));
|
|
36
|
+
this.reader = reader;
|
|
37
|
+
this.feedback = feedback;
|
|
38
|
+
this.wait = wait;
|
|
39
|
+
this.#lifetime = new HistoryLifetime(reader);
|
|
40
|
+
}
|
|
41
|
+
get state() {
|
|
42
|
+
return this.#state;
|
|
43
|
+
}
|
|
44
|
+
get pinned() {
|
|
45
|
+
return this.#pinned || !!this.#state.selected;
|
|
46
|
+
}
|
|
47
|
+
subscribe(listener) {
|
|
48
|
+
this.#listeners.add(listener);
|
|
49
|
+
listener(this.#state);
|
|
50
|
+
return () => this.#listeners.delete(listener);
|
|
51
|
+
}
|
|
52
|
+
#set(patch) {
|
|
53
|
+
if (this.#closed)
|
|
54
|
+
return;
|
|
55
|
+
this.#state = { ...this.#state, ...patch };
|
|
56
|
+
for (const listener of this.#listeners)
|
|
57
|
+
listener(this.#state);
|
|
58
|
+
}
|
|
59
|
+
#run(action) {
|
|
60
|
+
if (this.#closed)
|
|
61
|
+
return Promise.resolve();
|
|
62
|
+
return this.#lifetime.run(async () => {
|
|
63
|
+
const request = ++this.#request;
|
|
64
|
+
this.#set({ busy: true });
|
|
65
|
+
try {
|
|
66
|
+
await action();
|
|
67
|
+
if (!this.#closed && request === this.#request)
|
|
68
|
+
this.feedback.recovered();
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (!this.#closed && request === this.#request) {
|
|
72
|
+
this.#set({ phase: this.#state.snapshot ? "ready" : "unavailable" });
|
|
73
|
+
this.feedback.report(error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
if (request === this.#request)
|
|
78
|
+
this.#set({ busy: false });
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
refresh(preferred) {
|
|
83
|
+
if (preferred)
|
|
84
|
+
this.#pinned = true;
|
|
85
|
+
return this.#run(async () => {
|
|
86
|
+
const selection = this.#selection;
|
|
87
|
+
const heads = await this.reader.heads();
|
|
88
|
+
if (selection !== this.#selection || this.#closed)
|
|
89
|
+
return;
|
|
90
|
+
this.#set({
|
|
91
|
+
heads: heads.heads,
|
|
92
|
+
headsReady: true,
|
|
93
|
+
phase: this.#state.snapshot ? "ready" : "idle",
|
|
94
|
+
});
|
|
95
|
+
if (preferred && !this.#state.operation)
|
|
96
|
+
await this.#pin(preferred);
|
|
97
|
+
else if (this.#state.operation && !this.#state.snapshot)
|
|
98
|
+
await this.#pin(this.#state.operation);
|
|
99
|
+
else if (this.#state.operation && !this.#state.ready)
|
|
100
|
+
await this.#graph.load(false);
|
|
101
|
+
else if (!this.#state.operation && heads.heads.length === 1)
|
|
102
|
+
await this.#pin(heads.heads[0]);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
selectPin(operation) {
|
|
106
|
+
this.#pinned = true;
|
|
107
|
+
return this.#run(() => this.#pin(operation));
|
|
108
|
+
}
|
|
109
|
+
checkpointChanged(operation) {
|
|
110
|
+
if (this.#closed ||
|
|
111
|
+
this.#pinned ||
|
|
112
|
+
this.#state.selected ||
|
|
113
|
+
this.#state.operation === operation)
|
|
114
|
+
return Promise.resolve();
|
|
115
|
+
return this.#run(() => this.#pin(operation));
|
|
116
|
+
}
|
|
117
|
+
async #pin(operation) {
|
|
118
|
+
const selection = ++this.#selection;
|
|
119
|
+
this.#detail++;
|
|
120
|
+
this.files.reset();
|
|
121
|
+
this.#abort.abort();
|
|
122
|
+
const abort = (this.#abort = new AbortController());
|
|
123
|
+
const prior = this.#handle;
|
|
124
|
+
this.#handle = undefined;
|
|
125
|
+
this.#set({
|
|
126
|
+
...initialOperationState(),
|
|
127
|
+
heads: this.#state.heads,
|
|
128
|
+
headsReady: this.#state.headsReady,
|
|
129
|
+
operation,
|
|
130
|
+
phase: "loading",
|
|
131
|
+
busy: true,
|
|
132
|
+
});
|
|
133
|
+
if (prior)
|
|
134
|
+
await this.#lifetime.closeHandle(prior);
|
|
135
|
+
const handle = await this.reader.open(operation);
|
|
136
|
+
this.#lifetime.handles.add(handle);
|
|
137
|
+
if (this.#closed)
|
|
138
|
+
return;
|
|
139
|
+
if (selection !== this.#selection) {
|
|
140
|
+
await this.#lifetime.closeHandle(handle);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
this.#handle = handle;
|
|
144
|
+
const snapshot = await prepared(this.reader, handle, abort.signal, this.wait);
|
|
145
|
+
check(snapshot.operation === operation);
|
|
146
|
+
if (selection !== this.#selection || this.#closed)
|
|
147
|
+
return;
|
|
148
|
+
this.#set({ snapshot, phase: "ready" });
|
|
149
|
+
await this.#graph.load(false);
|
|
150
|
+
}
|
|
151
|
+
more() {
|
|
152
|
+
return this.#run(() => this.#graph.load(true));
|
|
153
|
+
}
|
|
154
|
+
loadRevisions() {
|
|
155
|
+
return this.#run(async () => {
|
|
156
|
+
const handle = this.#handle, detail = this.#detail;
|
|
157
|
+
if (!handle)
|
|
158
|
+
return;
|
|
159
|
+
const commits = await operationRevisionCards(this.reader, handle, this.#state, () => !this.#closed && this.#handle === handle && this.#detail === detail);
|
|
160
|
+
if (commits)
|
|
161
|
+
this.#set({ commits });
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
loadWorkspaces() {
|
|
165
|
+
return this.#run(() => this.#graph.workspaces());
|
|
166
|
+
}
|
|
167
|
+
selectWorkspace(workspace) {
|
|
168
|
+
return this.#run(async () => {
|
|
169
|
+
this.#detail++;
|
|
170
|
+
this.files.reset();
|
|
171
|
+
this.#set({ workspace, ...resetOperationSelection() });
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
clearSelection() {
|
|
175
|
+
return this.#run(async () => {
|
|
176
|
+
this.#detail++;
|
|
177
|
+
this.files.reset();
|
|
178
|
+
this.#set(resetOperationSelection());
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
select(node) {
|
|
182
|
+
return this.#run(async () => {
|
|
183
|
+
const selected = this.#state.selected?.id === node.id
|
|
184
|
+
? this.#state.selected
|
|
185
|
+
: this.#state.nodes.find((item) => item.id === node.id);
|
|
186
|
+
check(selected);
|
|
187
|
+
await this.#selectNode(selected);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
selectId(id) {
|
|
191
|
+
return this.#run(async () => {
|
|
192
|
+
const known = this.#state.nodes.find((node) => node.id === id);
|
|
193
|
+
if (known)
|
|
194
|
+
return this.#selectNode(known);
|
|
195
|
+
const handle = this.#handle;
|
|
196
|
+
check(handle && this.#state.selected?.parents.includes(id));
|
|
197
|
+
const request = ++this.#detail;
|
|
198
|
+
const node = await operationParent(this.reader, handle, this.#state.operation, this.#state.selected.id, id, () => !this.#closed && handle === this.#handle && request === this.#detail);
|
|
199
|
+
if (node)
|
|
200
|
+
await this.#selectNode(node);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
async #selectNode(selected) {
|
|
204
|
+
this.#detail++;
|
|
205
|
+
this.files.reset();
|
|
206
|
+
this.#set({
|
|
207
|
+
selected,
|
|
208
|
+
parent: undefined,
|
|
209
|
+
detail: undefined,
|
|
210
|
+
parentNodes: [],
|
|
211
|
+
});
|
|
212
|
+
if (selected.parents.length <= 1)
|
|
213
|
+
await this.#compare(selected.parents[0]);
|
|
214
|
+
}
|
|
215
|
+
loadParents() {
|
|
216
|
+
return this.#run(async () => {
|
|
217
|
+
const handle = this.#handle, selected = this.#state.selected, request = this.#detail;
|
|
218
|
+
if (!handle || !selected)
|
|
219
|
+
return;
|
|
220
|
+
const parentNodes = await operationParents(this.reader, handle, this.#state.operation, selected.id, selected.parents, [...this.#state.nodes, ...this.#state.parentNodes], () => !this.#closed && handle === this.#handle && request === this.#detail);
|
|
221
|
+
if (parentNodes)
|
|
222
|
+
this.#set({ parentNodes });
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
selectParent(parent) {
|
|
226
|
+
return this.#run(async () => {
|
|
227
|
+
check(this.#state.selected?.parents.includes(parent));
|
|
228
|
+
await this.#compare(parent);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
async #compare(parent) {
|
|
232
|
+
const handle = this.#handle, selected = this.#state.selected;
|
|
233
|
+
if (!handle || !selected)
|
|
234
|
+
return;
|
|
235
|
+
const request = ++this.#detail;
|
|
236
|
+
this.files.reset();
|
|
237
|
+
this.#set({ parent, detail: undefined });
|
|
238
|
+
const response = await this.reader.read(handle, {
|
|
239
|
+
kind: "operation_diff",
|
|
240
|
+
query: { operation: selected.id, parent },
|
|
241
|
+
});
|
|
242
|
+
if (this.#closed || handle !== this.#handle || request !== this.#detail)
|
|
243
|
+
return;
|
|
244
|
+
check(response.kind === "operation_diff" &&
|
|
245
|
+
response.data.data.operation === selected.id);
|
|
246
|
+
const detail = response.data.data;
|
|
247
|
+
if ("parent" in detail)
|
|
248
|
+
check(detail.parent === parent);
|
|
249
|
+
else if ("status" in detail && detail.status === "root")
|
|
250
|
+
check(!selected.parents.length);
|
|
251
|
+
this.#set({ detail });
|
|
252
|
+
if (detail.status === "difference")
|
|
253
|
+
await this.files.load(selected.id, detail.parent);
|
|
254
|
+
}
|
|
255
|
+
close() {
|
|
256
|
+
this.#closed = true;
|
|
257
|
+
this.#selection++;
|
|
258
|
+
this.#detail++;
|
|
259
|
+
this.files.reset();
|
|
260
|
+
this.#abort.abort();
|
|
261
|
+
this.#listeners.clear();
|
|
262
|
+
return (this.#closing ??= this.#lifetime.drain().catch((error) => {
|
|
263
|
+
this.#closing = undefined;
|
|
264
|
+
throw error;
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { LocalCodeQuery, LocalCodeResponse, LocalFileDiffChange, LocalOperationChangesGroup } from "@lapismd/jj-history";
|
|
2
|
+
export interface OperationFilesState {
|
|
3
|
+
ready: boolean;
|
|
4
|
+
groups: LocalOperationChangesGroup[];
|
|
5
|
+
next?: string | null;
|
|
6
|
+
group?: LocalOperationChangesGroup;
|
|
7
|
+
from?: string;
|
|
8
|
+
to?: string;
|
|
9
|
+
paths: LocalFileDiffChange[];
|
|
10
|
+
pathsReady: boolean;
|
|
11
|
+
nextPath?: string | null;
|
|
12
|
+
path?: string;
|
|
13
|
+
diff?: LocalFileDiffChange;
|
|
14
|
+
}
|
|
15
|
+
export declare const initialOperationFiles: () => OperationFilesState;
|
|
16
|
+
/** Shares the operation reader's lifetime; every reset fences delayed replies. */
|
|
17
|
+
export declare class OperationFiles {
|
|
18
|
+
#private;
|
|
19
|
+
state: OperationFilesState;
|
|
20
|
+
readonly read: (q: LocalCodeQuery) => Promise<LocalCodeResponse>;
|
|
21
|
+
readonly run: (f: () => Promise<void>) => Promise<void>;
|
|
22
|
+
readonly changed: (s: OperationFilesState) => void;
|
|
23
|
+
constructor(read: OperationFiles["read"], run: OperationFiles["run"], changed: OperationFiles["changed"]);
|
|
24
|
+
reset(): void;
|
|
25
|
+
load(operation: string, parent: string): Promise<void>;
|
|
26
|
+
more(): Promise<void>;
|
|
27
|
+
retry(): Promise<void>;
|
|
28
|
+
selectGroup(change: string): Promise<void>;
|
|
29
|
+
compare(from: string, to: string): Promise<void>;
|
|
30
|
+
morePaths(): Promise<void>;
|
|
31
|
+
retryPaths(): Promise<void>;
|
|
32
|
+
selectPath(path: string): Promise<void>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { check } from "./history-selection.js";
|
|
2
|
+
export const initialOperationFiles = () => ({
|
|
3
|
+
ready: false,
|
|
4
|
+
groups: [],
|
|
5
|
+
paths: [],
|
|
6
|
+
pathsReady: false,
|
|
7
|
+
});
|
|
8
|
+
/** Shares the operation reader's lifetime; every reset fences delayed replies. */
|
|
9
|
+
export class OperationFiles {
|
|
10
|
+
state = initialOperationFiles();
|
|
11
|
+
#epoch = 0;
|
|
12
|
+
#file = 0;
|
|
13
|
+
#operation;
|
|
14
|
+
#parent;
|
|
15
|
+
read;
|
|
16
|
+
run;
|
|
17
|
+
changed;
|
|
18
|
+
constructor(read, run, changed) {
|
|
19
|
+
this.read = read;
|
|
20
|
+
this.run = run;
|
|
21
|
+
this.changed = changed;
|
|
22
|
+
}
|
|
23
|
+
#set(patch) {
|
|
24
|
+
this.state = { ...this.state, ...patch };
|
|
25
|
+
this.changed(this.state);
|
|
26
|
+
}
|
|
27
|
+
reset() {
|
|
28
|
+
this.#epoch++;
|
|
29
|
+
this.#file++;
|
|
30
|
+
this.#operation = undefined;
|
|
31
|
+
this.#parent = undefined;
|
|
32
|
+
this.state = initialOperationFiles();
|
|
33
|
+
this.changed(this.state);
|
|
34
|
+
}
|
|
35
|
+
async load(operation, parent) {
|
|
36
|
+
this.reset();
|
|
37
|
+
this.#operation = operation;
|
|
38
|
+
this.#parent = parent;
|
|
39
|
+
await this.#groups(false);
|
|
40
|
+
}
|
|
41
|
+
more() {
|
|
42
|
+
return this.run(() => this.#groups(true));
|
|
43
|
+
}
|
|
44
|
+
retry() {
|
|
45
|
+
return this.run(() => this.#groups(false));
|
|
46
|
+
}
|
|
47
|
+
async #groups(append) {
|
|
48
|
+
const operation = this.#operation, parent = this.#parent, epoch = this.#epoch;
|
|
49
|
+
if (!operation || !parent || (append && !this.state.next))
|
|
50
|
+
return;
|
|
51
|
+
const response = await this.read({
|
|
52
|
+
kind: "operation_changes",
|
|
53
|
+
query: {
|
|
54
|
+
operation,
|
|
55
|
+
parent,
|
|
56
|
+
limit: 100,
|
|
57
|
+
anchor: append ? this.state.next : null,
|
|
58
|
+
direction: "forward",
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
if (epoch !== this.#epoch)
|
|
62
|
+
return;
|
|
63
|
+
check(response.kind === "operation_changes" &&
|
|
64
|
+
response.data.operation === operation &&
|
|
65
|
+
response.data.parent === parent);
|
|
66
|
+
const retained = append ? this.state.groups : [];
|
|
67
|
+
const ids = new Set(retained.map((g) => g.change));
|
|
68
|
+
for (const group of response.data.groups) {
|
|
69
|
+
check(!ids.has(group.change));
|
|
70
|
+
ids.add(group.change);
|
|
71
|
+
}
|
|
72
|
+
const groups = [...retained, ...response.data.groups].slice(0, 500);
|
|
73
|
+
this.#set({
|
|
74
|
+
groups,
|
|
75
|
+
ready: true,
|
|
76
|
+
next: groups.length < 500 ? response.data.next : null,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
selectGroup(change) {
|
|
80
|
+
return this.run(async () => {
|
|
81
|
+
const group = this.state.groups.find((g) => g.change === change);
|
|
82
|
+
check(group);
|
|
83
|
+
this.#epoch++;
|
|
84
|
+
this.#file++;
|
|
85
|
+
this.#set({
|
|
86
|
+
group,
|
|
87
|
+
from: undefined,
|
|
88
|
+
to: undefined,
|
|
89
|
+
paths: [],
|
|
90
|
+
pathsReady: false,
|
|
91
|
+
nextPath: null,
|
|
92
|
+
path: undefined,
|
|
93
|
+
diff: undefined,
|
|
94
|
+
});
|
|
95
|
+
if (group.comparison.status === "exact")
|
|
96
|
+
await this.#compare(group.comparison.from, group.comparison.to);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
compare(from, to) {
|
|
100
|
+
return this.run(() => this.#compare(from, to));
|
|
101
|
+
}
|
|
102
|
+
async #compare(from, to) {
|
|
103
|
+
const group = this.state.group;
|
|
104
|
+
check(group);
|
|
105
|
+
const comparison = group.comparison;
|
|
106
|
+
check(comparison.status === "exact"
|
|
107
|
+
? comparison.from === from && comparison.to === to
|
|
108
|
+
: comparison.status === "select" &&
|
|
109
|
+
comparison.before.includes(from) &&
|
|
110
|
+
comparison.after.includes(to));
|
|
111
|
+
this.#epoch++;
|
|
112
|
+
this.#file++;
|
|
113
|
+
this.#set({
|
|
114
|
+
from,
|
|
115
|
+
to,
|
|
116
|
+
paths: [],
|
|
117
|
+
pathsReady: false,
|
|
118
|
+
nextPath: null,
|
|
119
|
+
path: undefined,
|
|
120
|
+
diff: undefined,
|
|
121
|
+
});
|
|
122
|
+
await this.#paths(false);
|
|
123
|
+
}
|
|
124
|
+
morePaths() {
|
|
125
|
+
return this.run(() => this.#paths(true));
|
|
126
|
+
}
|
|
127
|
+
retryPaths() {
|
|
128
|
+
return this.run(() => this.#paths(false));
|
|
129
|
+
}
|
|
130
|
+
async #paths(append) {
|
|
131
|
+
const { from, to, nextPath } = this.state, epoch = this.#epoch;
|
|
132
|
+
if (!from || !to || (append && !nextPath))
|
|
133
|
+
return;
|
|
134
|
+
const response = await this.read({
|
|
135
|
+
kind: "diff_paths",
|
|
136
|
+
query: {
|
|
137
|
+
from,
|
|
138
|
+
to,
|
|
139
|
+
path: "",
|
|
140
|
+
limit: 100,
|
|
141
|
+
anchor: append ? nextPath : null,
|
|
142
|
+
direction: "forward",
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
if (epoch !== this.#epoch)
|
|
146
|
+
return;
|
|
147
|
+
check(response.kind === "diff_paths" &&
|
|
148
|
+
response.data.from === from &&
|
|
149
|
+
response.data.to === to);
|
|
150
|
+
const paths = [
|
|
151
|
+
...(append ? this.state.paths : []),
|
|
152
|
+
...response.data.changes,
|
|
153
|
+
].slice(0, 500);
|
|
154
|
+
this.#set({
|
|
155
|
+
paths,
|
|
156
|
+
pathsReady: true,
|
|
157
|
+
nextPath: paths.length < 500 ? response.data.next : null,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
selectPath(path) {
|
|
161
|
+
return this.run(async () => {
|
|
162
|
+
const { from, to } = this.state, epoch = this.#epoch, request = ++this.#file;
|
|
163
|
+
if (!from || !to)
|
|
164
|
+
return;
|
|
165
|
+
check(this.state.paths.some((p) => p.path === path));
|
|
166
|
+
this.#set({ path, diff: undefined });
|
|
167
|
+
const response = await this.read({
|
|
168
|
+
kind: "diff",
|
|
169
|
+
query: { from, to, path, content: true },
|
|
170
|
+
});
|
|
171
|
+
if (epoch !== this.#epoch || request !== this.#file)
|
|
172
|
+
return;
|
|
173
|
+
check(response.kind === "diff" &&
|
|
174
|
+
response.data.from === from &&
|
|
175
|
+
response.data.to === to &&
|
|
176
|
+
response.data.path === path);
|
|
177
|
+
const diff = response.data.changes.find((c) => c.path === path);
|
|
178
|
+
check(diff);
|
|
179
|
+
this.#set({ diff });
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Handle } from "@lapismd/jj-history";
|
|
2
|
+
import type { HistoryReader } from "./history-reader.js";
|
|
3
|
+
import type { OperationState } from "./operation-state.js";
|
|
4
|
+
type Scope = {
|
|
5
|
+
handle?: Handle;
|
|
6
|
+
state: OperationState;
|
|
7
|
+
closed: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare class OperationGraph {
|
|
10
|
+
readonly reader: HistoryReader;
|
|
11
|
+
readonly scope: () => Scope;
|
|
12
|
+
readonly publish: (patch: Partial<OperationState>) => void;
|
|
13
|
+
constructor(reader: HistoryReader, scope: () => Scope, publish: (patch: Partial<OperationState>) => void);
|
|
14
|
+
load(append: boolean): Promise<void>;
|
|
15
|
+
workspaces(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { check } from "./history-selection.js";
|
|
2
|
+
import { workspaceCommits } from "./operation-metadata.js";
|
|
3
|
+
export class OperationGraph {
|
|
4
|
+
reader;
|
|
5
|
+
scope;
|
|
6
|
+
publish;
|
|
7
|
+
constructor(reader, scope, publish) {
|
|
8
|
+
this.reader = reader;
|
|
9
|
+
this.scope = scope;
|
|
10
|
+
this.publish = publish;
|
|
11
|
+
}
|
|
12
|
+
async load(append) {
|
|
13
|
+
const handle = this.scope().handle, operation = this.scope().state.operation;
|
|
14
|
+
if (!handle || !operation || (append && !this.scope().state.next))
|
|
15
|
+
return;
|
|
16
|
+
const response = await this.reader.read(handle, {
|
|
17
|
+
kind: "graph",
|
|
18
|
+
query: [
|
|
19
|
+
{ graph: "operations" },
|
|
20
|
+
{ limit: 50, after: append ? this.scope().state.next : null },
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
if (handle !== this.scope().handle || this.scope().closed)
|
|
24
|
+
return;
|
|
25
|
+
check(response.kind === "graph" &&
|
|
26
|
+
response.data.operation === operation &&
|
|
27
|
+
response.data.data.graph === "operations");
|
|
28
|
+
const retained = append ? this.scope().state.nodes : [];
|
|
29
|
+
const incoming = response.data.data.nodes;
|
|
30
|
+
const ids = new Set(retained.map((node) => node.id));
|
|
31
|
+
for (const node of incoming) {
|
|
32
|
+
check(!ids.has(node.id));
|
|
33
|
+
ids.add(node.id);
|
|
34
|
+
}
|
|
35
|
+
const nodes = [...retained, ...incoming].slice(0, 200);
|
|
36
|
+
this.publish({
|
|
37
|
+
nodes,
|
|
38
|
+
ready: true,
|
|
39
|
+
next: nodes.length < 200 ? response.data.next : null,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async workspaces() {
|
|
43
|
+
const { handle, state } = this.scope();
|
|
44
|
+
if (!handle || !state.operation)
|
|
45
|
+
return;
|
|
46
|
+
const commits = await workspaceCommits(this.reader, handle, state.operation);
|
|
47
|
+
if (!this.scope().closed && handle === this.scope().handle)
|
|
48
|
+
this.publish({ workspaceCommits: commits });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** jj-store message tokenization: complete native/Git commit and change IDs only. */
|
|
2
|
+
export function operationMessageParts(message) {
|
|
3
|
+
const identity = /\b(?:[0-9a-fA-F]{128}|[0-9a-fA-F]{40}|[0-9a-fA-F]{32})\b/gu;
|
|
4
|
+
const parts = [];
|
|
5
|
+
let last = 0;
|
|
6
|
+
for (const match of message.matchAll(identity)) {
|
|
7
|
+
if (match.index > last)
|
|
8
|
+
parts.push({ type: "text", value: message.slice(last, match.index) });
|
|
9
|
+
parts.push({
|
|
10
|
+
type: match[0].length === 32 ? "change" : "commit",
|
|
11
|
+
value: match[0].toLowerCase(),
|
|
12
|
+
});
|
|
13
|
+
last = match.index + match[0].length;
|
|
14
|
+
}
|
|
15
|
+
if (last < message.length)
|
|
16
|
+
parts.push({ type: "text", value: message.slice(last) });
|
|
17
|
+
return parts.length ? parts : [{ type: "text", value: message }];
|
|
18
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Handle, LocalGraphCommit } from "@lapismd/jj-history";
|
|
2
|
+
import type { HistoryReader } from "./history-reader.js";
|
|
3
|
+
import type { OperationState } from "./operation-state.js";
|
|
4
|
+
export declare function operationRevisionCards(reader: HistoryReader, handle: Handle, state: OperationState, current: () => boolean): Promise<LocalGraphCommit[] | undefined>;
|
|
5
|
+
export declare function workspaceCommits(reader: HistoryReader, handle: Handle, operation: string): Promise<LocalGraphCommit[]>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { parentCandidates } from "./parent-candidates.js";
|
|
2
|
+
import { check } from "./history-selection.js";
|
|
3
|
+
export function operationRevisionCards(reader, handle, state, current) {
|
|
4
|
+
const ids = [
|
|
5
|
+
...new Set(state.files.groups.flatMap((g) => [...g.after, ...g.before])),
|
|
6
|
+
].slice(0, 64);
|
|
7
|
+
return parentCandidates(reader, handle, ids, state.commits, current);
|
|
8
|
+
}
|
|
9
|
+
export async function workspaceCommits(reader, handle, operation) {
|
|
10
|
+
const response = await reader.read(handle, {
|
|
11
|
+
kind: "graph",
|
|
12
|
+
query: [
|
|
13
|
+
{
|
|
14
|
+
graph: "log",
|
|
15
|
+
revset: "working_copies()",
|
|
16
|
+
user_email: "",
|
|
17
|
+
at_time_millis: Date.now(),
|
|
18
|
+
},
|
|
19
|
+
{ limit: 64, after: null },
|
|
20
|
+
],
|
|
21
|
+
});
|
|
22
|
+
check(response.kind === "graph" &&
|
|
23
|
+
response.data.operation === operation &&
|
|
24
|
+
response.data.data.graph === "log");
|
|
25
|
+
return response.data.data.nodes.map((n) => n.commit);
|
|
26
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Handle, LocalGraphOperationNode } from "@lapismd/jj-history";
|
|
2
|
+
import type { HistoryReader } from "./history-reader.js";
|
|
3
|
+
/** Resolve metadata through the desktop's qualified immutable graph profile. */
|
|
4
|
+
export declare function operationParents(reader: HistoryReader, handle: Handle, pin: string, selected: string, parents: readonly string[], known: readonly LocalGraphOperationNode[], current: () => boolean): Promise<LocalGraphOperationNode[] | undefined>;
|
|
5
|
+
export declare function operationParent(reader: HistoryReader, handle: Handle, pin: string, selected: string, parent: string, current: () => boolean): Promise<LocalGraphOperationNode | undefined>;
|