@gitkraken/core-gitlens 0.4.0 → 0.4.100
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 +71 -1
- package/README.md +9 -2
- package/dist/git/cache.d.ts +29 -2
- package/dist/git/cache.d.ts.map +1 -1
- package/dist/git/cache.js +67 -7
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts.map +1 -1
- package/dist/git/errors.d.ts +31 -1
- package/dist/git/errors.d.ts.map +1 -1
- package/dist/git/errors.js +29 -0
- package/dist/git/errors.js.map +1 -1
- package/dist/git/models/author.d.ts.map +1 -1
- package/dist/git/models/author.js.map +1 -1
- package/dist/git/models/autolink.d.ts.map +1 -1
- package/dist/git/models/autolink.js.map +1 -1
- package/dist/git/models/blame.d.ts.map +1 -1
- package/dist/git/models/blame.js.map +1 -1
- package/dist/git/models/branch.d.ts.map +1 -1
- package/dist/git/models/branch.js.map +1 -1
- package/dist/git/models/commit.d.ts.map +1 -1
- package/dist/git/models/commit.js +1 -1
- package/dist/git/models/commit.js.map +1 -1
- package/dist/git/models/contributor.d.ts.map +1 -1
- package/dist/git/models/contributor.js.map +1 -1
- package/dist/git/models/defaultBranch.d.ts.map +1 -1
- package/dist/git/models/defaultBranch.js.map +1 -1
- package/dist/git/models/diff.d.ts.map +1 -1
- package/dist/git/models/diff.js.map +1 -1
- package/dist/git/models/file.d.ts.map +1 -1
- package/dist/git/models/file.js.map +1 -1
- package/dist/git/models/fileChange.d.ts.map +1 -1
- package/dist/git/models/fileChange.js.map +1 -1
- package/dist/git/models/fileStatus.d.ts +22 -22
- package/dist/git/models/fileStatus.d.ts.map +1 -1
- package/dist/git/models/fileStatus.js.map +1 -1
- package/dist/git/models/graph.d.ts +122 -1
- package/dist/git/models/graph.d.ts.map +1 -1
- package/dist/git/models/graph.js +4 -0
- package/dist/git/models/graph.js.map +1 -1
- package/dist/git/models/graphSearch.d.ts.map +1 -1
- package/dist/git/models/graphSearch.js.map +1 -1
- package/dist/git/models/graphSession.d.ts +177 -0
- package/dist/git/models/graphSession.d.ts.map +1 -0
- package/dist/git/models/graphSession.js +7 -0
- package/dist/git/models/graphSession.js.map +1 -0
- package/dist/git/models/issue.d.ts +12 -2
- package/dist/git/models/issue.d.ts.map +1 -1
- package/dist/git/models/issue.js +3 -1
- package/dist/git/models/issue.js.map +1 -1
- package/dist/git/models/issueOrPullRequest.d.ts.map +1 -1
- package/dist/git/models/issueOrPullRequest.js.map +1 -1
- package/dist/git/models/lineRange.d.ts.map +1 -1
- package/dist/git/models/lineRange.js.map +1 -1
- package/dist/git/models/log.d.ts.map +1 -1
- package/dist/git/models/log.js.map +1 -1
- package/dist/git/models/mergeConflicts.d.ts.map +1 -1
- package/dist/git/models/mergeConflicts.js.map +1 -1
- package/dist/git/models/patch.d.ts.map +1 -1
- package/dist/git/models/patch.js.map +1 -1
- package/dist/git/models/pausedOperationStatus.d.ts.map +1 -1
- package/dist/git/models/pausedOperationStatus.js.map +1 -1
- package/dist/git/models/pullRequest.d.ts +27 -2
- package/dist/git/models/pullRequest.d.ts.map +1 -1
- package/dist/git/models/pullRequest.js +7 -1
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/models/rebase.d.ts.map +1 -1
- package/dist/git/models/rebase.js.map +1 -1
- package/dist/git/models/reference.d.ts.map +1 -1
- package/dist/git/models/reference.js.map +1 -1
- package/dist/git/models/reflog.d.ts.map +1 -1
- package/dist/git/models/reflog.js.map +1 -1
- package/dist/git/models/remote.d.ts.map +1 -1
- package/dist/git/models/remote.js.map +1 -1
- package/dist/git/models/remoteProvider.d.ts.map +1 -1
- package/dist/git/models/remoteProvider.js.map +1 -1
- package/dist/git/models/remoteResource.d.ts.map +1 -1
- package/dist/git/models/remoteResource.js.map +1 -1
- package/dist/git/models/repository.d.ts +20 -2
- package/dist/git/models/repository.d.ts.map +1 -1
- package/dist/git/models/repository.js +19 -0
- package/dist/git/models/repository.js.map +1 -1
- package/dist/git/models/repositoryChangeEvent.d.ts.map +1 -1
- package/dist/git/models/repositoryChangeEvent.js.map +1 -1
- package/dist/git/models/repositoryIdentities.d.ts.map +1 -1
- package/dist/git/models/repositoryIdentities.js.map +1 -1
- package/dist/git/models/repositoryMetadata.d.ts.map +1 -1
- package/dist/git/models/repositoryMetadata.js.map +1 -1
- package/dist/git/models/resourceDescriptor.d.ts +16 -0
- package/dist/git/models/resourceDescriptor.d.ts.map +1 -1
- package/dist/git/models/resourceDescriptor.js.map +1 -1
- package/dist/git/models/revision.d.ts.map +1 -1
- package/dist/git/models/revision.js.map +1 -1
- package/dist/git/models/search.d.ts.map +1 -1
- package/dist/git/models/search.js.map +1 -1
- package/dist/git/models/shortlog.d.ts.map +1 -1
- package/dist/git/models/shortlog.js.map +1 -1
- package/dist/git/models/signature.d.ts +14 -0
- package/dist/git/models/signature.d.ts.map +1 -1
- package/dist/git/models/signature.js.map +1 -1
- package/dist/git/models/staging.d.ts.map +1 -1
- package/dist/git/models/staging.js.map +1 -1
- package/dist/git/models/stash.d.ts.map +1 -1
- package/dist/git/models/stash.js.map +1 -1
- package/dist/git/models/status.d.ts.map +1 -1
- package/dist/git/models/status.js.map +1 -1
- package/dist/git/models/statusFile.d.ts.map +1 -1
- package/dist/git/models/statusFile.js.map +1 -1
- package/dist/git/models/tag.d.ts +11 -1
- package/dist/git/models/tag.d.ts.map +1 -1
- package/dist/git/models/tag.js +9 -2
- package/dist/git/models/tag.js.map +1 -1
- package/dist/git/models/tree.d.ts.map +1 -1
- package/dist/git/models/tree.js.map +1 -1
- package/dist/git/models/user.d.ts.map +1 -1
- package/dist/git/models/user.js.map +1 -1
- package/dist/git/models/worktree.d.ts.map +1 -1
- package/dist/git/models/worktree.js.map +1 -1
- package/dist/git/parsers/diffParser.d.ts.map +1 -1
- package/dist/git/parsers/diffParser.js +1 -1
- package/dist/git/parsers/diffParser.js.map +1 -1
- package/dist/git/parsers/rebaseTodoParser.d.ts.map +1 -1
- package/dist/git/parsers/rebaseTodoParser.js.map +1 -1
- package/dist/git/providers/blame.d.ts.map +1 -1
- package/dist/git/providers/blame.js.map +1 -1
- package/dist/git/providers/branches.d.ts +8 -1
- package/dist/git/providers/branches.d.ts.map +1 -1
- package/dist/git/providers/branches.js.map +1 -1
- package/dist/git/providers/commits.d.ts +6 -1
- package/dist/git/providers/commits.d.ts.map +1 -1
- package/dist/git/providers/commits.js.map +1 -1
- package/dist/git/providers/config.d.ts +6 -2
- package/dist/git/providers/config.d.ts.map +1 -1
- package/dist/git/providers/config.js.map +1 -1
- package/dist/git/providers/contributors.d.ts.map +1 -1
- package/dist/git/providers/contributors.js.map +1 -1
- package/dist/git/providers/diff.d.ts.map +1 -1
- package/dist/git/providers/diff.js.map +1 -1
- package/dist/git/providers/graph.d.ts +55 -1
- package/dist/git/providers/graph.d.ts.map +1 -1
- package/dist/git/providers/graph.js.map +1 -1
- package/dist/git/providers/operations.d.ts.map +1 -1
- package/dist/git/providers/operations.js.map +1 -1
- package/dist/git/providers/patch.d.ts.map +1 -1
- package/dist/git/providers/patch.js.map +1 -1
- package/dist/git/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git/providers/pausedOperations.js.map +1 -1
- package/dist/git/providers/provider.d.ts.map +1 -1
- package/dist/git/providers/provider.js.map +1 -1
- package/dist/git/providers/refs.d.ts.map +1 -1
- package/dist/git/providers/refs.js.map +1 -1
- package/dist/git/providers/remotes.d.ts.map +1 -1
- package/dist/git/providers/remotes.js.map +1 -1
- package/dist/git/providers/revision.d.ts.map +1 -1
- package/dist/git/providers/revision.js.map +1 -1
- package/dist/git/providers/shared/remotes.d.ts.map +1 -1
- package/dist/git/providers/shared/remotes.js.map +1 -1
- package/dist/git/providers/staging.d.ts.map +1 -1
- package/dist/git/providers/staging.js.map +1 -1
- package/dist/git/providers/stash.d.ts.map +1 -1
- package/dist/git/providers/stash.js.map +1 -1
- package/dist/git/providers/status.d.ts +1 -0
- package/dist/git/providers/status.d.ts.map +1 -1
- package/dist/git/providers/status.js.map +1 -1
- package/dist/git/providers/tags.d.ts.map +1 -1
- package/dist/git/providers/tags.js.map +1 -1
- package/dist/git/providers/types.d.ts.map +1 -1
- package/dist/git/providers/types.js.map +1 -1
- package/dist/git/providers/worktrees.d.ts +3 -1
- package/dist/git/providers/worktrees.d.ts.map +1 -1
- package/dist/git/providers/worktrees.js.map +1 -1
- package/dist/git/remotes/azure-devops.d.ts.map +1 -1
- package/dist/git/remotes/azure-devops.js +27 -31
- package/dist/git/remotes/azure-devops.js.map +1 -1
- package/dist/git/remotes/bitbucket-server.d.ts.map +1 -1
- package/dist/git/remotes/bitbucket-server.js +21 -23
- package/dist/git/remotes/bitbucket-server.js.map +1 -1
- package/dist/git/remotes/bitbucket.d.ts.map +1 -1
- package/dist/git/remotes/bitbucket.js +21 -23
- package/dist/git/remotes/bitbucket.js.map +1 -1
- package/dist/git/remotes/custom.d.ts.map +1 -1
- package/dist/git/remotes/custom.js.map +1 -1
- package/dist/git/remotes/gerrit.d.ts.map +1 -1
- package/dist/git/remotes/gerrit.js +11 -13
- package/dist/git/remotes/gerrit.js.map +1 -1
- package/dist/git/remotes/gitea.d.ts.map +1 -1
- package/dist/git/remotes/gitea.js +12 -14
- package/dist/git/remotes/gitea.js.map +1 -1
- package/dist/git/remotes/github.d.ts.map +1 -1
- package/dist/git/remotes/github.js +54 -56
- package/dist/git/remotes/github.js.map +1 -1
- package/dist/git/remotes/gitlab.d.ts.map +1 -1
- package/dist/git/remotes/gitlab.js +93 -95
- package/dist/git/remotes/gitlab.js.map +1 -1
- package/dist/git/remotes/google-source.d.ts.map +1 -1
- package/dist/git/remotes/google-source.js.map +1 -1
- package/dist/git/remotes/matcher.d.ts.map +1 -1
- package/dist/git/remotes/matcher.js.map +1 -1
- package/dist/git/run.types.d.ts +62 -3
- package/dist/git/run.types.d.ts.map +1 -1
- package/dist/git/service.d.ts.map +1 -1
- package/dist/git/utils/autolink.utils.d.ts.map +1 -1
- package/dist/git/utils/autolink.utils.js.map +1 -1
- package/dist/git/utils/blame.utils.d.ts.map +1 -1
- package/dist/git/utils/blame.utils.js.map +1 -1
- package/dist/git/utils/branch.utils.d.ts.map +1 -1
- package/dist/git/utils/branch.utils.js +12 -1
- package/dist/git/utils/branch.utils.js.map +1 -1
- package/dist/git/utils/commit.utils.d.ts.map +1 -1
- package/dist/git/utils/commit.utils.js.map +1 -1
- package/dist/git/utils/conflictResolution.utils.d.ts.map +1 -1
- package/dist/git/utils/conflictResolution.utils.js.map +1 -1
- package/dist/git/utils/contributor.utils.d.ts +1 -1
- package/dist/git/utils/contributor.utils.d.ts.map +1 -1
- package/dist/git/utils/contributor.utils.js +1 -2
- package/dist/git/utils/contributor.utils.js.map +1 -1
- package/dist/git/utils/fetch.utils.d.ts.map +1 -1
- package/dist/git/utils/fetch.utils.js.map +1 -1
- package/dist/git/utils/fileStatus.utils.d.ts +7 -0
- package/dist/git/utils/fileStatus.utils.d.ts.map +1 -1
- package/dist/git/utils/fileStatus.utils.js +6 -0
- package/dist/git/utils/fileStatus.utils.js.map +1 -1
- package/dist/git/utils/graph.utils.d.ts +20 -0
- package/dist/git/utils/graph.utils.d.ts.map +1 -0
- package/dist/git/utils/graph.utils.js +40 -0
- package/dist/git/utils/graph.utils.js.map +1 -0
- package/dist/git/utils/issue.utils.d.ts.map +1 -1
- package/dist/git/utils/issue.utils.js +1 -0
- package/dist/git/utils/issue.utils.js.map +1 -1
- package/dist/git/utils/issueOrPullRequest.utils.d.ts.map +1 -1
- package/dist/git/utils/issueOrPullRequest.utils.js.map +1 -1
- package/dist/git/utils/mergeConflicts.utils.d.ts.map +1 -1
- package/dist/git/utils/mergeConflicts.utils.js.map +1 -1
- package/dist/git/utils/pausedOperationStatus.utils.d.ts +13 -13
- package/dist/git/utils/pausedOperationStatus.utils.d.ts.map +1 -1
- package/dist/git/utils/pausedOperationStatus.utils.js.map +1 -1
- package/dist/git/utils/pullRequest.utils.d.ts.map +1 -1
- package/dist/git/utils/pullRequest.utils.js +9 -0
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/utils/reachability.utils.d.ts +20 -2
- package/dist/git/utils/reachability.utils.d.ts.map +1 -1
- package/dist/git/utils/reachability.utils.js +68 -7
- package/dist/git/utils/reachability.utils.js.map +1 -1
- package/dist/git/utils/rebase.utils.d.ts.map +1 -1
- package/dist/git/utils/rebase.utils.js.map +1 -1
- package/dist/git/utils/reference.utils.d.ts.map +1 -1
- package/dist/git/utils/reference.utils.js.map +1 -1
- package/dist/git/utils/remote.utils.d.ts.map +1 -1
- package/dist/git/utils/remote.utils.js.map +1 -1
- package/dist/git/utils/repository.utils.d.ts.map +1 -1
- package/dist/git/utils/repository.utils.js.map +1 -1
- package/dist/git/utils/resourceDescriptor.utils.d.ts.map +1 -1
- package/dist/git/utils/resourceDescriptor.utils.js.map +1 -1
- package/dist/git/utils/revision.utils.d.ts.map +1 -1
- package/dist/git/utils/revision.utils.js.map +1 -1
- package/dist/git/utils/search.utils.d.ts.map +1 -1
- package/dist/git/utils/search.utils.js.map +1 -1
- package/dist/git/utils/sorting.d.ts.map +1 -1
- package/dist/git/utils/sorting.js.map +1 -1
- package/dist/git/utils/sshKey.utils.d.ts +7 -0
- package/dist/git/utils/sshKey.utils.d.ts.map +1 -0
- package/dist/git/utils/sshKey.utils.js +25 -0
- package/dist/git/utils/sshKey.utils.js.map +1 -0
- package/dist/git/utils/status.utils.d.ts.map +1 -1
- package/dist/git/utils/status.utils.js.map +1 -1
- package/dist/git/utils/statusFile.utils.d.ts.map +1 -1
- package/dist/git/utils/statusFile.utils.js.map +1 -1
- package/dist/git/utils/tag.utils.d.ts.map +1 -1
- package/dist/git/utils/tag.utils.js.map +1 -1
- package/dist/git/utils/tooltip.utils.d.ts.map +1 -1
- package/dist/git/utils/tooltip.utils.js.map +1 -1
- package/dist/git/utils/uriAuthority.d.ts.map +1 -1
- package/dist/git/utils/uriAuthority.js.map +1 -1
- package/dist/git/utils/user.utils.d.ts.map +1 -1
- package/dist/git/utils/user.utils.js.map +1 -1
- package/dist/git/utils/worktree.utils.d.ts.map +1 -1
- package/dist/git/utils/worktree.utils.js.map +1 -1
- package/dist/git/watching/changeEvent.d.ts.map +1 -1
- package/dist/git/watching/changeEvent.js.map +1 -1
- package/dist/git/watching/classifyChange.d.ts.map +1 -1
- package/dist/git/watching/classifyChange.js.map +1 -1
- package/dist/git/watching/gitIgnoreFilter.d.ts.map +1 -1
- package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
- package/dist/git/watching/initWatcher.d.ts.map +1 -1
- package/dist/git/watching/initWatcher.js.map +1 -1
- package/dist/git/watching/provider.d.ts.map +1 -1
- package/dist/git/watching/provider.js.map +1 -1
- package/dist/git/watching/watchGroup.d.ts.map +1 -1
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +4 -0
- package/dist/git/watching/watchService.d.ts.map +1 -1
- package/dist/git/watching/watchService.js +15 -1
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +7 -0
- package/dist/git/watching/watchSession.d.ts.map +1 -1
- package/dist/git/watching/watchSession.js +14 -2
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/watcherPatterns.d.ts.map +1 -1
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts.map +1 -1
- package/dist/git-cli/exec/exec.d.ts.map +1 -1
- package/dist/git-cli/exec/exec.errors.d.ts.map +1 -1
- package/dist/git-cli/exec/exec.errors.js.map +1 -1
- package/dist/git-cli/exec/exec.js.map +1 -1
- package/dist/git-cli/exec/exec.types.d.ts.map +1 -1
- package/dist/git-cli/exec/exec.types.js.map +1 -1
- package/dist/git-cli/exec/features.d.ts.map +1 -1
- package/dist/git-cli/exec/features.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +19 -27
- package/dist/git-cli/exec/git.d.ts.map +1 -1
- package/dist/git-cli/exec/git.js +126 -34
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/exec/locator.d.ts.map +1 -1
- package/dist/git-cli/exec/locator.js.map +1 -1
- package/dist/git-cli/parsers/blameParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/blameParser.js.map +1 -1
- package/dist/git-cli/parsers/indexParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/indexParser.js.map +1 -1
- package/dist/git-cli/parsers/logParser.d.ts +9 -1
- package/dist/git-cli/parsers/logParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/logParser.js +141 -60
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/parsers/mergeTreeParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/mergeTreeParser.js.map +1 -1
- package/dist/git-cli/parsers/refParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/parsers/reflogParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/reflogParser.js.map +1 -1
- package/dist/git-cli/parsers/remoteParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/remoteParser.js.map +1 -1
- package/dist/git-cli/parsers/shortlogParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/shortlogParser.js.map +1 -1
- package/dist/git-cli/parsers/signatureParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/signatureParser.js.map +1 -1
- package/dist/git-cli/parsers/sshSignatureParser.d.ts +21 -0
- package/dist/git-cli/parsers/sshSignatureParser.d.ts.map +1 -0
- package/dist/git-cli/parsers/sshSignatureParser.js +78 -0
- package/dist/git-cli/parsers/sshSignatureParser.js.map +1 -0
- package/dist/git-cli/parsers/statusParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/statusParser.js.map +1 -1
- package/dist/git-cli/parsers/treeParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/treeParser.js.map +1 -1
- package/dist/git-cli/parsers/worktreeParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/worktreeParser.js +5 -7
- package/dist/git-cli/parsers/worktreeParser.js.map +1 -1
- package/dist/git-cli/providers/blame.d.ts.map +1 -1
- package/dist/git-cli/providers/blame.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +1 -0
- package/dist/git-cli/providers/branches.d.ts.map +1 -1
- package/dist/git-cli/providers/branches.js +51 -32
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commitFilesetUtils.d.ts.map +1 -1
- package/dist/git-cli/providers/commitFilesetUtils.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts +12 -1
- package/dist/git-cli/providers/commits.d.ts.map +1 -1
- package/dist/git-cli/providers/commits.js +89 -8
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts.map +1 -1
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/contributors.d.ts.map +1 -1
- package/dist/git-cli/providers/contributors.js.map +1 -1
- package/dist/git-cli/providers/diff.d.ts.map +1 -1
- package/dist/git-cli/providers/diff.js.map +1 -1
- package/dist/git-cli/providers/graph.d.ts +35 -1
- package/dist/git-cli/providers/graph.d.ts.map +1 -1
- package/dist/git-cli/providers/graph.js +1434 -330
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts.map +1 -1
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/patch.d.ts.map +1 -1
- package/dist/git-cli/providers/patch.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +3 -3
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.d.ts.map +1 -1
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/remotes.d.ts.map +1 -1
- package/dist/git-cli/providers/remotes.js.map +1 -1
- package/dist/git-cli/providers/revision.d.ts +1 -0
- package/dist/git-cli/providers/revision.d.ts.map +1 -1
- package/dist/git-cli/providers/revision.js +33 -0
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/staging.d.ts.map +1 -1
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/git-cli/providers/stash.d.ts.map +1 -1
- package/dist/git-cli/providers/stash.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +28 -0
- package/dist/git-cli/providers/status.d.ts.map +1 -1
- package/dist/git-cli/providers/status.js +240 -154
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/tags.d.ts.map +1 -1
- package/dist/git-cli/providers/tags.js +2 -1
- package/dist/git-cli/providers/tags.js.map +1 -1
- package/dist/git-cli/providers/worktrees.d.ts +2 -1
- package/dist/git-cli/providers/worktrees.d.ts.map +1 -1
- package/dist/git-cli/providers/worktrees.js +28 -3
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/git-cli/service.d.ts.map +1 -1
- package/dist/git-cli/service.js +8 -0
- package/dist/git-cli/service.js.map +1 -1
- package/dist/ipc/ipcServer.d.ts.map +1 -1
- package/dist/ipc/ipcServer.js +1 -1
- package/dist/ipc/ipcServer.js.map +1 -1
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts +6 -1
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -1
- package/dist/plus/agents/providers/claudeCodeProvider.js +19 -0
- package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +68 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +262 -8
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/agents/types.d.ts +36 -2
- package/dist/plus/agents/types.d.ts.map +1 -1
- package/dist/plus/ai/constants.d.ts +1 -2
- package/dist/plus/ai/constants.d.ts.map +1 -1
- package/dist/plus/ai/constants.js +1 -8
- package/dist/plus/ai/constants.js.map +1 -1
- package/dist/plus/ai/errors.d.ts.map +1 -1
- package/dist/plus/ai/errors.js.map +1 -1
- package/dist/plus/ai/models/conversation.d.ts.map +1 -1
- package/dist/plus/ai/models/conversation.js.map +1 -1
- package/dist/plus/ai/models/model.d.ts +2 -1
- package/dist/plus/ai/models/model.d.ts.map +1 -1
- package/dist/plus/ai/models/model.js +50 -1
- package/dist/plus/ai/models/model.js.map +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts +5 -2
- package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
- package/dist/plus/ai/models/promptTemplates.js.map +1 -1
- package/dist/plus/ai/models/provider.d.ts.map +1 -1
- package/dist/plus/ai/models/provider.js.map +1 -1
- package/dist/plus/ai/models/results.d.ts.map +1 -1
- package/dist/plus/ai/models/results.js.map +1 -1
- package/dist/plus/ai/prompts.d.ts +1 -1
- package/dist/plus/ai/prompts.d.ts.map +1 -1
- package/dist/plus/ai/prompts.js +15 -47
- package/dist/plus/ai/prompts.js.map +1 -1
- package/dist/plus/ai/providers/anthropicProvider.d.ts +5 -0
- package/dist/plus/ai/providers/anthropicProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/anthropicProvider.js +40 -3
- package/dist/plus/ai/providers/anthropicProvider.js.map +1 -1
- package/dist/plus/ai/providers/azureProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/azureProvider.js.map +1 -1
- package/dist/plus/ai/providers/context.d.ts.map +1 -1
- package/dist/plus/ai/providers/context.js.map +1 -1
- package/dist/plus/ai/providers/deepSeekProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/deepSeekProvider.js +17 -1
- package/dist/plus/ai/providers/deepSeekProvider.js.map +1 -1
- package/dist/plus/ai/providers/geminiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/geminiProvider.js +25 -6
- package/dist/plus/ai/providers/geminiProvider.js.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.js +1 -0
- package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
- package/dist/plus/ai/providers/huggingFaceProvider.d.ts +1 -1
- package/dist/plus/ai/providers/huggingFaceProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/huggingFaceProvider.js +21 -18
- package/dist/plus/ai/providers/huggingFaceProvider.js.map +1 -1
- package/dist/plus/ai/providers/mistralProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/mistralProvider.js.map +1 -1
- package/dist/plus/ai/providers/ollamaProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/ollamaProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts +10 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +9 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
- package/dist/plus/ai/providers/openRouterProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openRouterProvider.js.map +1 -1
- package/dist/plus/ai/providers/openaiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openaiProvider.js.map +1 -1
- package/dist/plus/ai/providers/xaiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/xaiProvider.js +14 -1
- package/dist/plus/ai/providers/xaiProvider.js.map +1 -1
- package/dist/plus/ai/utils/ai.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/ai.utils.js +0 -2
- package/dist/plus/ai/utils/ai.utils.js.map +1 -1
- package/dist/plus/ai/utils/results.utils.d.ts +3 -0
- package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/results.utils.js +26 -0
- package/dist/plus/ai/utils/results.utils.js.map +1 -1
- package/dist/plus/ai/utils/truncation.utils.d.ts +1 -1
- package/dist/plus/ai/utils/truncation.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/truncation.utils.js.map +1 -1
- package/dist/plus/git-github/api/config.d.ts.map +1 -1
- package/dist/plus/git-github/api/config.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +66 -3
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +345 -74
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/github.utils.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.utils.js.map +1 -1
- package/dist/plus/git-github/api/token.d.ts.map +1 -1
- package/dist/plus/git-github/api/token.js.map +1 -1
- package/dist/plus/git-github/api/tokenUtils.d.ts.map +1 -1
- package/dist/plus/git-github/api/tokenUtils.js.map +1 -1
- package/dist/plus/git-github/api/types.d.ts.map +1 -1
- package/dist/plus/git-github/api/types.js.map +1 -1
- package/dist/plus/git-github/context.d.ts.map +1 -1
- package/dist/plus/git-github/models.d.ts +5 -0
- package/dist/plus/git-github/models.d.ts.map +1 -1
- package/dist/plus/git-github/models.js +27 -2
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/git-github/providers/github/blame.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/blame.js.map +1 -1
- package/dist/plus/git-github/providers/github/branches.d.ts +2 -1
- package/dist/plus/git-github/providers/github/branches.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/branches.js +7 -3
- package/dist/plus/git-github/providers/github/branches.js.map +1 -1
- package/dist/plus/git-github/providers/github/commits.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/commits.js.map +1 -1
- package/dist/plus/git-github/providers/github/config.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/config.js.map +1 -1
- package/dist/plus/git-github/providers/github/contributors.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/contributors.js.map +1 -1
- package/dist/plus/git-github/providers/github/diff.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/diff.js +2 -2
- package/dist/plus/git-github/providers/github/diff.js.map +1 -1
- package/dist/plus/git-github/providers/github/graph.d.ts +12 -1
- package/dist/plus/git-github/providers/github/graph.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/graph.js +85 -0
- package/dist/plus/git-github/providers/github/graph.js.map +1 -1
- package/dist/plus/git-github/providers/github/refs.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/refs.js.map +1 -1
- package/dist/plus/git-github/providers/github/remotes.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/remotes.js.map +1 -1
- package/dist/plus/git-github/providers/github/revision.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/revision.js.map +1 -1
- package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/status.js.map +1 -1
- package/dist/plus/git-github/providers/github/tags.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/tags.js +3 -1
- package/dist/plus/git-github/providers/github/tags.js.map +1 -1
- package/dist/plus/git-github/providers/githubGitProvider.d.ts.map +1 -1
- package/dist/plus/git-github/providers/githubGitProvider.js.map +1 -1
- package/dist/plus/git-github/providers/githubProvider.d.ts.map +1 -1
- package/dist/plus/git-github/providers/githubProvider.js.map +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationService.d.ts +20 -1
- package/dist/plus/integrations/authentication/cloudIntegrationService.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationService.js +134 -10
- package/dist/plus/integrations/authentication/cloudIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +52 -5
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +248 -46
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +24 -4
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +58 -26
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +7 -3
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/manualTokenProvider.d.ts +1 -0
- package/dist/plus/integrations/authentication/manualTokenProvider.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/manualTokenProvider.js +9 -5
- package/dist/plus/integrations/authentication/manualTokenProvider.js.map +1 -1
- package/dist/plus/integrations/authentication/models.d.ts +33 -0
- package/dist/plus/integrations/authentication/models.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/models.js.map +1 -1
- package/dist/plus/integrations/collectionMetadata.d.ts +21 -0
- package/dist/plus/integrations/collectionMetadata.d.ts.map +1 -0
- package/dist/plus/integrations/collectionMetadata.js +121 -0
- package/dist/plus/integrations/collectionMetadata.js.map +1 -0
- package/dist/plus/integrations/constants.d.ts +12 -2
- package/dist/plus/integrations/constants.d.ts.map +1 -1
- package/dist/plus/integrations/constants.js +10 -0
- package/dist/plus/integrations/constants.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +10 -6
- package/dist/plus/integrations/context.d.ts.map +1 -1
- package/dist/plus/integrations/errors.d.ts +65 -0
- package/dist/plus/integrations/errors.d.ts.map +1 -1
- package/dist/plus/integrations/errors.js +131 -0
- package/dist/plus/integrations/errors.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +57 -12
- package/dist/plus/integrations/index.d.ts.map +1 -1
- package/dist/plus/integrations/index.js +39 -37
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +293 -12
- package/dist/plus/integrations/integrationService.d.ts.map +1 -1
- package/dist/plus/integrations/integrationService.js +1305 -37
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/lite.d.ts +47 -0
- package/dist/plus/integrations/lite.d.ts.map +1 -0
- package/dist/plus/integrations/lite.js +141 -0
- package/dist/plus/integrations/lite.js.map +1 -0
- package/dist/plus/integrations/manager.d.ts +332 -0
- package/dist/plus/integrations/manager.d.ts.map +1 -0
- package/dist/plus/integrations/manager.js +2 -0
- package/dist/plus/integrations/manager.js.map +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +269 -10
- package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +712 -88
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +88 -3
- package/dist/plus/integrations/models/integration.d.ts.map +1 -1
- package/dist/plus/integrations/models/integration.js +192 -21
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.d.ts +87 -7
- package/dist/plus/integrations/models/issuesIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.js +148 -33
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/providerFilters.d.ts +12 -0
- package/dist/plus/integrations/providerFilters.d.ts.map +1 -0
- package/dist/plus/integrations/providerFilters.js +14 -0
- package/dist/plus/integrations/providerFilters.js.map +1 -0
- package/dist/plus/integrations/providers/apiClients.d.ts.map +1 -1
- package/dist/plus/integrations/providers/apiClients.js +3 -3
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/apiConfig.d.ts +52 -0
- package/dist/plus/integrations/providers/apiConfig.d.ts.map +1 -0
- package/dist/plus/integrations/providers/apiConfig.js +19 -0
- package/dist/plus/integrations/providers/apiConfig.js.map +1 -0
- package/dist/plus/integrations/providers/azure/azure.d.ts +14 -2
- package/dist/plus/integrations/providers/azure/azure.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +107 -32
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +16 -0
- package/dist/plus/integrations/providers/azure/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azure/models.js +6 -6
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +55 -9
- package/dist/plus/integrations/providers/azureDevOps.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.js +572 -79
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +13 -2
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js +108 -32
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.d.ts +19 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.js +20 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +28 -4
- package/dist/plus/integrations/providers/bitbucket-server.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.js +110 -6
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.d.ts +38 -4
- package/dist/plus/integrations/providers/bitbucket.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.js +330 -34
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github/github.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github/github.js +1 -1
- package/dist/plus/integrations/providers/github/github.js.map +1 -1
- package/dist/plus/integrations/providers/github/github.utils.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github/github.utils.js.map +1 -1
- package/dist/plus/integrations/providers/github/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github/models.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +49 -6
- package/dist/plus/integrations/providers/github.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github.js +289 -4
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +11 -3
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.js +121 -47
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +6 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js +8 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.d.ts +10 -0
- package/dist/plus/integrations/providers/gitlab/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.js +8 -5
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +50 -5
- package/dist/plus/integrations/providers/gitlab.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab.js +274 -8
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +13 -2
- package/dist/plus/integrations/providers/jira.d.ts.map +1 -1
- package/dist/plus/integrations/providers/jira.js +200 -30
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/linear.d.ts +16 -5
- package/dist/plus/integrations/providers/linear.d.ts.map +1 -1
- package/dist/plus/integrations/providers/linear.js +127 -21
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +339 -60
- package/dist/plus/integrations/providers/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/models.js +307 -59
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +144 -11
- package/dist/plus/integrations/providers/providersApi.d.ts.map +1 -1
- package/dist/plus/integrations/providers/providersApi.js +486 -55
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/trello.d.ts +47 -0
- package/dist/plus/integrations/providers/trello.d.ts.map +1 -0
- package/dist/plus/integrations/providers/trello.js +141 -0
- package/dist/plus/integrations/providers/trello.js.map +1 -0
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts +29 -0
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts.map +1 -0
- package/dist/plus/integrations/providers/utils/providerPaging.js +154 -0
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -0
- package/dist/plus/integrations/providers/utils.d.ts +21 -0
- package/dist/plus/integrations/providers/utils.d.ts.map +1 -1
- package/dist/plus/integrations/providers/utils.js +57 -6
- package/dist/plus/integrations/providers/utils.js.map +1 -1
- package/dist/plus/integrations/reads/context.d.ts +52 -0
- package/dist/plus/integrations/reads/context.d.ts.map +1 -0
- package/dist/plus/integrations/reads/context.js +2 -0
- package/dist/plus/integrations/reads/context.js.map +1 -0
- package/dist/plus/integrations/reads/cursors.d.ts +66 -0
- package/dist/plus/integrations/reads/cursors.d.ts.map +1 -0
- package/dist/plus/integrations/reads/cursors.js +133 -0
- package/dist/plus/integrations/reads/cursors.js.map +1 -0
- package/dist/plus/integrations/reads/drains.d.ts +60 -0
- package/dist/plus/integrations/reads/drains.d.ts.map +1 -0
- package/dist/plus/integrations/reads/drains.js +255 -0
- package/dist/plus/integrations/reads/drains.js.map +1 -0
- package/dist/plus/integrations/reads/filters.d.ts +81 -0
- package/dist/plus/integrations/reads/filters.d.ts.map +1 -0
- package/dist/plus/integrations/reads/filters.js +87 -0
- package/dist/plus/integrations/reads/filters.js.map +1 -0
- package/dist/plus/integrations/reads/hierarchy.d.ts +17 -0
- package/dist/plus/integrations/reads/hierarchy.d.ts.map +1 -0
- package/dist/plus/integrations/reads/hierarchy.js +348 -0
- package/dist/plus/integrations/reads/hierarchy.js.map +1 -0
- package/dist/plus/integrations/reads/hierarchy.utils.d.ts +53 -0
- package/dist/plus/integrations/reads/hierarchy.utils.d.ts.map +1 -0
- package/dist/plus/integrations/reads/hierarchy.utils.js +85 -0
- package/dist/plus/integrations/reads/hierarchy.utils.js.map +1 -0
- package/dist/plus/integrations/reads/issueTracker.d.ts +19 -0
- package/dist/plus/integrations/reads/issueTracker.d.ts.map +1 -0
- package/dist/plus/integrations/reads/issueTracker.js +346 -0
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -0
- package/dist/plus/integrations/reads/issues.d.ts +34 -0
- package/dist/plus/integrations/reads/issues.d.ts.map +1 -0
- package/dist/plus/integrations/reads/issues.js +244 -0
- package/dist/plus/integrations/reads/issues.js.map +1 -0
- package/dist/plus/integrations/reads/paging.d.ts +136 -0
- package/dist/plus/integrations/reads/paging.d.ts.map +1 -0
- package/dist/plus/integrations/reads/paging.js +221 -0
- package/dist/plus/integrations/reads/paging.js.map +1 -0
- package/dist/plus/integrations/reads/pullRequests.d.ts +32 -0
- package/dist/plus/integrations/reads/pullRequests.d.ts.map +1 -0
- package/dist/plus/integrations/reads/pullRequests.js +151 -0
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -0
- package/dist/plus/integrations/reads/warnings.d.ts +47 -0
- package/dist/plus/integrations/reads/warnings.d.ts.map +1 -0
- package/dist/plus/integrations/reads/warnings.js +81 -0
- package/dist/plus/integrations/reads/warnings.js.map +1 -0
- package/dist/plus/integrations/results.d.ts +189 -0
- package/dist/plus/integrations/results.d.ts.map +1 -0
- package/dist/plus/integrations/results.js +62 -0
- package/dist/plus/integrations/results.js.map +1 -0
- package/dist/plus/integrations/utils/domain.utils.d.ts +5 -0
- package/dist/plus/integrations/utils/domain.utils.d.ts.map +1 -0
- package/dist/plus/integrations/utils/domain.utils.js +27 -0
- package/dist/plus/integrations/utils/domain.utils.js.map +1 -0
- package/dist/plus/integrations/utils/integration.utils.d.ts +27 -1
- package/dist/plus/integrations/utils/integration.utils.d.ts.map +1 -1
- package/dist/plus/integrations/utils/integration.utils.js +86 -15
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
- package/dist/utils/array.d.ts.map +1 -1
- package/dist/utils/array.js.map +1 -1
- package/dist/utils/brand.d.ts.map +1 -1
- package/dist/utils/cancellation.d.ts +13 -0
- package/dist/utils/cancellation.d.ts.map +1 -1
- package/dist/utils/cancellation.js +52 -7
- package/dist/utils/cancellation.js.map +1 -1
- package/dist/utils/charCode.d.ts.map +1 -1
- package/dist/utils/coalescedRun.d.ts +16 -0
- package/dist/utils/coalescedRun.d.ts.map +1 -0
- package/dist/utils/coalescedRun.js +43 -0
- package/dist/utils/coalescedRun.js.map +1 -0
- package/dist/utils/color.d.ts.map +1 -1
- package/dist/utils/color.js +3 -3
- package/dist/utils/color.js.map +1 -1
- package/dist/utils/date.d.ts +24 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +62 -0
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/debounce.js +1 -1
- package/dist/utils/debounce.js.map +1 -1
- package/dist/utils/decorators/debounce.d.ts.map +1 -1
- package/dist/utils/decorators/debounce.js.map +1 -1
- package/dist/utils/decorators/gate.d.ts.map +1 -1
- package/dist/utils/decorators/gate.js +2 -2
- package/dist/utils/decorators/gate.js.map +1 -1
- package/dist/utils/decorators/log.d.ts.map +1 -1
- package/dist/utils/decorators/log.js +5 -5
- package/dist/utils/decorators/log.js.map +1 -1
- package/dist/utils/decorators/memoize.d.ts.map +1 -1
- package/dist/utils/decorators/memoize.js +2 -2
- package/dist/utils/decorators/memoize.js.map +1 -1
- package/dist/utils/decorators/resolver.d.ts.map +1 -1
- package/dist/utils/decorators/resolver.js.map +1 -1
- package/dist/utils/decorators/sequentialize.d.ts.map +1 -1
- package/dist/utils/decorators/sequentialize.js +2 -2
- package/dist/utils/decorators/sequentialize.js.map +1 -1
- package/dist/utils/decorators/serializable.d.ts.map +1 -1
- package/dist/utils/decorators/serializable.js +1 -1
- package/dist/utils/decorators/serializable.js.map +1 -1
- package/dist/utils/dedupedAsyncCache.d.ts.map +1 -1
- package/dist/utils/env/browser/base64.d.ts.map +1 -1
- package/dist/utils/env/browser/base64.js.map +1 -1
- package/dist/utils/env/browser/crypto.d.ts.map +1 -1
- package/dist/utils/env/browser/crypto.js.map +1 -1
- package/dist/utils/env/browser/fs.d.ts.map +1 -1
- package/dist/utils/env/browser/fs.js.map +1 -1
- package/dist/utils/env/browser/hex.d.ts.map +1 -1
- package/dist/utils/env/browser/hex.js.map +1 -1
- package/dist/utils/env/browser/hrtime.d.ts.map +1 -1
- package/dist/utils/env/browser/hrtime.js.map +1 -1
- package/dist/utils/env/browser/logScope.d.ts.map +1 -1
- package/dist/utils/env/browser/logScope.js.map +1 -1
- package/dist/utils/env/browser/md5.d.ts.map +1 -1
- package/dist/utils/env/browser/md5.js.map +1 -1
- package/dist/utils/env/browser/platform.d.ts.map +1 -1
- package/dist/utils/env/browser/platform.js.map +1 -1
- package/dist/utils/env/node/base64.d.ts.map +1 -1
- package/dist/utils/env/node/base64.js.map +1 -1
- package/dist/utils/env/node/crypto.d.ts.map +1 -1
- package/dist/utils/env/node/crypto.js.map +1 -1
- package/dist/utils/env/node/exec.d.ts +9 -1
- package/dist/utils/env/node/exec.d.ts.map +1 -1
- package/dist/utils/env/node/exec.js +11 -4
- package/dist/utils/env/node/exec.js.map +1 -1
- package/dist/utils/env/node/fs.d.ts.map +1 -1
- package/dist/utils/env/node/fs.js.map +1 -1
- package/dist/utils/env/node/hex.d.ts.map +1 -1
- package/dist/utils/env/node/hex.js.map +1 -1
- package/dist/utils/env/node/hrtime.d.ts.map +1 -1
- package/dist/utils/env/node/hrtime.js.map +1 -1
- package/dist/utils/env/node/logScope.d.ts.map +1 -1
- package/dist/utils/env/node/logScope.js.map +1 -1
- package/dist/utils/env/node/platform.d.ts.map +1 -1
- package/dist/utils/env/node/platform.js.map +1 -1
- package/dist/utils/event.d.ts.map +1 -1
- package/dist/utils/event.js +18 -22
- package/dist/utils/event.js.map +1 -1
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js.map +1 -1
- package/dist/utils/function.d.ts.map +1 -1
- package/dist/utils/function.js +3 -3
- package/dist/utils/function.js.map +1 -1
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/iterable.d.ts.map +1 -1
- package/dist/utils/iterable.js +2 -6
- package/dist/utils/iterable.js.map +1 -1
- package/dist/utils/lazy.d.ts.map +1 -1
- package/dist/utils/lazy.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/logger.scoped.js +1 -1
- package/dist/utils/logger.scoped.js.map +1 -1
- package/dist/utils/lruMap.d.ts.map +1 -1
- package/dist/utils/lruMap.js.map +1 -1
- package/dist/utils/mru.d.ts.map +1 -1
- package/dist/utils/mru.js.map +1 -1
- package/dist/utils/object.js.map +1 -1
- package/dist/utils/paging.d.ts +29 -0
- package/dist/utils/paging.d.ts.map +1 -1
- package/dist/utils/paging.js +18 -0
- package/dist/utils/paging.js.map +1 -1
- package/dist/utils/path.js.map +1 -1
- package/dist/utils/promise.d.ts +10 -0
- package/dist/utils/promise.d.ts.map +1 -1
- package/dist/utils/promise.js +26 -3
- package/dist/utils/promise.js.map +1 -1
- package/dist/utils/promiseCache.d.ts +12 -2
- package/dist/utils/promiseCache.d.ts.map +1 -1
- package/dist/utils/promiseCache.js +80 -50
- package/dist/utils/promiseCache.js.map +1 -1
- package/dist/utils/searchTree.d.ts.map +1 -1
- package/dist/utils/searchTree.js +4 -1
- package/dist/utils/searchTree.js.map +1 -1
- package/dist/utils/stopwatch.d.ts.map +1 -1
- package/dist/utils/string.js +1 -1
- package/dist/utils/string.js.map +1 -1
- package/dist/utils/subscriptionManager.d.ts.map +1 -1
- package/dist/utils/subscriptionManager.js.map +1 -1
- package/dist/utils/trie.d.ts.map +1 -1
- package/dist/utils/trie.js +1 -0
- package/dist/utils/trie.js.map +1 -1
- package/docs/integrations.md +372 -0
- package/docs/kepler-read-api-parity.md +112 -0
- package/package.json +238 -213
- package/src/git/cache.ts +75 -8
- package/src/git/errors.ts +36 -1
- package/src/git/models/commit.ts +1 -1
- package/src/git/models/graph.ts +147 -0
- package/src/git/models/graphSession.ts +205 -0
- package/src/git/models/issue.ts +12 -1
- package/src/git/models/pullRequest.ts +27 -1
- package/src/git/models/repository.ts +24 -1
- package/src/git/models/resourceDescriptor.ts +17 -0
- package/src/git/models/signature.ts +16 -0
- package/src/git/models/tag.ts +6 -1
- package/src/git/parsers/diffParser.ts +1 -1
- package/src/git/providers/branches.ts +6 -1
- package/src/git/providers/commits.ts +6 -1
- package/src/git/providers/config.ts +5 -1
- package/src/git/providers/graph.ts +69 -2
- package/src/git/providers/status.ts +1 -1
- package/src/git/providers/worktrees.ts +3 -1
- package/src/git/remotes/azure-devops.ts +29 -33
- package/src/git/remotes/bitbucket-server.ts +23 -25
- package/src/git/remotes/bitbucket.ts +23 -25
- package/src/git/remotes/gerrit.ts +12 -14
- package/src/git/remotes/gitea.ts +13 -15
- package/src/git/remotes/github.ts +56 -58
- package/src/git/remotes/gitlab.ts +102 -104
- package/src/git/run.types.ts +54 -4
- package/src/git/utils/branch.utils.ts +12 -1
- package/src/git/utils/contributor.utils.ts +1 -1
- package/src/git/utils/fileStatus.utils.ts +7 -0
- package/src/git/utils/graph.utils.ts +46 -0
- package/src/git/utils/issue.utils.ts +1 -0
- package/src/git/utils/pullRequest.utils.ts +9 -0
- package/src/git/utils/reachability.utils.ts +79 -8
- package/src/git/utils/sshKey.utils.ts +30 -0
- package/src/git/watching/watchService.ts +16 -1
- package/src/git/watching/watchSession.ts +20 -2
- package/src/git-cli/exec/git.ts +144 -42
- package/src/git-cli/parsers/logParser.ts +83 -1
- package/src/git-cli/parsers/sshSignatureParser.ts +85 -0
- package/src/git-cli/parsers/worktreeParser.ts +5 -7
- package/src/git-cli/providers/branches.ts +60 -38
- package/src/git-cli/providers/commits.ts +102 -9
- package/src/git-cli/providers/graph.ts +1771 -393
- package/src/git-cli/providers/pausedOperations.ts +3 -3
- package/src/git-cli/providers/revision.ts +42 -0
- package/src/git-cli/providers/status.ts +333 -178
- package/src/git-cli/providers/tags.ts +2 -0
- package/src/git-cli/providers/worktrees.ts +40 -4
- package/src/git-cli/service.ts +9 -0
- package/src/ipc/ipcServer.ts +1 -1
- package/src/plus/agents/providers/claudeCodeProvider.ts +25 -0
- package/src/plus/agents/providers/claudeCodeTranscript.ts +320 -8
- package/src/plus/agents/types.ts +34 -0
- package/src/plus/ai/constants.ts +1 -9
- package/src/plus/ai/models/model.ts +53 -2
- package/src/plus/ai/models/promptTemplates.ts +9 -2
- package/src/plus/ai/prompts.ts +16 -48
- package/src/plus/ai/providers/anthropicProvider.ts +45 -3
- package/src/plus/ai/providers/deepSeekProvider.ts +17 -1
- package/src/plus/ai/providers/geminiProvider.ts +25 -6
- package/src/plus/ai/providers/gitkrakenProvider.ts +2 -0
- package/src/plus/ai/providers/huggingFaceProvider.ts +28 -21
- package/src/plus/ai/providers/openAICompatibleProviderBase.ts +16 -1
- package/src/plus/ai/providers/xaiProvider.ts +14 -1
- package/src/plus/ai/utils/ai.utils.ts +0 -2
- package/src/plus/ai/utils/results.utils.ts +32 -0
- package/src/plus/ai/utils/truncation.utils.ts +0 -1
- package/src/plus/git-github/api/github.ts +484 -104
- package/src/plus/git-github/models.ts +33 -0
- package/src/plus/git-github/providers/github/branches.ts +6 -3
- package/src/plus/git-github/providers/github/diff.ts +1 -1
- package/src/plus/git-github/providers/github/graph.ts +131 -0
- package/src/plus/git-github/providers/github/tags.ts +2 -0
- package/src/plus/integrations/authentication/cloudIntegrationService.ts +189 -17
- package/src/plus/integrations/authentication/configuredIntegrationService.ts +287 -50
- package/src/plus/integrations/authentication/integrationAuthenticationProvider.ts +105 -31
- package/src/plus/integrations/authentication/integrationAuthenticationService.ts +7 -3
- package/src/plus/integrations/authentication/manualTokenProvider.ts +12 -5
- package/src/plus/integrations/authentication/models.ts +35 -1
- package/src/plus/integrations/collectionMetadata.ts +143 -0
- package/src/plus/integrations/constants.ts +21 -0
- package/src/plus/integrations/context.ts +8 -9
- package/src/plus/integrations/errors.ts +149 -0
- package/src/plus/integrations/index.ts +148 -51
- package/src/plus/integrations/integrationService.ts +1714 -49
- package/src/plus/integrations/lite.ts +233 -0
- package/src/plus/integrations/manager.ts +359 -0
- package/src/plus/integrations/models/gitHostIntegration.ts +1014 -121
- package/src/plus/integrations/models/integration.ts +293 -24
- package/src/plus/integrations/models/issuesIntegration.ts +178 -38
- package/src/plus/integrations/providerFilters.ts +12 -0
- package/src/plus/integrations/providers/apiClients.ts +8 -11
- package/src/plus/integrations/providers/apiConfig.ts +71 -0
- package/src/plus/integrations/providers/azure/azure.ts +164 -33
- package/src/plus/integrations/providers/azure/models.ts +19 -6
- package/src/plus/integrations/providers/azureDevOps.ts +766 -101
- package/src/plus/integrations/providers/bitbucket/bitbucket.ts +164 -34
- package/src/plus/integrations/providers/bitbucket-server/models.ts +32 -1
- package/src/plus/integrations/providers/bitbucket-server.ts +173 -8
- package/src/plus/integrations/providers/bitbucket.ts +489 -45
- package/src/plus/integrations/providers/github/github.ts +2 -2
- package/src/plus/integrations/providers/github/github.utils.ts +1 -1
- package/src/plus/integrations/providers/github.ts +390 -6
- package/src/plus/integrations/providers/gitlab/gitlab.ts +170 -60
- package/src/plus/integrations/providers/gitlab/gitlab.utils.ts +9 -0
- package/src/plus/integrations/providers/gitlab/models.ts +19 -5
- package/src/plus/integrations/providers/gitlab.ts +369 -10
- package/src/plus/integrations/providers/jira.ts +247 -42
- package/src/plus/integrations/providers/linear.ts +154 -27
- package/src/plus/integrations/providers/models.ts +583 -75
- package/src/plus/integrations/providers/providersApi.ts +849 -86
- package/src/plus/integrations/providers/trello.ts +205 -0
- package/src/plus/integrations/providers/utils/providerPaging.ts +177 -0
- package/src/plus/integrations/providers/utils.ts +68 -8
- package/src/plus/integrations/reads/context.ts +75 -0
- package/src/plus/integrations/reads/cursors.ts +224 -0
- package/src/plus/integrations/reads/drains.ts +343 -0
- package/src/plus/integrations/reads/filters.ts +124 -0
- package/src/plus/integrations/reads/hierarchy.ts +493 -0
- package/src/plus/integrations/reads/hierarchy.utils.ts +106 -0
- package/src/plus/integrations/reads/issueTracker.ts +480 -0
- package/src/plus/integrations/reads/issues.ts +407 -0
- package/src/plus/integrations/reads/paging.ts +277 -0
- package/src/plus/integrations/reads/pullRequests.ts +267 -0
- package/src/plus/integrations/reads/warnings.ts +170 -0
- package/src/plus/integrations/results.ts +275 -0
- package/src/plus/integrations/utils/domain.utils.ts +26 -0
- package/src/plus/integrations/utils/integration.utils.ts +93 -16
- package/src/utils/brand.ts +0 -2
- package/src/utils/cancellation.ts +56 -7
- package/src/utils/coalescedRun.ts +45 -0
- package/src/utils/color.ts +3 -3
- package/src/utils/date.ts +72 -0
- package/src/utils/debounce.ts +1 -1
- package/src/utils/decorators/gate.ts +2 -2
- package/src/utils/decorators/log.ts +5 -5
- package/src/utils/decorators/memoize.ts +2 -2
- package/src/utils/decorators/sequentialize.ts +2 -2
- package/src/utils/decorators/serializable.ts +1 -1
- package/src/utils/env/node/exec.ts +20 -5
- package/src/utils/event.ts +19 -25
- package/src/utils/function.ts +3 -3
- package/src/utils/iterable.ts +2 -6
- package/src/utils/logger.scoped.ts +1 -1
- package/src/utils/logger.ts +1 -1
- package/src/utils/paging.ts +46 -0
- package/src/utils/promise.ts +33 -3
- package/src/utils/promiseCache.ts +81 -51
- package/src/utils/searchTree.ts +4 -2
- package/src/utils/string.ts +1 -1
- package/src/utils/trie.ts +1 -0
- package/dist/plus/ai/providers/githubModelsProvider.d.ts +0 -19
- package/dist/plus/ai/providers/githubModelsProvider.d.ts.map +0 -1
- package/dist/plus/ai/providers/githubModelsProvider.js +0 -51
- package/dist/plus/ai/providers/githubModelsProvider.js.map +0 -1
- package/src/plus/ai/providers/githubModelsProvider.ts +0 -92
|
@@ -12,7 +12,11 @@ import type {
|
|
|
12
12
|
GitGraphRowStats,
|
|
13
13
|
GitGraphRowTag,
|
|
14
14
|
GraphContext,
|
|
15
|
+
GraphIncrementalSeed,
|
|
16
|
+
GraphReachabilityTable,
|
|
15
17
|
GraphRowProcessor,
|
|
18
|
+
IncrementalGraphFallbackReason,
|
|
19
|
+
IncrementalGraphOutcome,
|
|
16
20
|
} from '../../git/models/graph.js';
|
|
17
21
|
import type {
|
|
18
22
|
GitGraphSearch,
|
|
@@ -21,6 +25,16 @@ import type {
|
|
|
21
25
|
GitGraphSearchResultData,
|
|
22
26
|
GitGraphSearchResults,
|
|
23
27
|
} from '../../git/models/graphSearch.js';
|
|
28
|
+
import { graphSessionSnapshotVersion } from '../../git/models/graphSession.js';
|
|
29
|
+
import type {
|
|
30
|
+
GitGraphSession,
|
|
31
|
+
GitGraphSessionChangedChannels,
|
|
32
|
+
GitGraphSessionRefreshOptions,
|
|
33
|
+
GitGraphSessionRefreshResult,
|
|
34
|
+
GitGraphSessionSnapshot,
|
|
35
|
+
GraphSessionRestoreDiscardReason,
|
|
36
|
+
GraphSessionRestoreResult,
|
|
37
|
+
} from '../../git/models/graphSession.js';
|
|
24
38
|
import type { GitRemote } from '../../git/models/remote.js';
|
|
25
39
|
import type { SearchQuery } from '../../git/models/search.js';
|
|
26
40
|
import type { GitWorktree } from '../../git/models/worktree.js';
|
|
@@ -31,8 +45,8 @@ import {
|
|
|
31
45
|
getBranchNameWithoutRemote,
|
|
32
46
|
getRemoteNameFromBranchName,
|
|
33
47
|
} from '../../git/utils/branch.utils.js';
|
|
34
|
-
import {
|
|
35
|
-
import { createReachabilityTableBuilder } from '../../git/utils/reachability.utils.js';
|
|
48
|
+
import { appendRowsAtCursor, mergeAvatarsForward } from '../../git/utils/graph.utils.js';
|
|
49
|
+
import { computeGraphRowContextFlags, createReachabilityTableBuilder } from '../../git/utils/reachability.utils.js';
|
|
36
50
|
import { isUncommitted } from '../../git/utils/revision.utils.js';
|
|
37
51
|
import { getSearchQueryComparisonKey, parseSearchQueryGitCommand } from '../../git/utils/search.utils.js';
|
|
38
52
|
import { getTagId } from '../../git/utils/tag.utils.js';
|
|
@@ -41,6 +55,7 @@ import { getWorktreeId, groupWorktreesByBranch } from '../../git/utils/worktree.
|
|
|
41
55
|
import { isCancellationError } from '../../utils/cancellation.js';
|
|
42
56
|
import { debug } from '../../utils/decorators/log.js';
|
|
43
57
|
import { createDisposable } from '../../utils/disposable.js';
|
|
58
|
+
import { fnv1aHash64 } from '../../utils/hash.js';
|
|
44
59
|
import { find, first, join, last } from '../../utils/iterable.js';
|
|
45
60
|
import { getScopedLogger } from '../../utils/logger.scoped.js';
|
|
46
61
|
import { getSettledValue } from '../../utils/promise.js';
|
|
@@ -60,6 +75,263 @@ const progressiveSearchResultsBatchTimeMs = 500; // Send updates every 500ms (2
|
|
|
60
75
|
|
|
61
76
|
type ReachableRef = GitCommitReachability['refs'][number];
|
|
62
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Whether a ref participates in graph row decoration (a branch/remote/tag badge) and so must be diffed by
|
|
80
|
+
* the R6b tip gate. Excludes `refs/stash` (handled by the stash gate) and symbolic `…/HEAD` refs (they
|
|
81
|
+
* mirror another ref and produce no badge of their own).
|
|
82
|
+
*/
|
|
83
|
+
function isMoveableGraphRef(refname: string): boolean {
|
|
84
|
+
if (refname === 'refs/stash' || refname === 'HEAD' || refname.endsWith('/HEAD')) return false;
|
|
85
|
+
|
|
86
|
+
return refname.startsWith('refs/heads/') || refname.startsWith('refs/remotes/') || refname.startsWith('refs/tags/');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Fingerprints the GLOBAL side inputs row construction embeds into row decorations — the default branch
|
|
91
|
+
* (and whether a local branch shadows it), HEAD's upstream, remote urls/providers, secondary-worktree
|
|
92
|
+
* assignments, and the current user. These can all change WITHOUT moving any ref tip (`git remote
|
|
93
|
+
* set-head`, remote/user config edits, `git worktree add`), and the R6b fast path reuses prior rows
|
|
94
|
+
* wholesale (only flags/reachability are re-derived) — so it compares this against the seed's and falls
|
|
95
|
+
* back to the full walk (which rebuilds every decoration) on ANY change. Deliberately EXCLUDES what other
|
|
96
|
+
* gates already own — ref existence/tips (tip gate), the default worktree's checkout (HEAD gate), and
|
|
97
|
+
* per-branch upstream mappings (checked row-by-row against the seed's embedded pills, so tracking-branch
|
|
98
|
+
* CREATES stay fast) — keeping the high-frequency events (commits, branch/tag creates, fetches,
|
|
99
|
+
* checkouts) on the fast path. Sorted so map/list iteration order can't produce spurious mismatches.
|
|
100
|
+
*/
|
|
101
|
+
function computeDecorationFingerprint(
|
|
102
|
+
repoPath: string,
|
|
103
|
+
defaultBranchName: string | undefined,
|
|
104
|
+
defaultLocalName: string | undefined,
|
|
105
|
+
headRefUpstreamName: string | undefined,
|
|
106
|
+
branches: readonly GitBranch[] | undefined,
|
|
107
|
+
remotes: readonly GitRemote[] | undefined,
|
|
108
|
+
worktrees: readonly GitWorktree[],
|
|
109
|
+
currentUser: { name: string | undefined; email: string | undefined } | undefined,
|
|
110
|
+
): string {
|
|
111
|
+
// Remote-head default markers read `!branchMap.has(defaultLocalName)` — a local branch appearing at (or
|
|
112
|
+
// vanishing from) the default's local name flips them even though the DEFAULT ref itself didn't move.
|
|
113
|
+
const localShadowsDefault = defaultLocalName != null && (branches?.some(b => b.name === defaultLocalName) ?? false);
|
|
114
|
+
const parts: string[] = [
|
|
115
|
+
`d:${defaultBranchName ?? ''}|${localShadowsDefault ? 's' : ''}`,
|
|
116
|
+
`h:${headRefUpstreamName ?? ''}`,
|
|
117
|
+
`u:${currentUser?.name ?? ''}|${currentUser?.email ?? ''}`,
|
|
118
|
+
];
|
|
119
|
+
if (branches != null) {
|
|
120
|
+
for (const b of branches) {
|
|
121
|
+
// `+starred` is baked into branch pills' serialized contexts (local AND remote heads); a
|
|
122
|
+
// disposition change moves no ref tip, so it must bust the fingerprint. Star/unstar is rare —
|
|
123
|
+
// one full walk per transition is fine.
|
|
124
|
+
if (b.starred) {
|
|
125
|
+
parts.push(`s:${b.name}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (remotes != null) {
|
|
130
|
+
for (const r of remotes) {
|
|
131
|
+
parts.push(`r:${r.name}|${r.url}|${r.provider?.gkProviderId ?? ''}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
let defaultWorktreeBranch: string | undefined;
|
|
135
|
+
let defaultWorktreePath: string | undefined;
|
|
136
|
+
for (const w of worktrees) {
|
|
137
|
+
if (w.isDefault) {
|
|
138
|
+
defaultWorktreeBranch = w.branch?.name;
|
|
139
|
+
defaultWorktreePath = w.path;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
// Only branch-attached SECONDARY worktrees decorate rows: bare/detached ones are excluded from
|
|
143
|
+
// `worktreesByBranch` (no pill). NOTE: `w.name` is deliberately avoided; it embeds the checked-out
|
|
144
|
+
// branch (and a detached sha), which would bust this on every checkout.
|
|
145
|
+
if (w.type !== 'branch') continue;
|
|
146
|
+
|
|
147
|
+
parts.push(`w:${w.branch?.name ?? ''}|${w.path}`);
|
|
148
|
+
}
|
|
149
|
+
// The DEFAULT worktree's checkout flips `+checkedout` / the main-path worktree recovery on two branch
|
|
150
|
+
// pills. When the graph IS the default worktree, that's the ordinary HEAD move (the HEAD gate refetches
|
|
151
|
+
// both endpoint rows) — but a graph on a SECONDARY worktree sees no HEAD move when the MAIN worktree
|
|
152
|
+
// checks out, so the assignment must fingerprint there. (`w.path` for the default worktree equals the
|
|
153
|
+
// main repo path in this provider's normalization — pinned by a WorktreesSubProvider test.)
|
|
154
|
+
if (defaultWorktreePath != null && defaultWorktreePath !== repoPath) {
|
|
155
|
+
parts.push(`wd:${defaultWorktreeBranch ?? ''}`);
|
|
156
|
+
}
|
|
157
|
+
parts.sort();
|
|
158
|
+
return fnv1aHash64(parts.join('\x00'));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Whether the shared reachability TABLE changed between two refresh generations. The table is append-only
|
|
163
|
+
* within a generation (`id`), so a new `id` or a grown dictionary/sets length is an EXACT signal — a per-row
|
|
164
|
+
* index that re-points to an already-present set doesn't grow the table (that change rides the rows channel).
|
|
165
|
+
*/
|
|
166
|
+
function reachabilityTableChanged(
|
|
167
|
+
prior: GraphReachabilityTable | undefined,
|
|
168
|
+
next: GraphReachabilityTable | undefined,
|
|
169
|
+
): boolean {
|
|
170
|
+
if (prior == null || next == null) return prior !== next;
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
prior.id !== next.id ||
|
|
174
|
+
prior.dictionary.length !== next.dictionary.length ||
|
|
175
|
+
prior.sets.length !== next.sets.length
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Whether the downstreams map (upstream name → tracking branch names) changed between two refresh
|
|
181
|
+
* generations. Order-sensitive on the arrays: a mere reorder reports "changed" and re-ships the full map,
|
|
182
|
+
* which is harmless — a false negative would silently drop a real upstream change, so err toward "changed".
|
|
183
|
+
*/
|
|
184
|
+
function downstreamsChanged(prior: ReadonlyMap<string, string[]>, next: ReadonlyMap<string, string[]>): boolean {
|
|
185
|
+
if (prior.size !== next.size) return true;
|
|
186
|
+
|
|
187
|
+
for (const [key, priorNames] of prior) {
|
|
188
|
+
const nextNames = next.get(key);
|
|
189
|
+
if (nextNames == null || nextNames.length !== priorNames.length) return true;
|
|
190
|
+
|
|
191
|
+
for (let i = 0; i < priorNames.length; i++) {
|
|
192
|
+
if (priorNames[i] !== nextNames[i]) return true;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Cap on the number of window rows a {@link GraphSession.serialize} persists. A longer window persists only
|
|
200
|
+
* its TOP slice with `hasMore` forced true (restore then behaves as a shorter loaded window — the bottom
|
|
201
|
+
* re-pages on demand). Pragmatic: generous enough that a typical session restores its whole window, bounded
|
|
202
|
+
* enough that the JSON file stays sub-MB-class (rows are a few hundred bytes each).
|
|
203
|
+
*/
|
|
204
|
+
const maxPersistedGraphRows = 2000;
|
|
205
|
+
|
|
206
|
+
/** The walk-shape key (`ordering|onlyFollowFirstParent`) an incremental seed is gated on — one builder so the
|
|
207
|
+
* restore/refresh/rebuild sites can't drift in how they stringify it. */
|
|
208
|
+
function buildShapeKey(shape: { ordering: string; onlyFollowFirstParent: boolean }): string {
|
|
209
|
+
return `${shape.ordering}|${shape.onlyFollowFirstParent}`;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Validates a persisted {@link GitGraphSessionSnapshot} structurally before it's trusted to seed a restore.
|
|
214
|
+
* Returns the discard reason on any failure (→ the caller ignores the snapshot and does a normal initial
|
|
215
|
+
* walk), or `undefined` when it's coherent. Never throws — a corrupt/adversarial cache must degrade to a
|
|
216
|
+
* full walk, never crash the open. Deep validation (does the cache match current git?) is NOT done here:
|
|
217
|
+
* that's the restore's immediate refresh, which reconciles a stale-but-valid snapshot against ground truth.
|
|
218
|
+
*/
|
|
219
|
+
function validateGraphSnapshot(
|
|
220
|
+
snapshot: GitGraphSessionSnapshot,
|
|
221
|
+
repoPath: string,
|
|
222
|
+
currentBuildShape: string,
|
|
223
|
+
): GraphSessionRestoreDiscardReason | undefined {
|
|
224
|
+
if (snapshot.v !== graphSessionSnapshotVersion) return 'schema';
|
|
225
|
+
if (snapshot.repoPath !== repoPath) return 'repo-path';
|
|
226
|
+
// A shape change reshapes every row's parents/order — the cached rows can't be reused.
|
|
227
|
+
if (snapshot.buildShape !== currentBuildShape) return 'shape';
|
|
228
|
+
if (!Array.isArray(snapshot.rows) || snapshot.rows.length === 0) return 'empty';
|
|
229
|
+
if (
|
|
230
|
+
!Array.isArray(snapshot.refTips) ||
|
|
231
|
+
snapshot.refTips.some(
|
|
232
|
+
t => !Array.isArray(t) || t.length !== 2 || typeof t[0] !== 'string' || typeof t[1] !== 'string',
|
|
233
|
+
)
|
|
234
|
+
) {
|
|
235
|
+
return 'tips';
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Each row must be structurally sane — a corrupt row poisons the seed / stitch math. Duplicate shas break
|
|
239
|
+
// the ids set / stitch dedup (they'd re-appear as "already seen"), so reject them too.
|
|
240
|
+
const seenShas = new Set<string>();
|
|
241
|
+
for (const row of snapshot.rows) {
|
|
242
|
+
if (row == null || typeof row.sha !== 'string' || !Array.isArray(row.parents) || typeof row.date !== 'number') {
|
|
243
|
+
return 'rows';
|
|
244
|
+
}
|
|
245
|
+
if (seenShas.has(row.sha)) return 'rows';
|
|
246
|
+
|
|
247
|
+
seenShas.add(row.sha);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Every row's `reachabilityIndex` must be a valid index into the table's `sets` (the decode reads it
|
|
251
|
+
// directly). Guards against a truncated table / mismatched pairing.
|
|
252
|
+
const reachability = snapshot.reachability;
|
|
253
|
+
if (reachability != null && (!Array.isArray(reachability.sets) || !Array.isArray(reachability.dictionary))) {
|
|
254
|
+
return 'reachability';
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const setCount = reachability?.sets?.length ?? 0;
|
|
258
|
+
for (const row of snapshot.rows) {
|
|
259
|
+
const index = row.contexts?.reachabilityIndex;
|
|
260
|
+
if (index != null && (!Number.isInteger(index) || index < 0 || index >= setCount)) return 'reachability';
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Downstreams must be `[upstream name, tracking branch names]` entries (reconstructed into a Map on restore).
|
|
264
|
+
if (
|
|
265
|
+
!Array.isArray(snapshot.downstreams) ||
|
|
266
|
+
snapshot.downstreams.some(
|
|
267
|
+
d => !Array.isArray(d) || d.length !== 2 || typeof d[0] !== 'string' || !Array.isArray(d[1]),
|
|
268
|
+
)
|
|
269
|
+
) {
|
|
270
|
+
return 'downstreams';
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Per-sha stats, when present, must be `[sha, stats-object]` entries (reconstructed into a Map on restore).
|
|
274
|
+
if (
|
|
275
|
+
snapshot.rowsStats != null &&
|
|
276
|
+
(!Array.isArray(snapshot.rowsStats) ||
|
|
277
|
+
snapshot.rowsStats.some(
|
|
278
|
+
s =>
|
|
279
|
+
!Array.isArray(s) ||
|
|
280
|
+
s.length !== 2 ||
|
|
281
|
+
typeof s[0] !== 'string' ||
|
|
282
|
+
typeof s[1] !== 'object' ||
|
|
283
|
+
s[1] == null,
|
|
284
|
+
))
|
|
285
|
+
) {
|
|
286
|
+
return 'rowsStats';
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Reconstruct a persisted snapshot into the synthetic `GitGraph` a {@link GraphSession.restore} hands to its
|
|
294
|
+
* immediate refresh as the PRIOR generation — carrying exactly the fields the refresh's seed construction +
|
|
295
|
+
* change-diffing read (`refTips`, `reachability`, `rowsStats`, `downstreams`, `paging.hasMore`). Avatars are
|
|
296
|
+
* deliberately empty: resolved avatar URLs are webview-instance-bound and don't survive a restart, so the
|
|
297
|
+
* refresh re-derives them (and the write-once merge over an empty prior map is a no-op). The side-queried
|
|
298
|
+
* collections (`branches`/`remotes`/`stashes`/`worktrees`) aren't read by the refresh, so they're left empty.
|
|
299
|
+
*/
|
|
300
|
+
function buildRestoredGraph(snapshot: GitGraphSessionSnapshot): GitGraph {
|
|
301
|
+
return {
|
|
302
|
+
repoPath: snapshot.repoPath,
|
|
303
|
+
avatars: new Map<string, string>(),
|
|
304
|
+
ids: new Set<string>(snapshot.rows.map(r => r.sha)),
|
|
305
|
+
includes: snapshot.includesStats ? { stats: true } : undefined,
|
|
306
|
+
branches: new Map<string, GitBranch>(),
|
|
307
|
+
remotes: new Map<string, GitRemote>(),
|
|
308
|
+
downstreams: new Map(snapshot.downstreams),
|
|
309
|
+
stashes: undefined,
|
|
310
|
+
worktrees: undefined,
|
|
311
|
+
worktreesByBranch: undefined,
|
|
312
|
+
reachability: snapshot.reachability,
|
|
313
|
+
refTips: new Map(snapshot.refTips),
|
|
314
|
+
decorationFingerprint: snapshot.decorationFingerprint,
|
|
315
|
+
shallow: snapshot.shallow,
|
|
316
|
+
rows: snapshot.rows,
|
|
317
|
+
rowsStats: snapshot.rowsStats != null ? new Map(snapshot.rowsStats) : undefined,
|
|
318
|
+
paging: { limit: snapshot.rows.length, startingCursor: undefined, hasMore: snapshot.hasMore },
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/** The graph log parser's per-record shape (see `graphMapping`), narrowed to the fields the row builder reads. */
|
|
323
|
+
type GraphCommitRecord = {
|
|
324
|
+
sha: string;
|
|
325
|
+
author: string;
|
|
326
|
+
authorEmail: string;
|
|
327
|
+
authorDate: string;
|
|
328
|
+
committerDate: string;
|
|
329
|
+
parents: string;
|
|
330
|
+
tips: string;
|
|
331
|
+
message: string;
|
|
332
|
+
stats?: GitGraphRowStats;
|
|
333
|
+
};
|
|
334
|
+
|
|
63
335
|
export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
64
336
|
constructor(
|
|
65
337
|
private readonly context: GitServiceContext,
|
|
@@ -68,11 +340,134 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
68
340
|
private readonly provider: CliGitProviderInternal,
|
|
69
341
|
) {}
|
|
70
342
|
|
|
343
|
+
/**
|
|
344
|
+
* Current ref tips (canonical refname → PEELED commit sha), for the R6b fast path's gate. Peeled so an
|
|
345
|
+
* annotated tag maps to the commit its badge sits on — the same convention {@link GraphIncrementalSeed.tips}
|
|
346
|
+
* uses — and so the seed↔current diff is by commit identity. Skips nothing; the caller filters to the
|
|
347
|
+
* moveable ref classes it cares about.
|
|
348
|
+
*/
|
|
349
|
+
private async getCurrentRefTips(repoPath: string, cancellation?: AbortSignal): Promise<Map<string, string>> {
|
|
350
|
+
const result = await this.git.run(
|
|
351
|
+
{ cwd: repoPath, configs: gitConfigsLog, cancellation: cancellation, errors: 'ignore' },
|
|
352
|
+
'for-each-ref',
|
|
353
|
+
'--format=%(objectname) %(*objectname) %(refname)',
|
|
354
|
+
);
|
|
355
|
+
const tips = new Map<string, string>();
|
|
356
|
+
for (const line of result.stdout.split('\n')) {
|
|
357
|
+
// `<objectname> <peeled-objectname-or-empty> <refname>`; peeled is set only for annotated tags.
|
|
358
|
+
const match = /^(\S+) (\S*) (.+)$/.exec(line);
|
|
359
|
+
if (match == null) continue;
|
|
360
|
+
|
|
361
|
+
tips.set(match[3], match[2] || match[1]);
|
|
362
|
+
}
|
|
363
|
+
return tips;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Whether the repo is a SHALLOW clone right now (a `$GIT_DIR/shallow` file exists). `git` resolves the git
|
|
368
|
+
* dir itself (correct in worktrees / bare / separate git-dirs), so this makes no `.git`-is-a-dir assumption.
|
|
369
|
+
* Returned as {@link GitGraph.shallow} and diffed by the R6b fast path's gate — an un-shallow (or re-shallow)
|
|
370
|
+
* while the graph was closed leaves every branch tip put yet changes what history exists below the window.
|
|
371
|
+
* Errors ignored → treated as NOT shallow: a git too old for `--is-shallow-repository` degrades to no-op
|
|
372
|
+
* detection (consistent on both the seed and the current side, so the gate can't over-fire), and a transient
|
|
373
|
+
* read error biases toward `false`, which — when the seed was shallow — only forces a SAFE full-walk fallback.
|
|
374
|
+
*/
|
|
375
|
+
private async getShallowState(repoPath: string, cancellation?: AbortSignal): Promise<boolean> {
|
|
376
|
+
const result = await this.git.run(
|
|
377
|
+
{ cwd: repoPath, configs: gitConfigsLog, cancellation: cancellation, errors: 'ignore' },
|
|
378
|
+
'rev-parse',
|
|
379
|
+
'--is-shallow-repository',
|
|
380
|
+
);
|
|
381
|
+
return result.stdout.trim() === 'true';
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** Whether `oldSha` is an ancestor of `newSha` (i.e. the ref moved fast-forward). */
|
|
385
|
+
private async isFastForward(
|
|
386
|
+
repoPath: string,
|
|
387
|
+
oldSha: string,
|
|
388
|
+
newSha: string,
|
|
389
|
+
cancellation?: AbortSignal,
|
|
390
|
+
): Promise<boolean> {
|
|
391
|
+
const result = await this.git.run(
|
|
392
|
+
{ cwd: repoPath, cancellation: cancellation, errors: 'ignore' },
|
|
393
|
+
'merge-base',
|
|
394
|
+
'--is-ancestor',
|
|
395
|
+
oldSha,
|
|
396
|
+
newSha,
|
|
397
|
+
);
|
|
398
|
+
return result.exitCode === 0;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
async openGraphSession(
|
|
402
|
+
repoPath: string,
|
|
403
|
+
options?: {
|
|
404
|
+
rowProcessor?: GraphRowProcessor;
|
|
405
|
+
rev?: string;
|
|
406
|
+
limit?: number;
|
|
407
|
+
include?: { stats?: boolean };
|
|
408
|
+
restore?: GitGraphSessionSnapshot;
|
|
409
|
+
onRestore?: (result: GraphSessionRestoreResult) => void;
|
|
410
|
+
},
|
|
411
|
+
cancellation?: AbortSignal,
|
|
412
|
+
): Promise<GitGraphSession> {
|
|
413
|
+
// The session computes the walk shape (`ordering|onlyFollowFirstParent`) the SAME way `getGraph`
|
|
414
|
+
// derives it, so it can gate its incremental seed on a shape change (which reshapes every row's
|
|
415
|
+
// parents/order) exactly as the host's former `_graphBuildShape` gate did.
|
|
416
|
+
const getWalkShape = (): { ordering: 'date' | 'author-date' | 'topo'; onlyFollowFirstParent: boolean } => {
|
|
417
|
+
const cfg = this.context.config;
|
|
418
|
+
return {
|
|
419
|
+
ordering: cfg?.graph?.commitOrdering ?? cfg?.commits.ordering ?? 'date',
|
|
420
|
+
onlyFollowFirstParent: cfg?.graph?.onlyFollowFirstParent ?? false,
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
const session = new GraphSession(this, repoPath, options?.rowProcessor, getWalkShape);
|
|
424
|
+
|
|
425
|
+
// R7c restart persistence: seed from a persisted snapshot when it's structurally valid for THIS repo +
|
|
426
|
+
// walk shape, then immediately refresh (the snapshot is exactly an R6 seed — enumeration + the tip/FF/
|
|
427
|
+
// stash gates reconcile a stale one). Any validation failure discards it and falls through to a normal
|
|
428
|
+
// initial walk. Never trusted over git.
|
|
429
|
+
const restore = options?.restore;
|
|
430
|
+
if (restore != null) {
|
|
431
|
+
const shape = getWalkShape();
|
|
432
|
+
const reason = validateGraphSnapshot(restore, repoPath, buildShapeKey(shape));
|
|
433
|
+
if (reason == null) {
|
|
434
|
+
try {
|
|
435
|
+
const refresh = await session.restore(restore, options, cancellation);
|
|
436
|
+
options?.onRestore?.({ restored: true, rows: restore.rows.length, refresh: refresh });
|
|
437
|
+
return session;
|
|
438
|
+
} catch {
|
|
439
|
+
// Belt-and-suspenders: structural validation can't catch a snapshot that reconstructs but
|
|
440
|
+
// throws in the restore's refresh (e.g. a garbage rev its enumerate chokes on). A corrupt
|
|
441
|
+
// cache must degrade to a full walk, never crash the open — report a miss and fall through.
|
|
442
|
+
options?.onRestore?.({ restored: false, reason: 'corrupt' });
|
|
443
|
+
}
|
|
444
|
+
} else {
|
|
445
|
+
options?.onRestore?.({ restored: false, reason: reason });
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
await session.initialize(options, cancellation);
|
|
450
|
+
return session;
|
|
451
|
+
}
|
|
452
|
+
|
|
71
453
|
@debug()
|
|
72
454
|
async getGraph(
|
|
73
455
|
repoPath: string,
|
|
74
456
|
rev: string | undefined,
|
|
75
|
-
options?: {
|
|
457
|
+
options?: {
|
|
458
|
+
include?: { stats?: boolean };
|
|
459
|
+
limit?: number;
|
|
460
|
+
rowProcessor?: GraphRowProcessor;
|
|
461
|
+
reachabilitySeed?: GraphReachabilityTable;
|
|
462
|
+
rowsStatsSeed?: GitGraphRowsStats;
|
|
463
|
+
// R6b incremental head-walk seed. When present (and the gate holds), walk only the new head
|
|
464
|
+
// region, stitch the seed's cached tail, and re-derive flags/reachability in memory instead of
|
|
465
|
+
// re-walking every loaded row; any structural change degrades to the full walk. See
|
|
466
|
+
// `GraphIncrementalSeed` and the R6 plan section.
|
|
467
|
+
incrementalSeed?: GraphIncrementalSeed;
|
|
468
|
+
// Observational: reports whether the seeded call took the fast path or fell back (with the reason).
|
|
469
|
+
onIncrementalResult?: (outcome: IncrementalGraphOutcome) => void;
|
|
470
|
+
},
|
|
76
471
|
cancellation?: AbortSignal,
|
|
77
472
|
): Promise<GitGraph> {
|
|
78
473
|
const scope = getScopedLogger();
|
|
@@ -83,34 +478,104 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
83
478
|
const onlyFollowFirstParent = cfg?.graph?.onlyFollowFirstParent ?? false;
|
|
84
479
|
|
|
85
480
|
const deferStats = options?.include?.stats;
|
|
481
|
+
// `let`: cleared before the fallback walk when the fast path bailed for a parent-rewriting reason
|
|
482
|
+
// (unshallow / replace-ref change) — those alter boundary commits' true diffs, so per-sha stats
|
|
483
|
+
// carried from the prior generation may be stale and must recompute.
|
|
484
|
+
let rowsStatsSeed = options?.rowsStatsSeed;
|
|
86
485
|
|
|
87
486
|
const parser = getGraphParser(options?.include?.stats && !deferStats);
|
|
88
487
|
const shaParser = getShaLogParser();
|
|
89
488
|
const statsParser = getShaAndStatsLogParser();
|
|
90
489
|
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
490
|
+
const stashPromise = this.provider.stash?.getStash(repoPath, { includeFiles: false }, cancellation);
|
|
491
|
+
|
|
492
|
+
// Pre-BUILD the first walk's stream as soon as the stash list (the spawn's only argv/stdin
|
|
493
|
+
// input) resolves. NOTE: `git.stream` is a lazy async generator — the process does NOT spawn
|
|
494
|
+
// until the walk loop's first iteration, so this achieves argv/stdin PREPARATION overlap only,
|
|
495
|
+
// not the git-startup overlap the original design intended (make the spawn eager — priming the
|
|
496
|
+
// generator — or delete this seam; tracked as a follow-up). Consumed exactly once by the first
|
|
497
|
+
// `getCommitsForGraphCore` call; never iterated = never spawned, so an unconsumed pre-build
|
|
498
|
+
// (fast-path win, error fallback) leaks nothing.
|
|
499
|
+
const prespawnAborter = new AbortController();
|
|
500
|
+
const onPrespawnCancel = () => prespawnAborter.abort();
|
|
501
|
+
cancellation?.addEventListener('abort', onPrespawnCancel, { once: true });
|
|
502
|
+
// An ALREADY-aborted signal never fires listeners added after the fact — propagate it by hand.
|
|
503
|
+
if (cancellation?.aborted) {
|
|
504
|
+
onPrespawnCancel();
|
|
505
|
+
}
|
|
506
|
+
let prespawn: Promise<{ stream: AsyncGenerator<string> } | undefined> | undefined = (async () => {
|
|
507
|
+
try {
|
|
508
|
+
const gitStash = await stashPromise;
|
|
509
|
+
const { stdin } = convertStashesToStdin(gitStash?.stashes);
|
|
510
|
+
const args = ['log', ...parser.arguments, `--${ordering}-order`, '--all'];
|
|
511
|
+
if (stdin) {
|
|
512
|
+
args.push('--stdin');
|
|
513
|
+
}
|
|
514
|
+
if (onlyFollowFirstParent) {
|
|
515
|
+
args.push('--first-parent');
|
|
516
|
+
}
|
|
517
|
+
const stream = this.git.stream(
|
|
518
|
+
{
|
|
519
|
+
cwd: repoPath,
|
|
520
|
+
configs: gitConfigsLog,
|
|
521
|
+
cancellation: prespawnAborter.signal,
|
|
522
|
+
stdin: stdin,
|
|
523
|
+
// See the walk spawn below for why GIT_FLUSH=0.
|
|
524
|
+
env: { GIT_FLUSH: '0' },
|
|
525
|
+
},
|
|
526
|
+
...args,
|
|
527
|
+
'--',
|
|
528
|
+
);
|
|
529
|
+
return { stream: stream };
|
|
530
|
+
} catch {
|
|
531
|
+
return undefined;
|
|
532
|
+
}
|
|
533
|
+
})();
|
|
534
|
+
|
|
535
|
+
// Current ref tips (peeled), captured ONCE at walk entry, overlapped with the rest of the prelude (a
|
|
536
|
+
// single `for-each-ref`, off the rows-walk critical path). Attached to the returned graph as `refTips`
|
|
537
|
+
// so the host can seed the NEXT rebuild's tip diff; the R6b fast path also reuses this same map for its
|
|
538
|
+
// own tip-diff gate (so there's exactly one `for-each-ref` per call whether it goes fast or full).
|
|
539
|
+
const refTipsPromise = this.getCurrentRefTips(repoPath, cancellation);
|
|
540
|
+
|
|
541
|
+
// Shallow state (peeled off the same prelude, off the rows-walk critical path) — stamped on the returned
|
|
542
|
+
// graph so the NEXT rebuild's seed can gate on an un-shallow/re-shallow, and reused by the R6b fast path's
|
|
543
|
+
// own shallow gate (one `rev-parse` per call whether it goes fast or full).
|
|
544
|
+
const shallowPromise = this.getShallowState(repoPath, cancellation);
|
|
545
|
+
|
|
546
|
+
const [
|
|
547
|
+
shaResult,
|
|
548
|
+
stashResult,
|
|
549
|
+
branchesResult,
|
|
550
|
+
remotesResult,
|
|
551
|
+
currentUserResult,
|
|
552
|
+
worktreesResult,
|
|
553
|
+
defaultBranchResult,
|
|
554
|
+
] = await Promise.allSettled([
|
|
555
|
+
!isUncommitted(rev, true)
|
|
556
|
+
? this.git.run(
|
|
557
|
+
{ cwd: repoPath, configs: gitConfigsLog },
|
|
558
|
+
'log',
|
|
559
|
+
...shaParser.arguments,
|
|
560
|
+
'-n1',
|
|
561
|
+
rev ?? 'HEAD',
|
|
562
|
+
'--',
|
|
563
|
+
)
|
|
564
|
+
: undefined,
|
|
565
|
+
stashPromise,
|
|
566
|
+
this.provider.branches.getBranches(repoPath, undefined, cancellation),
|
|
567
|
+
this.provider.remotes.getRemotes(repoPath, undefined, cancellation),
|
|
568
|
+
this.provider.config.getCurrentUser(repoPath),
|
|
569
|
+
this.provider.worktrees
|
|
570
|
+
?.getWorktrees(repoPath, cancellation)
|
|
571
|
+
.then((w): [GitWorktree[], Map<string, GitWorktree>] => [
|
|
572
|
+
w,
|
|
573
|
+
groupWorktreesByBranch(w, { includeDefault: true }),
|
|
574
|
+
]),
|
|
575
|
+
// Local-only: never contact the remote on the graph's hot fetch path. `isDefault` is additive,
|
|
576
|
+
// so it's simply absent until a background networked caller resolves origin/HEAD.
|
|
577
|
+
this.provider.branches.getDefaultBranchName(repoPath, undefined, { local: true }, cancellation),
|
|
578
|
+
]);
|
|
114
579
|
|
|
115
580
|
const branches = getSettledValue(branchesResult)?.values;
|
|
116
581
|
const branchMap = branches != null ? new Map(branches.map(r => [r.name, r])) : new Map<string, GitBranch>();
|
|
@@ -118,6 +583,11 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
118
583
|
const headRefUpstreamName = headBranch?.upstream?.name;
|
|
119
584
|
const [worktrees, worktreesByBranch] = getSettledValue(worktreesResult) ?? [[], new Map<string, GitWorktree>()];
|
|
120
585
|
|
|
586
|
+
// The repo's default branch (e.g. `origin/main`) reduced to its local branch name (`main`) so it
|
|
587
|
+
// can be matched against each local head's `tip` to flag the default-branch head additively.
|
|
588
|
+
const defaultBranchName = getSettledValue(defaultBranchResult);
|
|
589
|
+
const defaultLocalName = defaultBranchName != null ? getBranchNameWithoutRemote(defaultBranchName) : undefined;
|
|
590
|
+
|
|
121
591
|
let branchIdOfMainWorktree: string | undefined;
|
|
122
592
|
let mainWorktree: GitWorktree | undefined;
|
|
123
593
|
if (worktreesByBranch != null) {
|
|
@@ -135,9 +605,29 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
135
605
|
|
|
136
606
|
const remotes = getSettledValue(remotesResult);
|
|
137
607
|
const remoteMap = remotes != null ? new Map(remotes.map(r => [r.name, r])) : new Map<string, GitRemote>();
|
|
608
|
+
|
|
609
|
+
// Decoration side inputs, fingerprinted for the NEXT rebuild's metadata gate (and compared against
|
|
610
|
+
// the seed's by this call's fast path). Computed from the prelude's fresh queries — the same values
|
|
611
|
+
// row construction below embeds into row decorations.
|
|
612
|
+
const decorationFingerprint = computeDecorationFingerprint(
|
|
613
|
+
repoPath,
|
|
614
|
+
defaultBranchName,
|
|
615
|
+
defaultLocalName,
|
|
616
|
+
headRefUpstreamName,
|
|
617
|
+
branches,
|
|
618
|
+
remotes,
|
|
619
|
+
worktrees,
|
|
620
|
+
currentUser,
|
|
621
|
+
);
|
|
138
622
|
const shas = getSettledValue(shaResult)?.stdout;
|
|
139
623
|
const selectSha = shas != null ? first(shaParser.parse(shas)) : undefined;
|
|
140
624
|
|
|
625
|
+
// Resolved off the critical path (started in the prelude). Same map for the full walk's `refTips`, the
|
|
626
|
+
// fast path's tip-diff gate, and the fast path's `refTips`. Never rejects (errors ignored → empty map).
|
|
627
|
+
const refTips = await refTipsPromise;
|
|
628
|
+
// Same value for the full walk's `shallow`, the fast path's shallow gate, and the fast path's `shallow`.
|
|
629
|
+
const shallow = await shallowPromise;
|
|
630
|
+
|
|
141
631
|
const downstreamMap = new Map<string, string[]>();
|
|
142
632
|
|
|
143
633
|
// There *HAS* to be a better way to get git log to return stashes, but this is the best we've found
|
|
@@ -185,14 +675,31 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
185
675
|
// commits. Per-row ref arrays are NOT retained — each row keeps only its set index
|
|
186
676
|
// (`contexts.reachabilityIndex`), and the working `reachableRefs` entry is dropped once emitted.
|
|
187
677
|
// The encoder lives next to its decoder in `reachability.utils` so the wire format can't drift.
|
|
188
|
-
|
|
678
|
+
// A caller-supplied seed CONTINUES the prior generation's table (same id, stable indices) so
|
|
679
|
+
// rows retained across a rebuild keep valid `reachabilityIndex` values.
|
|
680
|
+
const reachabilityBuilder = createReachabilityTableBuilder(options?.reachabilitySeed);
|
|
681
|
+
|
|
682
|
+
// Set-index cache keyed by the working ref-map INSTANCE: the propagation below transfers a
|
|
683
|
+
// row's map wholesale to its (first) parent, so an entire chain interns the same object —
|
|
684
|
+
// one real intern per chain instead of one per row. Maps only ever GROW (ref seeding adds
|
|
685
|
+
// entries), so an unchanged size proves the cached index is still exact.
|
|
686
|
+
const internCache = new WeakMap<Map<string, ReachableRef>, { size: number; index: number | undefined }>();
|
|
189
687
|
|
|
190
688
|
function finalizeRowReachability(
|
|
191
689
|
row: GitGraphRow,
|
|
192
690
|
sha: string,
|
|
193
691
|
refs: Map<string, ReachableRef> | undefined,
|
|
194
692
|
): void {
|
|
195
|
-
|
|
693
|
+
let setIndex;
|
|
694
|
+
const cached = refs != null ? internCache.get(refs) : undefined;
|
|
695
|
+
if (cached != null && cached.size === refs!.size) {
|
|
696
|
+
setIndex = cached.index;
|
|
697
|
+
} else {
|
|
698
|
+
setIndex = reachabilityBuilder.intern(refs?.values());
|
|
699
|
+
if (refs != null) {
|
|
700
|
+
internCache.set(refs, { size: refs.size, index: setIndex });
|
|
701
|
+
}
|
|
702
|
+
}
|
|
196
703
|
if (setIndex != null) {
|
|
197
704
|
(row.contexts ??= {}).reachabilityIndex = setIndex;
|
|
198
705
|
}
|
|
@@ -208,6 +715,394 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
208
715
|
let iterations = 0;
|
|
209
716
|
let total = 0;
|
|
210
717
|
|
|
718
|
+
// Hoisted so the ordered walk AND the R6b incremental fast path share one context. It holds the
|
|
719
|
+
// outer accumulator sets BY REFERENCE (they mutate in place across `more()` pagination / replay), so
|
|
720
|
+
// building it once is equivalent to the prior per-call construction.
|
|
721
|
+
const rowProcessor = options?.rowProcessor;
|
|
722
|
+
const graphCtx: GraphContext | undefined =
|
|
723
|
+
rowProcessor != null
|
|
724
|
+
? {
|
|
725
|
+
repoPath: repoPath,
|
|
726
|
+
useAvatars: cfg?.graph?.avatars ?? true,
|
|
727
|
+
branches: branchMap,
|
|
728
|
+
remotes: remoteMap,
|
|
729
|
+
worktreesByBranch: worktreesByBranch,
|
|
730
|
+
branchIdOfMainWorktree: branchIdOfMainWorktree,
|
|
731
|
+
stashes: gitStash?.stashes,
|
|
732
|
+
reachableFromHEAD: reachableFromHEAD,
|
|
733
|
+
rewriteableFromHEAD: rewriteableFromHEAD,
|
|
734
|
+
tipShasWithChildren: tipShasWithChildren,
|
|
735
|
+
// `undefined` when HEAD has no upstream, so the processor flags nothing as
|
|
736
|
+
// unpublished; otherwise the live set (mutated during the walk, read by ref).
|
|
737
|
+
reachableFromHeadUpstream: headRefUpstreamName != null ? reachableFromHeadUpstream : undefined,
|
|
738
|
+
avatars: avatars,
|
|
739
|
+
}
|
|
740
|
+
: undefined;
|
|
741
|
+
|
|
742
|
+
// Parses one commit record into a row (ref badges, parents, stash vs commit) but performs NO
|
|
743
|
+
// reachability/HEAD/downstream accumulation — that half lives in `accumulateRowState`, so the ordered
|
|
744
|
+
// walk and the fast path (which replays accumulation over reused rows, deriving ref lists from their
|
|
745
|
+
// own decoration) share one propagation implementation. Returns `undefined` when the record dedups to
|
|
746
|
+
// an already-seen remapped-stash sha. Faithful extraction of the walk's former inline body — must stay
|
|
747
|
+
// byte-identical to it (the equivalence harness pins this).
|
|
748
|
+
function buildRowFromCommit(commit: GraphCommitRecord):
|
|
749
|
+
| {
|
|
750
|
+
row: GitGraphRow;
|
|
751
|
+
refHeads: GitGraphRowHead[];
|
|
752
|
+
refRemoteHeads: GitGraphRowRemoteHead[];
|
|
753
|
+
refTags: GitGraphRowTag[];
|
|
754
|
+
head: boolean;
|
|
755
|
+
parents: string[];
|
|
756
|
+
}
|
|
757
|
+
| undefined {
|
|
758
|
+
total++;
|
|
759
|
+
let shaOrRemapped: string | undefined = remappedIds.get(commit.sha);
|
|
760
|
+
if (shaOrRemapped && ids.has(shaOrRemapped)) return undefined;
|
|
761
|
+
|
|
762
|
+
shaOrRemapped ??= commit.sha;
|
|
763
|
+
ids.add(shaOrRemapped);
|
|
764
|
+
|
|
765
|
+
const refHeads: GitGraphRowHead[] = [];
|
|
766
|
+
const refRemoteHeads: GitGraphRowRemoteHead[] = [];
|
|
767
|
+
const refTags: GitGraphRowTag[] = [];
|
|
768
|
+
// `head` is per-tip (drives `isCurrentHead` on the branch it decorates); `sawHead` sticks once ANY
|
|
769
|
+
// tip is HEAD so `accumulateRowState` seeds `reachableFromHEAD` even when HEAD isn't the last tip.
|
|
770
|
+
let head = false;
|
|
771
|
+
let sawHead = false;
|
|
772
|
+
|
|
773
|
+
if (commit.tips) {
|
|
774
|
+
for (let tip of commit.tips.split(', ')) {
|
|
775
|
+
head = false;
|
|
776
|
+
if (tip === 'refs/stash') continue;
|
|
777
|
+
|
|
778
|
+
if (tip.startsWith('tag: ')) {
|
|
779
|
+
const tagName = tip.substring(5);
|
|
780
|
+
refTags.push({
|
|
781
|
+
id: getTagId(repoPath, tagName),
|
|
782
|
+
name: tagName,
|
|
783
|
+
// Not currently used, so don't bother looking it up
|
|
784
|
+
annotated: true,
|
|
785
|
+
});
|
|
786
|
+
continue;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
if (tip.startsWith('HEAD')) {
|
|
790
|
+
head = true;
|
|
791
|
+
sawHead = true;
|
|
792
|
+
if (tip !== 'HEAD') {
|
|
793
|
+
tip = tip.substring(8);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
const remoteName = getRemoteNameFromBranchName(tip);
|
|
798
|
+
if (remoteName) {
|
|
799
|
+
const remote = remoteMap.get(remoteName);
|
|
800
|
+
if (remote != null) {
|
|
801
|
+
const branchName = getBranchNameWithoutRemote(tip);
|
|
802
|
+
if (branchName === 'HEAD') continue;
|
|
803
|
+
|
|
804
|
+
refRemoteHeads.push({
|
|
805
|
+
id: getBranchId(repoPath, true, tip),
|
|
806
|
+
name: branchName,
|
|
807
|
+
owner: remote.name,
|
|
808
|
+
url: remote.url,
|
|
809
|
+
current: tip === headRefUpstreamName,
|
|
810
|
+
// `defaultLocalName!` is non-null here because `tip === defaultBranchName` short-circuits when `defaultBranchName` is null.
|
|
811
|
+
isDefault: tip === defaultBranchName && !branchMap.has(defaultLocalName!),
|
|
812
|
+
hostingServiceType: remote.provider?.gkProviderId,
|
|
813
|
+
});
|
|
814
|
+
continue;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
const branch = branchMap.get(tip);
|
|
819
|
+
const branchId = branch?.id ?? getBranchId(repoPath, false, tip);
|
|
820
|
+
// `worktreesByBranch` has the main/default worktree removed, so recover it here.
|
|
821
|
+
const worktree =
|
|
822
|
+
worktreesByBranch?.get(branchId) ??
|
|
823
|
+
(branchId === branchIdOfMainWorktree ? mainWorktree : undefined);
|
|
824
|
+
const worktreeRef =
|
|
825
|
+
worktree != null
|
|
826
|
+
? { id: getWorktreeId(repoPath, worktree.name), path: worktree.path }
|
|
827
|
+
: undefined;
|
|
828
|
+
refHeads.push({
|
|
829
|
+
id: branchId,
|
|
830
|
+
name: tip,
|
|
831
|
+
isCurrentHead: head,
|
|
832
|
+
upstream:
|
|
833
|
+
branch?.upstream != null
|
|
834
|
+
? { name: branch.upstream.name, id: getBranchId(repoPath, true, branch.upstream.name) }
|
|
835
|
+
: undefined,
|
|
836
|
+
worktree: worktreeRef,
|
|
837
|
+
worktreeId: worktree?.isDefault === false ? worktreeRef?.id : undefined,
|
|
838
|
+
isDefault: defaultLocalName != null && tip === defaultLocalName,
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
const parents = commit.parents ? commit.parents.split(' ') : [];
|
|
844
|
+
const stash = gitStash?.stashes.get(shaOrRemapped);
|
|
845
|
+
let row: GitGraphRow;
|
|
846
|
+
if (stash != null) {
|
|
847
|
+
row = {
|
|
848
|
+
sha: shaOrRemapped,
|
|
849
|
+
// Always only return the first parent for stashes, as it is a Git implementation for the index and untracked files
|
|
850
|
+
parents: parents.slice(0, 1),
|
|
851
|
+
author: currentUser?.name ?? commit.author,
|
|
852
|
+
email: commit.authorEmail,
|
|
853
|
+
date: Number(ordering === 'author-date' ? commit.authorDate : commit.committerDate) * 1000,
|
|
854
|
+
commitDate: Number(commit.committerDate) * 1000,
|
|
855
|
+
message: (stash.message ?? commit.message).trim(),
|
|
856
|
+
type: 'stash-node',
|
|
857
|
+
heads: refHeads,
|
|
858
|
+
remotes: refRemoteHeads,
|
|
859
|
+
tags: refTags,
|
|
860
|
+
isCurrentUser: true,
|
|
861
|
+
};
|
|
862
|
+
// Don't seed `rowStats` from `stash.stats` here: the graph's stash list is fetched with
|
|
863
|
+
// `includeFiles: false`, so the commit model SYNTHESIZES a zero-stats object from its empty
|
|
864
|
+
// fileset — seeding it marks the stash "covered" and permanently blanks it. The deferred
|
|
865
|
+
// stats pass owns stash stats (first-parent diff, keyed by stash sha).
|
|
866
|
+
} else {
|
|
867
|
+
const isCurrentUser = isUserMatch(currentUser, commit.author, commit.authorEmail);
|
|
868
|
+
row = {
|
|
869
|
+
sha: shaOrRemapped,
|
|
870
|
+
parents: onlyFollowFirstParent ? parents.slice(0, 1) : parents,
|
|
871
|
+
author: commit.author,
|
|
872
|
+
email: commit.authorEmail,
|
|
873
|
+
date: Number(ordering === 'author-date' ? commit.authorDate : commit.committerDate) * 1000,
|
|
874
|
+
commitDate: Number(commit.committerDate) * 1000,
|
|
875
|
+
message: commit.message.trim(),
|
|
876
|
+
type: parents.length > 1 ? 'merge-node' : 'commit-node',
|
|
877
|
+
heads: refHeads,
|
|
878
|
+
remotes: refRemoteHeads,
|
|
879
|
+
tags: refTags,
|
|
880
|
+
isCurrentUser: isCurrentUser || undefined,
|
|
881
|
+
};
|
|
882
|
+
if (commit.stats != null) {
|
|
883
|
+
rowStats.set(shaOrRemapped, commit.stats);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
return {
|
|
888
|
+
row: row,
|
|
889
|
+
refHeads: refHeads,
|
|
890
|
+
refRemoteHeads: refRemoteHeads,
|
|
891
|
+
refTags: refTags,
|
|
892
|
+
head: sawHead,
|
|
893
|
+
parents: parents,
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
// The propagation half of the walk, factored out so the fast path can replay it in memory over reused
|
|
898
|
+
// rows (passing their own `heads`/`remotes`/`tags` as the ref lists and their full `parents`). Mutates
|
|
899
|
+
// the shared reachability/HEAD/downstream accumulators and returns the row's post-propagation
|
|
900
|
+
// reachable-ref map (for interning + flag derivation). `parents` is the FULL parent list (the walk
|
|
901
|
+
// always propagates through every parent, even when the emitted row stores a sliced set). Faithful
|
|
902
|
+
// extraction of the walk's former inline body — must stay byte-identical to it.
|
|
903
|
+
function accumulateRowState(
|
|
904
|
+
sha: string,
|
|
905
|
+
parents: string[],
|
|
906
|
+
refHeads: GitGraphRowHead[],
|
|
907
|
+
refRemoteHeads: GitGraphRowRemoteHead[],
|
|
908
|
+
refTags: GitGraphRowTag[],
|
|
909
|
+
head: boolean,
|
|
910
|
+
isStash: boolean,
|
|
911
|
+
): Map<string, ReachableRef> | undefined {
|
|
912
|
+
if (head) {
|
|
913
|
+
reachableFromHEAD.add(sha);
|
|
914
|
+
headSha ??= sha;
|
|
915
|
+
}
|
|
916
|
+
if (reachableFromHEAD.has(sha)) {
|
|
917
|
+
for (const parent of parents) {
|
|
918
|
+
reachableFromHEAD.add(parent);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// First-parent rewriteable chain from HEAD (see the field's declaration for the full rationale).
|
|
923
|
+
if (sha === headSha || sha === rewriteableNextSha) {
|
|
924
|
+
if (parents.length === 1) {
|
|
925
|
+
rewriteableFromHEAD.add(sha);
|
|
926
|
+
rewriteableNextSha = parents[0];
|
|
927
|
+
} else {
|
|
928
|
+
rewriteableNextSha = undefined;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
// A remote head with `current` set IS HEAD's tracking upstream tip (see `buildRowFromCommit`).
|
|
933
|
+
if (refRemoteHeads.some(r => r.current)) {
|
|
934
|
+
reachableFromHeadUpstream.add(sha);
|
|
935
|
+
}
|
|
936
|
+
if (reachableFromHeadUpstream.has(sha)) {
|
|
937
|
+
for (const parent of parents) {
|
|
938
|
+
reachableFromHeadUpstream.add(parent);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// Seed reachability from all ref types on this commit.
|
|
943
|
+
if (refHeads.length > 0 || refRemoteHeads.length > 0 || refTags.length > 0) {
|
|
944
|
+
let refs = reachableRefs.get(sha);
|
|
945
|
+
if (refs == null) {
|
|
946
|
+
refs = new Map<string, ReachableRef>();
|
|
947
|
+
reachableRefs.set(sha, refs);
|
|
948
|
+
}
|
|
949
|
+
for (const h of refHeads) {
|
|
950
|
+
refs.set(`b:${h.name}`, {
|
|
951
|
+
refType: 'branch',
|
|
952
|
+
name: h.name,
|
|
953
|
+
remote: false,
|
|
954
|
+
current: h.isCurrentHead,
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
for (const r of refRemoteHeads) {
|
|
958
|
+
const name = `${r.owner}/${r.name}`;
|
|
959
|
+
refs.set(`r:${name}`, { refType: 'branch', name: name, remote: true });
|
|
960
|
+
}
|
|
961
|
+
for (const t of refTags) {
|
|
962
|
+
refs.set(`t:${t.name}`, { refType: 'tag', name: t.name });
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
// Propagate reachability to parents (ownership-transfer fast path; see the `reachableRefs`
|
|
967
|
+
// declaration + `finalizeRowReachability` for why the first childless parent may alias the map).
|
|
968
|
+
const currentRefs = reachableRefs.get(sha);
|
|
969
|
+
if (currentRefs != null && currentRefs.size > 0) {
|
|
970
|
+
let transferred = false;
|
|
971
|
+
for (const parent of parents) {
|
|
972
|
+
const parentRefs = reachableRefs.get(parent);
|
|
973
|
+
if (parentRefs == null) {
|
|
974
|
+
if (transferred) {
|
|
975
|
+
reachableRefs.set(parent, new Map(currentRefs));
|
|
976
|
+
} else {
|
|
977
|
+
transferred = true;
|
|
978
|
+
reachableRefs.set(parent, currentRefs);
|
|
979
|
+
}
|
|
980
|
+
continue;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
for (const [key, ref] of currentRefs) {
|
|
984
|
+
if (!parentRefs.has(key)) {
|
|
985
|
+
parentRefs.set(key, ref);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
// Mark any undo-eligible tip that THIS non-stash commit builds on as non-leaf (stash rows excluded).
|
|
992
|
+
if (!isStash) {
|
|
993
|
+
for (const parent of parents) {
|
|
994
|
+
if (undoableTipShas.has(parent)) {
|
|
995
|
+
tipShasWithChildren.add(parent);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// Downstreams: each branch tip → its upstream name.
|
|
1001
|
+
for (const h of refHeads) {
|
|
1002
|
+
if (h.upstream?.name != null) {
|
|
1003
|
+
let downstreams = downstreamMap.get(h.upstream.name);
|
|
1004
|
+
if (downstreams == null) {
|
|
1005
|
+
downstreams = [];
|
|
1006
|
+
downstreamMap.set(h.upstream.name, downstreams);
|
|
1007
|
+
}
|
|
1008
|
+
downstreams.push(h.name);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
return reachableRefs.get(sha);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
// Builds the deferred `--shortstat` query for the given rows (only shas the seed doesn't cover),
|
|
1016
|
+
// shared by the ordered walk and the fast path. Increments `pendingRowsStatsCount` and resolves it
|
|
1017
|
+
// when the background query completes; returns `undefined` when stats aren't requested.
|
|
1018
|
+
const buildRowsStatsDeferred = (rows: GitGraphRow[]): GitGraph['rowsStatsDeferred'] => {
|
|
1019
|
+
if (!deferStats) return undefined;
|
|
1020
|
+
|
|
1021
|
+
pendingRowsStatsCount++;
|
|
1022
|
+
|
|
1023
|
+
// oxlint-disable-next-line no-async-promise-executor
|
|
1024
|
+
const promise = new Promise<void>(async resolve => {
|
|
1025
|
+
try {
|
|
1026
|
+
// Stats are immutable per sha — only query shas the seed doesn't already cover.
|
|
1027
|
+
let missingStdin = '';
|
|
1028
|
+
let missingStashStdin = '';
|
|
1029
|
+
for (const row of rows) {
|
|
1030
|
+
if (rowStats.has(row.sha)) continue;
|
|
1031
|
+
|
|
1032
|
+
const seeded = rowsStatsSeed?.get(row.sha);
|
|
1033
|
+
if (seeded != null) {
|
|
1034
|
+
rowStats.set(row.sha, seeded);
|
|
1035
|
+
continue;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
if (row.type === 'stash-node') {
|
|
1039
|
+
missingStashStdin += `${row.sha}\n`;
|
|
1040
|
+
} else {
|
|
1041
|
+
missingStdin += `${row.sha}\n`;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
// Fully seeded — nothing new to compute, so no git process at all.
|
|
1046
|
+
if (!missingStdin && !missingStashStdin) return;
|
|
1047
|
+
|
|
1048
|
+
// A stash is a merge commit, so its own shortstat record is empty. Stashes get their own
|
|
1049
|
+
// query diffed against the first parent (`-m --first-parent` — what `git stash show`
|
|
1050
|
+
// reports), keyed directly by stash sha: no parent remapping, so none of the old
|
|
1051
|
+
// `--no-walk` time-order races that could let the empty record win and blank the stash.
|
|
1052
|
+
const [statsResult, stashStatsResult] = await Promise.allSettled([
|
|
1053
|
+
missingStdin
|
|
1054
|
+
? this.git.run(
|
|
1055
|
+
{
|
|
1056
|
+
cwd: repoPath,
|
|
1057
|
+
configs: gitConfigsLog,
|
|
1058
|
+
stdin: missingStdin,
|
|
1059
|
+
priority: 'background',
|
|
1060
|
+
},
|
|
1061
|
+
'log',
|
|
1062
|
+
'--no-walk',
|
|
1063
|
+
'--stdin',
|
|
1064
|
+
...statsParser.arguments,
|
|
1065
|
+
'--',
|
|
1066
|
+
)
|
|
1067
|
+
: undefined,
|
|
1068
|
+
missingStashStdin
|
|
1069
|
+
? this.git.run(
|
|
1070
|
+
{
|
|
1071
|
+
cwd: repoPath,
|
|
1072
|
+
configs: gitConfigsLog,
|
|
1073
|
+
stdin: missingStashStdin,
|
|
1074
|
+
priority: 'background',
|
|
1075
|
+
},
|
|
1076
|
+
'log',
|
|
1077
|
+
'--no-walk',
|
|
1078
|
+
'--stdin',
|
|
1079
|
+
'-m',
|
|
1080
|
+
'--first-parent',
|
|
1081
|
+
...statsParser.arguments,
|
|
1082
|
+
'--',
|
|
1083
|
+
)
|
|
1084
|
+
: undefined,
|
|
1085
|
+
]);
|
|
1086
|
+
|
|
1087
|
+
for (const result of [getSettledValue(statsResult), getSettledValue(stashStatsResult)]) {
|
|
1088
|
+
if (!result?.stdout) continue;
|
|
1089
|
+
|
|
1090
|
+
for (const stat of statsParser.parse(result.stdout)) {
|
|
1091
|
+
// Don't overwrite stats already populated for this sha
|
|
1092
|
+
if (rowStats.has(stat.sha)) continue;
|
|
1093
|
+
|
|
1094
|
+
rowStats.set(stat.sha, stat.stats);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
} finally {
|
|
1098
|
+
pendingRowsStatsCount--;
|
|
1099
|
+
resolve();
|
|
1100
|
+
}
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
return { isLoaded: () => pendingRowsStatsCount === 0, promise: promise };
|
|
1104
|
+
};
|
|
1105
|
+
|
|
211
1106
|
const args = ['log', ...parser.arguments, `--${ordering}-order`, '--all'];
|
|
212
1107
|
if (stdin) {
|
|
213
1108
|
args.push('--stdin');
|
|
@@ -225,346 +1120,109 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
225
1120
|
): Promise<GitGraph> {
|
|
226
1121
|
try {
|
|
227
1122
|
iterations++;
|
|
228
|
-
const startTotal = total;
|
|
229
1123
|
|
|
230
|
-
|
|
1124
|
+
// Consume the pre-spawned first walk when available (argv identical by construction:
|
|
1125
|
+
// no cursor on the first call); paging/retry calls spawn normally. The pre-spawn's
|
|
1126
|
+
// aborter doubles as this call's so the limit-stop kills the right process.
|
|
1127
|
+
const prespawned = cursor == null && prespawn != null ? await prespawn : undefined;
|
|
1128
|
+
prespawn = undefined;
|
|
1129
|
+
|
|
1130
|
+
const aborter = prespawned != null ? prespawnAborter : new AbortController();
|
|
231
1131
|
const onAbort = () => {
|
|
232
1132
|
aborter.abort();
|
|
233
1133
|
};
|
|
234
1134
|
cancellation?.addEventListener('abort', onAbort, { once: true });
|
|
1135
|
+
// An ALREADY-aborted signal (e.g. `toAbortSignal` of a cancelled token) never fires listeners
|
|
1136
|
+
// added after the fact — without this the walk would run to completion unabortably.
|
|
1137
|
+
if (cancellation?.aborted) {
|
|
1138
|
+
onAbort();
|
|
1139
|
+
}
|
|
235
1140
|
using _disposable = createDisposable(() => cancellation?.removeEventListener('abort', onAbort));
|
|
236
1141
|
|
|
237
|
-
const stream =
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
1142
|
+
const stream =
|
|
1143
|
+
prespawned?.stream ??
|
|
1144
|
+
this.git.stream(
|
|
1145
|
+
{
|
|
1146
|
+
cwd: repoPath,
|
|
1147
|
+
configs: gitConfigsLog,
|
|
1148
|
+
cancellation: aborter.signal,
|
|
1149
|
+
stdin: stdin,
|
|
1150
|
+
// Git flushes stdout per record to a pipe, producing thousands of tiny chunks the
|
|
1151
|
+
// node side must individually await. Full stdio buffering delivers the same bytes
|
|
1152
|
+
// in far fewer, larger chunks — right for this bulk walk (an incremental consumer
|
|
1153
|
+
// wanting per-record latency should NOT set this).
|
|
1154
|
+
env: { GIT_FLUSH: '0' },
|
|
1155
|
+
},
|
|
1156
|
+
...args,
|
|
1157
|
+
cursor?.skip ? `--skip=${cursor.skip}` : undefined,
|
|
1158
|
+
'--',
|
|
1159
|
+
);
|
|
243
1160
|
using _streamDisposer = createDisposable(() => void stream.return?.(undefined));
|
|
244
1161
|
|
|
245
1162
|
const rows: GitGraphRow[] = [];
|
|
246
1163
|
|
|
247
|
-
let branch: GitBranch | undefined;
|
|
248
|
-
let branchId: string;
|
|
249
|
-
let branchName: string;
|
|
250
|
-
let head = false;
|
|
251
|
-
let isCurrentUser = false;
|
|
252
|
-
let refHead: GitGraphRowHead;
|
|
253
|
-
let refHeads: GitGraphRowHead[];
|
|
254
|
-
let refRemoteHead: GitGraphRowRemoteHead;
|
|
255
|
-
let refRemoteHeads: GitGraphRowRemoteHead[];
|
|
256
|
-
let refTag: GitGraphRowTag;
|
|
257
|
-
let refTags: GitGraphRowTag[];
|
|
258
|
-
let parent: string;
|
|
259
|
-
let parents: string[];
|
|
260
|
-
let remote: GitRemote | undefined;
|
|
261
|
-
let remoteBranchId: string;
|
|
262
|
-
let remoteName: string;
|
|
263
|
-
let shaOrRemapped: string | undefined;
|
|
264
|
-
let stash: GitStashCommit | undefined;
|
|
265
|
-
let tagId: string;
|
|
266
|
-
let tagName: string;
|
|
267
|
-
let tip: string;
|
|
268
|
-
|
|
269
1164
|
let count = 0;
|
|
270
1165
|
let found = false;
|
|
271
1166
|
let hasMore = false;
|
|
272
1167
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
branchIdOfMainWorktree: branchIdOfMainWorktree,
|
|
283
|
-
stashes: gitStash?.stashes,
|
|
284
|
-
reachableFromHEAD: reachableFromHEAD,
|
|
285
|
-
rewriteableFromHEAD: rewriteableFromHEAD,
|
|
286
|
-
tipShasWithChildren: tipShasWithChildren,
|
|
287
|
-
// `undefined` when HEAD has no upstream, so the processor flags nothing as
|
|
288
|
-
// unpublished; otherwise the live set (mutated during the walk, read by ref).
|
|
289
|
-
reachableFromHeadUpstream:
|
|
290
|
-
headRefUpstreamName != null ? reachableFromHeadUpstream : undefined,
|
|
291
|
-
avatars: avatars,
|
|
292
|
-
}
|
|
293
|
-
: undefined;
|
|
294
|
-
|
|
295
|
-
for await (const commit of parser.parseAsync(stream)) {
|
|
296
|
-
// Stopping logic (check AFTER processing the commit):
|
|
297
|
-
// - SHA + limit > 0: Find SHA, ensure at least `limit` commits loaded
|
|
298
|
-
// - SHA + limit = 0: Find SHA, stop immediately
|
|
299
|
-
// - No SHA + limit > 0: Load exactly `limit` commits
|
|
300
|
-
// - No SHA + limit = 0: Load everything remaining
|
|
301
|
-
// - SHA + limit > 0 + still unfound past 10× limit: defensive cap so an unreachable
|
|
302
|
-
// SHA (e.g. a stale merge-base the webview hasn't yet seen invalidated) can't
|
|
303
|
-
// walk the entire history. `hasMore=true` lets callers retry; the graph-wrapper
|
|
304
|
-
// side deduplicates re-requests so the cap doesn't loop.
|
|
305
|
-
if (
|
|
306
|
-
(limit && count >= limit && (!sha || found || count >= limit * 10)) ||
|
|
307
|
-
(!limit && sha && found)
|
|
308
|
-
) {
|
|
309
|
-
hasMore = true;
|
|
310
|
-
aborter.abort();
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (sha && !found && commit.sha === sha) {
|
|
315
|
-
found = true;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
count++;
|
|
319
|
-
if (ids.has(commit.sha)) continue;
|
|
320
|
-
|
|
321
|
-
total++;
|
|
322
|
-
shaOrRemapped = remappedIds.get(commit.sha);
|
|
323
|
-
if (shaOrRemapped && ids.has(shaOrRemapped)) continue;
|
|
324
|
-
|
|
325
|
-
shaOrRemapped ??= commit.sha;
|
|
326
|
-
|
|
327
|
-
ids.add(shaOrRemapped);
|
|
328
|
-
|
|
329
|
-
refHeads = [];
|
|
330
|
-
refRemoteHeads = [];
|
|
331
|
-
refTags = [];
|
|
332
|
-
|
|
333
|
-
if (commit.tips) {
|
|
334
|
-
for (tip of commit.tips.split(', ')) {
|
|
335
|
-
head = false;
|
|
336
|
-
if (tip === 'refs/stash') continue;
|
|
337
|
-
|
|
338
|
-
if (tip.startsWith('tag: ')) {
|
|
339
|
-
tagName = tip.substring(5);
|
|
340
|
-
tagId = getTagId(repoPath, tagName);
|
|
341
|
-
refTag = {
|
|
342
|
-
id: tagId,
|
|
343
|
-
name: tagName,
|
|
344
|
-
// Not currently used, so don't bother looking it up
|
|
345
|
-
annotated: true,
|
|
346
|
-
};
|
|
347
|
-
refTags.push(refTag);
|
|
348
|
-
|
|
349
|
-
continue;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
if (tip.startsWith('HEAD')) {
|
|
353
|
-
head = true;
|
|
354
|
-
reachableFromHEAD.add(shaOrRemapped);
|
|
355
|
-
headSha ??= shaOrRemapped;
|
|
356
|
-
|
|
357
|
-
if (tip !== 'HEAD') {
|
|
358
|
-
tip = tip.substring(8);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
remoteName = getRemoteNameFromBranchName(tip);
|
|
363
|
-
if (remoteName) {
|
|
364
|
-
remote = remoteMap.get(remoteName);
|
|
365
|
-
if (remote != null) {
|
|
366
|
-
branchName = getBranchNameWithoutRemote(tip);
|
|
367
|
-
if (branchName === 'HEAD') continue;
|
|
368
|
-
|
|
369
|
-
remoteBranchId = getBranchId(repoPath, true, tip);
|
|
370
|
-
const isHeadUpstream = tip === headRefUpstreamName;
|
|
371
|
-
if (isHeadUpstream) {
|
|
372
|
-
reachableFromHeadUpstream.add(shaOrRemapped);
|
|
373
|
-
}
|
|
374
|
-
refRemoteHead = {
|
|
375
|
-
id: remoteBranchId,
|
|
376
|
-
name: branchName,
|
|
377
|
-
owner: remote.name,
|
|
378
|
-
url: remote.url,
|
|
379
|
-
current: isHeadUpstream,
|
|
380
|
-
hostingServiceType: remote.provider?.gkProviderId,
|
|
381
|
-
};
|
|
382
|
-
refRemoteHeads.push(refRemoteHead);
|
|
383
|
-
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
branch = branchMap.get(tip);
|
|
389
|
-
branchId = branch?.id ?? getBranchId(repoPath, false, tip);
|
|
390
|
-
// `worktreesByBranch` has the main/default worktree removed (above), so recover it
|
|
391
|
-
// here — Undo Commit needs to reach the main worktree's HEAD even when the active
|
|
392
|
-
// workspace is a secondary worktree.
|
|
393
|
-
const worktree =
|
|
394
|
-
worktreesByBranch?.get(branchId) ??
|
|
395
|
-
(branchId === branchIdOfMainWorktree ? mainWorktree : undefined);
|
|
396
|
-
const worktreeRef =
|
|
397
|
-
worktree != null
|
|
398
|
-
? { id: getWorktreeId(repoPath, worktree.name), path: worktree.path }
|
|
399
|
-
: undefined;
|
|
400
|
-
refHead = {
|
|
401
|
-
id: branchId,
|
|
402
|
-
name: tip,
|
|
403
|
-
isCurrentHead: head,
|
|
404
|
-
upstream:
|
|
405
|
-
branch?.upstream != null
|
|
406
|
-
? {
|
|
407
|
-
name: branch.upstream.name,
|
|
408
|
-
id: getBranchId(repoPath, true, branch.upstream.name),
|
|
409
|
-
}
|
|
410
|
-
: undefined,
|
|
411
|
-
worktree: worktreeRef,
|
|
412
|
-
// Mirror `worktree.id` for `@gitkraken/gitkraken-components` — its bundled renderer
|
|
413
|
-
// reads `head.worktreeId` to pick the WORKTREE vs HEAD ref-badge. Scope to NON-default
|
|
414
|
-
// worktrees so the main checkout keeps its HEAD badge even though `worktree` (above)
|
|
415
|
-
// is populated for it for Undo routing.
|
|
416
|
-
worktreeId: worktree?.isDefault === false ? worktreeRef?.id : undefined,
|
|
417
|
-
};
|
|
418
|
-
refHeads.push(refHead);
|
|
419
|
-
if (branch?.upstream?.name != null) {
|
|
420
|
-
// Add the branch name (tip) to the upstream name entry in the downstreams map
|
|
421
|
-
let downstreams = downstreamMap.get(branch.upstream.name);
|
|
422
|
-
if (downstreams == null) {
|
|
423
|
-
downstreams = [];
|
|
424
|
-
downstreamMap.set(branch.upstream.name, downstreams);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
downstreams.push(tip);
|
|
428
|
-
}
|
|
1168
|
+
// Batched parse when available: one awaited yield per stream chunk instead of two
|
|
1169
|
+
// promise hops per record — the walk's async-iterator overhead collapses. The
|
|
1170
|
+
// with-stats parser (unused here — stats are always deferred) has no batched mode,
|
|
1171
|
+
// so wrap its per-record stream into singleton batches to keep one loop shape.
|
|
1172
|
+
const batches =
|
|
1173
|
+
parser.parseAsyncBatched?.(stream) ??
|
|
1174
|
+
(async function* (it) {
|
|
1175
|
+
for await (const commit of it) {
|
|
1176
|
+
yield [commit];
|
|
429
1177
|
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
1178
|
+
})(parser.parseAsync(stream));
|
|
1179
|
+
|
|
1180
|
+
outer: for await (const batch of batches) {
|
|
1181
|
+
for (const commit of batch) {
|
|
1182
|
+
// Stopping logic (check AFTER processing the commit):
|
|
1183
|
+
// - SHA + limit > 0: Find SHA, ensure at least `limit` commits loaded
|
|
1184
|
+
// - SHA + limit = 0: Find SHA, stop immediately
|
|
1185
|
+
// - No SHA + limit > 0: Load exactly `limit` commits
|
|
1186
|
+
// - No SHA + limit = 0: Load everything remaining
|
|
1187
|
+
// - SHA + limit > 0 + still unfound past 10× limit: defensive cap so an unreachable
|
|
1188
|
+
// SHA (e.g. a stale merge-base the webview hasn't yet seen invalidated) can't
|
|
1189
|
+
// walk the entire history. `hasMore=true` lets callers retry; the graph-wrapper
|
|
1190
|
+
// side deduplicates re-requests so the cap doesn't loop.
|
|
1191
|
+
if (
|
|
1192
|
+
(limit && count >= limit && (!sha || found || count >= limit * 10)) ||
|
|
1193
|
+
(!limit && sha && found)
|
|
1194
|
+
) {
|
|
1195
|
+
hasMore = true;
|
|
1196
|
+
aborter.abort();
|
|
1197
|
+
break outer;
|
|
436
1198
|
}
|
|
437
|
-
}
|
|
438
1199
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
// and the root — mirrors GitKraken's getDistinctCommitsFromHeadToFirstMergeCommit.
|
|
442
|
-
// Off-chain commits (a merge's other-parent ancestry, or anything below the first merge)
|
|
443
|
-
// are reachable-from-HEAD but NOT safely history-rewriteable by a plain interactive
|
|
444
|
-
// rebase. Relies on the same "commit emitted before its parents" ordering as above.
|
|
445
|
-
if (shaOrRemapped === headSha || shaOrRemapped === rewriteableNextSha) {
|
|
446
|
-
if (parents.length === 1) {
|
|
447
|
-
rewriteableFromHEAD.add(shaOrRemapped);
|
|
448
|
-
rewriteableNextSha = parents[0];
|
|
449
|
-
} else {
|
|
450
|
-
// A merge (>1 parents) or the root (0 parents) terminates the chain.
|
|
451
|
-
rewriteableNextSha = undefined;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
if (reachableFromHeadUpstream.has(shaOrRemapped)) {
|
|
455
|
-
for (parent of parents) {
|
|
456
|
-
reachableFromHeadUpstream.add(parent);
|
|
1200
|
+
if (sha && !found && commit.sha === sha) {
|
|
1201
|
+
found = true;
|
|
457
1202
|
}
|
|
458
|
-
}
|
|
459
1203
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
// Propagate reachability to parents
|
|
481
|
-
const currentRefs = reachableRefs.get(shaOrRemapped);
|
|
482
|
-
if (currentRefs != null && currentRefs.size > 0) {
|
|
483
|
-
for (parent of parents) {
|
|
484
|
-
let parentRefs = reachableRefs.get(parent);
|
|
485
|
-
if (parentRefs == null) {
|
|
486
|
-
parentRefs = new Map<string, ReachableRef>();
|
|
487
|
-
reachableRefs.set(parent, parentRefs);
|
|
488
|
-
}
|
|
489
|
-
for (const [key, ref] of currentRefs) {
|
|
490
|
-
if (!parentRefs.has(key)) {
|
|
491
|
-
parentRefs.set(key, ref);
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
stash = gitStash?.stashes.get(shaOrRemapped);
|
|
498
|
-
if (stash != null) {
|
|
499
|
-
const refs = reachableRefs.get(shaOrRemapped);
|
|
500
|
-
const row: GitGraphRow = {
|
|
501
|
-
sha: shaOrRemapped,
|
|
502
|
-
// Always only return the first parent for stashes, as it is a Git implementation for the index and untracked files
|
|
503
|
-
parents: parents.slice(0, 1),
|
|
504
|
-
author: currentUser?.name ?? commit.author,
|
|
505
|
-
email: commit.authorEmail,
|
|
506
|
-
date: Number(ordering === 'author-date' ? commit.authorDate : commit.committerDate) * 1000,
|
|
507
|
-
commitDate: Number(commit.committerDate) * 1000,
|
|
508
|
-
message: (stash.message ?? commit.message).trim(),
|
|
509
|
-
type: 'stash-node',
|
|
510
|
-
heads: refHeads,
|
|
511
|
-
remotes: refRemoteHeads,
|
|
512
|
-
tags: refTags,
|
|
513
|
-
// Transient: the row processor's `+unique` decision reads this; stripped just below.
|
|
514
|
-
// Unsorted (the consumer re-sorts after decoding) — order doesn't affect interning.
|
|
515
|
-
reachability: refs?.size ? { partial: true, refs: [...refs.values()] } : undefined,
|
|
516
|
-
isCurrentUser: true,
|
|
517
|
-
};
|
|
1204
|
+
count++;
|
|
1205
|
+
if (ids.has(commit.sha)) continue;
|
|
1206
|
+
|
|
1207
|
+
const built = buildRowFromCommit(commit);
|
|
1208
|
+
if (built == null) continue; // remapped-stash dedup
|
|
1209
|
+
|
|
1210
|
+
const { row, refHeads, refRemoteHeads, refTags, head, parents } = built;
|
|
1211
|
+
const refs = accumulateRowState(
|
|
1212
|
+
row.sha,
|
|
1213
|
+
parents,
|
|
1214
|
+
refHeads,
|
|
1215
|
+
refRemoteHeads,
|
|
1216
|
+
refTags,
|
|
1217
|
+
head,
|
|
1218
|
+
row.type === 'stash-node',
|
|
1219
|
+
);
|
|
1220
|
+
// Transient: the row processor's `+unique` decision reads this; stripped by finalize.
|
|
1221
|
+
// Unsorted (the consumer re-sorts after decoding) — order doesn't affect interning.
|
|
1222
|
+
row.reachability = refs?.size ? { partial: true, refs: [...refs.values()] } : undefined;
|
|
518
1223
|
rowProcessor?.processRow(row, graphCtx!);
|
|
519
|
-
finalizeRowReachability(row,
|
|
1224
|
+
finalizeRowReachability(row, row.sha, refs);
|
|
520
1225
|
rows.push(row);
|
|
521
|
-
|
|
522
|
-
if (stash.stats != null) {
|
|
523
|
-
rowStats.set(shaOrRemapped, {
|
|
524
|
-
files: getChangedFilesCount(stash.stats.files),
|
|
525
|
-
additions: stash.stats.additions,
|
|
526
|
-
deletions: stash.stats.deletions,
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
} else {
|
|
530
|
-
isCurrentUser = isUserMatch(currentUser, commit.author, commit.authorEmail);
|
|
531
|
-
|
|
532
|
-
// Mark any undo-eligible tip that THIS (non-stash) commit builds on as non-leaf, so
|
|
533
|
-
// its Undo Commit is withheld. Uses the full parent set (incl. merge second-parents)
|
|
534
|
-
// but only records shas that are actually undo tips — newer commits are walked first,
|
|
535
|
-
// so a tip is recorded before its own row is processed. Stash rows are intentionally
|
|
536
|
-
// not handled here, so a stash based on a tip doesn't block undoing that tip.
|
|
537
|
-
for (parent of parents) {
|
|
538
|
-
if (undoableTipShas.has(parent)) {
|
|
539
|
-
tipShasWithChildren.add(parent);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
const refs = reachableRefs.get(shaOrRemapped);
|
|
544
|
-
const row: GitGraphRow = {
|
|
545
|
-
sha: shaOrRemapped,
|
|
546
|
-
parents: onlyFollowFirstParent ? parents.slice(0, 1) : parents,
|
|
547
|
-
author: commit.author,
|
|
548
|
-
email: commit.authorEmail,
|
|
549
|
-
date: Number(ordering === 'author-date' ? commit.authorDate : commit.committerDate) * 1000,
|
|
550
|
-
commitDate: Number(commit.committerDate) * 1000,
|
|
551
|
-
message: commit.message.trim(),
|
|
552
|
-
type: parents.length > 1 ? 'merge-node' : 'commit-node',
|
|
553
|
-
heads: refHeads,
|
|
554
|
-
remotes: refRemoteHeads,
|
|
555
|
-
tags: refTags,
|
|
556
|
-
// Transient: the row processor's `+unique` decision reads this; stripped just below.
|
|
557
|
-
// Unsorted (the consumer re-sorts after decoding) — order doesn't affect interning.
|
|
558
|
-
reachability: refs?.size ? { partial: true, refs: [...refs.values()] } : undefined,
|
|
559
|
-
isCurrentUser: isCurrentUser || undefined,
|
|
560
|
-
};
|
|
561
|
-
rowProcessor?.processRow(row, graphCtx!);
|
|
562
|
-
finalizeRowReachability(row, shaOrRemapped, refs);
|
|
563
|
-
rows.push(row);
|
|
564
|
-
|
|
565
|
-
if (commit.stats != null) {
|
|
566
|
-
rowStats.set(shaOrRemapped, commit.stats);
|
|
567
|
-
}
|
|
568
1226
|
}
|
|
569
1227
|
}
|
|
570
1228
|
|
|
@@ -572,52 +1230,7 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
572
1230
|
const lastSha = last(ids);
|
|
573
1231
|
cursor = lastSha != null ? { sha: lastSha, skip: total - iterations } : undefined;
|
|
574
1232
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
if (deferStats) {
|
|
578
|
-
pendingRowsStatsCount++;
|
|
579
|
-
|
|
580
|
-
// oxlint-disable-next-line no-async-promise-executor
|
|
581
|
-
const promise = new Promise<void>(async resolve => {
|
|
582
|
-
try {
|
|
583
|
-
const args = [...statsParser.arguments];
|
|
584
|
-
if (startTotal === 0) {
|
|
585
|
-
args.push(`-n${total}`);
|
|
586
|
-
} else {
|
|
587
|
-
args.push(`-n${total - startTotal}`, `--skip=${startTotal}`);
|
|
588
|
-
}
|
|
589
|
-
args.push(`--${ordering}-order`, '--all');
|
|
590
|
-
|
|
591
|
-
const statsResult = await this.git.run(
|
|
592
|
-
{ cwd: repoPath, configs: gitConfigsLog, stdin: stdin, priority: 'background' },
|
|
593
|
-
'log',
|
|
594
|
-
stdin ? '--stdin' : undefined,
|
|
595
|
-
...args,
|
|
596
|
-
'--',
|
|
597
|
-
);
|
|
598
|
-
|
|
599
|
-
if (statsResult.stdout) {
|
|
600
|
-
let statShaOrRemapped;
|
|
601
|
-
for (const stat of statsParser.parse(statsResult.stdout)) {
|
|
602
|
-
statShaOrRemapped = remappedIds.get(stat.sha) ?? stat.sha;
|
|
603
|
-
|
|
604
|
-
// Don't overwrite stats already populated for this sha
|
|
605
|
-
if (rowStats.has(statShaOrRemapped)) continue;
|
|
606
|
-
|
|
607
|
-
rowStats.set(statShaOrRemapped, stat.stats);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
} finally {
|
|
611
|
-
pendingRowsStatsCount--;
|
|
612
|
-
resolve();
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
rowsStatsDeferred = {
|
|
617
|
-
isLoaded: () => pendingRowsStatsCount === 0,
|
|
618
|
-
promise: promise,
|
|
619
|
-
};
|
|
620
|
-
}
|
|
1233
|
+
const rowsStatsDeferred = buildRowsStatsDeferred(rows);
|
|
621
1234
|
|
|
622
1235
|
return {
|
|
623
1236
|
repoPath: repoPath,
|
|
@@ -633,6 +1246,9 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
633
1246
|
reachableFromHEAD: reachableFromHEAD,
|
|
634
1247
|
rewriteableFromHEAD: rewriteableFromHEAD,
|
|
635
1248
|
reachability: reachabilityBuilder.build(),
|
|
1249
|
+
refTips: refTips,
|
|
1250
|
+
decorationFingerprint: decorationFingerprint,
|
|
1251
|
+
shallow: shallow,
|
|
636
1252
|
rows: rows,
|
|
637
1253
|
id: sha ?? rev,
|
|
638
1254
|
rowsStats: rowStats,
|
|
@@ -657,6 +1273,460 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
657
1273
|
}
|
|
658
1274
|
}
|
|
659
1275
|
|
|
1276
|
+
// R6b incremental head-walk fast path: enumerate ONLY the new commits, stitch the seed's cached tail,
|
|
1277
|
+
// and re-derive flags/reachability in memory — instead of re-walking every loaded row. Returns
|
|
1278
|
+
// `undefined` (→ full walk below) on any structural change. Reports the outcome via `onIncrementalResult`.
|
|
1279
|
+
let incrementalFallbackReason: IncrementalGraphFallbackReason | undefined;
|
|
1280
|
+
const tryIncrementalGraph = async (seed: GraphIncrementalSeed): Promise<GitGraph | undefined> => {
|
|
1281
|
+
const onResult = options?.onIncrementalResult;
|
|
1282
|
+
// Reports a fallback outcome; callers then `return undefined` to take the full walk.
|
|
1283
|
+
const fallback = (reason: IncrementalGraphFallbackReason): void => {
|
|
1284
|
+
incrementalFallbackReason = reason;
|
|
1285
|
+
onResult?.({ path: 'fallback', reason: reason });
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
// Cheap gates (no git).
|
|
1289
|
+
if (rowProcessor == null || graphCtx == null) {
|
|
1290
|
+
fallback('no-row-processor');
|
|
1291
|
+
return undefined;
|
|
1292
|
+
}
|
|
1293
|
+
// The convergence + date-boundary reasoning is only sound for `date` order.
|
|
1294
|
+
if (ordering !== 'date' || seed.ordering !== 'date') {
|
|
1295
|
+
fallback('ordering-not-date');
|
|
1296
|
+
return undefined;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
const seedShas = new Set<string>(seed.rows.map(r => r.sha));
|
|
1300
|
+
|
|
1301
|
+
// A `rev` narrows the walk's find/stop semantics. The host's same-repo rebuild passes a rebuild
|
|
1302
|
+
// ANCHOR sha (the loaded window's bottom) to pin that boundary — the anchor is by construction inside
|
|
1303
|
+
// the seed, and the stitch + trim below preserve the seed tail, so the fast path can honor it (it
|
|
1304
|
+
// grows the window down to the anchor; see the window/limit shape below). A rev NOT in the seed is a
|
|
1305
|
+
// real out-of-window target (deep link, reveal) the fast path can't reach → full walk.
|
|
1306
|
+
if (rev != null && !seedShas.has(rev)) {
|
|
1307
|
+
fallback('rev-outside-seed');
|
|
1308
|
+
return undefined;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// First-parent (now or in the seed) means the emitted rows carry sliced parents the in-memory
|
|
1312
|
+
// re-derivation can't expand back to the full set the walk propagates through.
|
|
1313
|
+
if (onlyFollowFirstParent || seed.onlyFollowFirstParent) {
|
|
1314
|
+
fallback('first-parent');
|
|
1315
|
+
return undefined;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
// The ACTUAL current HEAD sha (to seed reachable-from-HEAD and detect a checkout). Distinct from
|
|
1319
|
+
// `selectSha`, which resolves the `rev` ANCHOR — not HEAD — when a rev is passed: with no rev
|
|
1320
|
+
// `selectSha` already IS the resolved HEAD, otherwise take the current branch tip (also populated for
|
|
1321
|
+
// a detached HEAD). The graph `id` still mirrors the full walk's `selectSha ?? rev` (below).
|
|
1322
|
+
const currentHeadSha = rev == null ? selectSha : headBranch?.sha;
|
|
1323
|
+
|
|
1324
|
+
// Reuse the prelude's tips (same repo state — nothing mutates between the prelude and here).
|
|
1325
|
+
const currentTips = refTips;
|
|
1326
|
+
|
|
1327
|
+
// Shallow-state gate: an un-shallow (or re-shallow) while the graph was closed leaves every branch
|
|
1328
|
+
// tip put — so it passes the tip diff below — yet changes what history exists BELOW the loaded window
|
|
1329
|
+
// (a stale-false `hasMore` would hide the newly deepened commits). Any change → full walk. Checked
|
|
1330
|
+
// against the prelude's already-captured `shallow` (no extra git).
|
|
1331
|
+
if ((seed.shallow ?? false) !== shallow) {
|
|
1332
|
+
fallback('shallow-changed');
|
|
1333
|
+
return undefined;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
// Replace-ref gate: `git replace` (and grafts) rewrite ancestry PRESENTATION globally, so any
|
|
1337
|
+
// change to the replace-ref set (`refs/replace/*`) invalidates the cached rows' parent links even when
|
|
1338
|
+
// no branch tip moved. An UNCHANGED set (including non-empty) stays fast-path-eligible — the seed rows
|
|
1339
|
+
// were built under the same replacement view. Replace refs aren't `isMoveableGraphRef`s (no badge), so
|
|
1340
|
+
// the tip diff below skips them; diff them here on their own.
|
|
1341
|
+
let seedReplaceCount = 0;
|
|
1342
|
+
for (const [refname, oldSha] of seed.tips) {
|
|
1343
|
+
if (!refname.startsWith('refs/replace/')) continue;
|
|
1344
|
+
|
|
1345
|
+
seedReplaceCount++;
|
|
1346
|
+
// Removed (gone from current) or retargeted (points at a different replacement object).
|
|
1347
|
+
if (currentTips.get(refname) !== oldSha) {
|
|
1348
|
+
fallback('replace-refs-changed');
|
|
1349
|
+
return undefined;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
let currentReplaceCount = 0;
|
|
1353
|
+
for (const refname of currentTips.keys()) {
|
|
1354
|
+
if (refname.startsWith('refs/replace/')) {
|
|
1355
|
+
currentReplaceCount++;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
// Every seed replace ref is present-and-equal in current (checked above); an unequal count means a
|
|
1359
|
+
// replace ref was ADDED.
|
|
1360
|
+
if (seedReplaceCount !== currentReplaceCount) {
|
|
1361
|
+
fallback('replace-refs-changed');
|
|
1362
|
+
return undefined;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
// Ref-tip diff gate: deletions + non-fast-forward moves force a full walk.
|
|
1366
|
+
// Reused rows whose ref badges / current-HEAD flag changed and must be rebuilt from raw git.
|
|
1367
|
+
const affected = new Set<string>();
|
|
1368
|
+
const ffPairs: [string, string][] = [];
|
|
1369
|
+
// A moved/new REMOTE ref also changes its tracking branches' ahead/behind — baked into those
|
|
1370
|
+
// branch pills' serialized contexts (`+ahead`/`+behind` drive Push/Pull menu gating) — while the
|
|
1371
|
+
// LOCAL tips stay put; refetch those rows too so a plain fetch corrects them without a full walk.
|
|
1372
|
+
const addTrackingBranchRows = (remoteRefname: string): void => {
|
|
1373
|
+
if (branches == null || !remoteRefname.startsWith('refs/remotes/')) return;
|
|
1374
|
+
|
|
1375
|
+
const upstreamName = remoteRefname.substring('refs/remotes/'.length);
|
|
1376
|
+
for (const b of branches) {
|
|
1377
|
+
if (b.upstream?.name === upstreamName && b.sha != null && seedShas.has(b.sha)) {
|
|
1378
|
+
affected.add(b.sha);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1382
|
+
for (const [refname, oldSha] of seed.tips) {
|
|
1383
|
+
if (!isMoveableGraphRef(refname)) continue;
|
|
1384
|
+
|
|
1385
|
+
const cur = currentTips.get(refname);
|
|
1386
|
+
if (cur == null) {
|
|
1387
|
+
fallback('ref-deleted');
|
|
1388
|
+
return undefined;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
if (cur !== oldSha) {
|
|
1392
|
+
ffPairs.push([oldSha, cur]);
|
|
1393
|
+
if (seedShas.has(oldSha)) {
|
|
1394
|
+
affected.add(oldSha);
|
|
1395
|
+
}
|
|
1396
|
+
if (seedShas.has(cur)) {
|
|
1397
|
+
affected.add(cur);
|
|
1398
|
+
}
|
|
1399
|
+
addTrackingBranchRows(refname);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
// New refs (present now, absent from the seed) landing on an already-loaded row.
|
|
1403
|
+
for (const [refname, cur] of currentTips) {
|
|
1404
|
+
if (!isMoveableGraphRef(refname) || seed.tips.has(refname)) continue;
|
|
1405
|
+
|
|
1406
|
+
if (seedShas.has(cur)) {
|
|
1407
|
+
affected.add(cur);
|
|
1408
|
+
}
|
|
1409
|
+
addTrackingBranchRows(refname);
|
|
1410
|
+
}
|
|
1411
|
+
if (ffPairs.length > 0) {
|
|
1412
|
+
// Bounded fan-out: a mass-moved-ref fetch can produce hundreds of pairs — an unbounded
|
|
1413
|
+
// `Promise.all` would monopolize (or overflow) the git queue. Small chunks stay well under the
|
|
1414
|
+
// queue's slot count, and the first non-fast-forward bails without paying for the rest.
|
|
1415
|
+
const ffCheckChunkSize = 4;
|
|
1416
|
+
for (let i = 0; i < ffPairs.length; i += ffCheckChunkSize) {
|
|
1417
|
+
const results = await Promise.all(
|
|
1418
|
+
ffPairs
|
|
1419
|
+
.slice(i, i + ffCheckChunkSize)
|
|
1420
|
+
.map(([oldSha, newSha]) => this.isFastForward(repoPath, oldSha, newSha, cancellation)),
|
|
1421
|
+
);
|
|
1422
|
+
if (results.some(ok => !ok)) {
|
|
1423
|
+
fallback('ref-non-fast-forward');
|
|
1424
|
+
return undefined;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
// HEAD move (checkout) — old/new HEAD rows need their `isCurrentHead` re-derived from raw git. A
|
|
1430
|
+
// checkout between two branches sitting on the SAME commit moves no sha yet flips which head carries
|
|
1431
|
+
// `isCurrentHead`, so compare the current-head ref NAME too (both are git short refnames; a detached
|
|
1432
|
+
// HEAD has an undefined branch name). Either sha or name differing re-derives both endpoints' rows.
|
|
1433
|
+
const priorHeadRow = seed.rows.find(r => r.heads?.some(h => h.isCurrentHead));
|
|
1434
|
+
const priorHeadSha = priorHeadRow?.sha;
|
|
1435
|
+
const priorHeadName = priorHeadRow?.heads?.find(h => h.isCurrentHead)?.name;
|
|
1436
|
+
const currentHeadName = headBranch?.name;
|
|
1437
|
+
if (priorHeadSha !== currentHeadSha || priorHeadName !== currentHeadName) {
|
|
1438
|
+
if (priorHeadSha != null && seedShas.has(priorHeadSha)) {
|
|
1439
|
+
affected.add(priorHeadSha);
|
|
1440
|
+
}
|
|
1441
|
+
if (currentHeadSha != null && seedShas.has(currentHeadSha)) {
|
|
1442
|
+
affected.add(currentHeadSha);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
// Stash-set gate: any push/pop/drop changes the injected rows.
|
|
1447
|
+
const currentStashShas =
|
|
1448
|
+
gitStash?.stashes != null ? new Set<string>(gitStash.stashes.keys()) : new Set<string>();
|
|
1449
|
+
const priorStashShas = seed.rows.filter(r => r.type === 'stash-node').map(r => r.sha);
|
|
1450
|
+
if (priorStashShas.length !== currentStashShas.size || priorStashShas.some(s => !currentStashShas.has(s))) {
|
|
1451
|
+
fallback('stash-changed');
|
|
1452
|
+
return undefined;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// Decoration-metadata gate: rows EMBED metadata derived from side inputs (default branch,
|
|
1456
|
+
// upstreams, worktree assignments, remote urls/providers, current user) that can change without
|
|
1457
|
+
// moving any ref tip — e.g. `git remote set-head`, `branch --set-upstream-to`, `worktree add`.
|
|
1458
|
+
// Reused rows keep their prior decorations (only flags/reachability are re-derived below), so ANY
|
|
1459
|
+
// change here must take the full walk that rebuilds them. An absent seed fingerprint (old persisted
|
|
1460
|
+
// snapshot) never matches — safe full fallback. Deliberately LAST of the gates so the structural
|
|
1461
|
+
// gates above keep their precise reasons (a deleted tracking branch reports `ref-deleted`, not this).
|
|
1462
|
+
if (seed.decorationFingerprint !== decorationFingerprint) {
|
|
1463
|
+
fallback('metadata-changed');
|
|
1464
|
+
return undefined;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
// Per-branch upstream retargets/removals/additions on RETAINED rows: a branch pill embeds its
|
|
1468
|
+
// upstream, and a tip-stationary branch's row is reused as-is — so compare every seed-row pill's
|
|
1469
|
+
// embedded upstream against the current mapping. Kept OUT of the fingerprint so a NEW tracking
|
|
1470
|
+
// branch stays fast (its row is rebuilt via the `affected` refetch; a deleted one is `ref-deleted`).
|
|
1471
|
+
for (const r of seed.rows) {
|
|
1472
|
+
if (r.heads == null) continue;
|
|
1473
|
+
|
|
1474
|
+
for (const h of r.heads) {
|
|
1475
|
+
const currentBranch = branchMap.get(h.name);
|
|
1476
|
+
if (currentBranch == null) continue;
|
|
1477
|
+
|
|
1478
|
+
if (h.upstream?.name !== currentBranch.upstream?.name) {
|
|
1479
|
+
fallback('metadata-changed');
|
|
1480
|
+
return undefined;
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
// Enumerate the new commits (reachable now but not from any prior tip) + boundary check.
|
|
1486
|
+
// Stashes' rows are already in the seed, so their shas join the EXCLUSIONS (passing them via
|
|
1487
|
+
// `--all` would re-emit them as "new"). The exclusions are fed as `^sha` lines over stdin, NOT
|
|
1488
|
+
// argv — a repo can carry more distinct ref tips (tags, PR refs) than a command line holds
|
|
1489
|
+
// (Windows caps ~32K chars), and stdin is unbounded.
|
|
1490
|
+
const notShas = new Set<string>(seed.tips.values());
|
|
1491
|
+
for (const s of currentStashShas) {
|
|
1492
|
+
notShas.add(s);
|
|
1493
|
+
}
|
|
1494
|
+
let exclusionsStdin = '';
|
|
1495
|
+
for (const s of notShas) {
|
|
1496
|
+
exclusionsStdin += `^${s}\n`;
|
|
1497
|
+
}
|
|
1498
|
+
const enumResult = await this.git.run(
|
|
1499
|
+
{ cwd: repoPath, configs: gitConfigsLog, cancellation: cancellation, stdin: exclusionsStdin },
|
|
1500
|
+
'log',
|
|
1501
|
+
...parser.arguments,
|
|
1502
|
+
'--date-order',
|
|
1503
|
+
'--all',
|
|
1504
|
+
'--stdin',
|
|
1505
|
+
'--',
|
|
1506
|
+
);
|
|
1507
|
+
const newCommits = [...parser.parse(enumResult.stdout)];
|
|
1508
|
+
|
|
1509
|
+
// Stitch soundness: the result must equal [...new, ...seed]. That holds iff every new commit is
|
|
1510
|
+
// strictly newer than the seam (the max date across the seed window) — an equal/older date could
|
|
1511
|
+
// interleave under `--date-order`, so bail. Checked on raw dates BEFORE any mutation.
|
|
1512
|
+
let maxSeedDate = Number.NEGATIVE_INFINITY;
|
|
1513
|
+
for (const r of seed.rows) {
|
|
1514
|
+
if (r.date > maxSeedDate) {
|
|
1515
|
+
maxSeedDate = r.date;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
for (const c of newCommits) {
|
|
1519
|
+
if (Number(c.committerDate) * 1000 <= maxSeedDate) {
|
|
1520
|
+
fallback('date-boundary');
|
|
1521
|
+
return undefined;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
// Window/limit shape.
|
|
1526
|
+
const stitchedSize = newCommits.length + seed.rows.length;
|
|
1527
|
+
const seedHasMore = seed.hasMore === true;
|
|
1528
|
+
const noLimit = defaultLimit === 0;
|
|
1529
|
+
// The rev anchor (a seed sha) bounds the walk's BOTTOM: the full walk with `sha=rev` grows its window
|
|
1530
|
+
// down to (and INCLUDING) rev before honoring the limit — and with no limit it stops the instant it
|
|
1531
|
+
// finds rev — so the anchor row survives the trim even when `limit` alone would cut above it. Its index
|
|
1532
|
+
// in the assembled window `[new…, seed…]` (new commits never dedup, so `newRows.length` equals
|
|
1533
|
+
// `newCommits.length`): `newCommits.length + <its index in seed.rows>`.
|
|
1534
|
+
const revWindowIndex = rev != null ? newCommits.length + seed.rows.findIndex(r => r.sha === rev) : -1;
|
|
1535
|
+
// Rows the walk targets: `defaultLimit`, raised to at least include the rev anchor (with no limit + rev,
|
|
1536
|
+
// exactly `revWindowIndex + 1`, since the walk stops on finding rev).
|
|
1537
|
+
const targetRows =
|
|
1538
|
+
rev != null
|
|
1539
|
+
? noLimit
|
|
1540
|
+
? revWindowIndex + 1
|
|
1541
|
+
: Math.max(defaultLimit, revWindowIndex + 1)
|
|
1542
|
+
: defaultLimit;
|
|
1543
|
+
// The fast path can only serve rows the seed carries; if more is wanted than it holds AND there was
|
|
1544
|
+
// more below it, git is needed for the gap → full walk. (No rev + no limit wants everything below.)
|
|
1545
|
+
const wantsBelowWindow = rev != null ? targetRows > stitchedSize : noLimit || defaultLimit > stitchedSize;
|
|
1546
|
+
if (wantsBelowWindow && seedHasMore) {
|
|
1547
|
+
fallback('limit-exceeds-seed');
|
|
1548
|
+
return undefined;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
const trimTo =
|
|
1552
|
+
rev != null
|
|
1553
|
+
? Math.min(targetRows, stitchedSize)
|
|
1554
|
+
: noLimit
|
|
1555
|
+
? stitchedSize
|
|
1556
|
+
: Math.min(defaultLimit, stitchedSize);
|
|
1557
|
+
const hasMore = trimTo < stitchedSize || seedHasMore;
|
|
1558
|
+
// Stashes present in the window make the `more()` skip math (records vs unique ids) ambiguous —
|
|
1559
|
+
// only take the fast path when nothing pages below.
|
|
1560
|
+
if (currentStashShas.size > 0 && hasMore) {
|
|
1561
|
+
fallback('stash-window-conflict');
|
|
1562
|
+
return undefined;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
// Commit to the fast path — mutations begin here (all fallbacks are above).
|
|
1566
|
+
const newRows: GitGraphRow[] = [];
|
|
1567
|
+
for (const c of newCommits) {
|
|
1568
|
+
const built = buildRowFromCommit(c);
|
|
1569
|
+
if (built != null) {
|
|
1570
|
+
newRows.push(built.row);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
// Rebuild the affected reused rows from raw git (bounded `--no-walk`) so their ref badges + emojified
|
|
1575
|
+
// message + current-HEAD flag are exactly what a full walk would produce (git owns %D ordering).
|
|
1576
|
+
const refetched = new Map<string, GitGraphRow>();
|
|
1577
|
+
if (affected.size > 0) {
|
|
1578
|
+
// SHAs over stdin, not argv — a mass-moved-ref fetch can put hundreds of retained rows in
|
|
1579
|
+
// `affected`, past what a command line holds (see the enumeration above).
|
|
1580
|
+
const refetchResult = await this.git.run(
|
|
1581
|
+
{ cwd: repoPath, configs: gitConfigsLog, cancellation: cancellation, stdin: join(affected, '\n') },
|
|
1582
|
+
'log',
|
|
1583
|
+
...parser.arguments,
|
|
1584
|
+
'--no-walk',
|
|
1585
|
+
'--stdin',
|
|
1586
|
+
'--',
|
|
1587
|
+
);
|
|
1588
|
+
for (const c of parser.parse(refetchResult.stdout)) {
|
|
1589
|
+
const built = buildRowFromCommit(c);
|
|
1590
|
+
if (built != null) {
|
|
1591
|
+
refetched.set(built.row.sha, built.row);
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
const freshShas = new Set<string>([...newRows.map(r => r.sha), ...refetched.keys()]);
|
|
1596
|
+
|
|
1597
|
+
// Assemble [new…, reused/refetched…] and trim to the requested window (new commits push the
|
|
1598
|
+
// bottom rows out — exactly what a full walk at this limit does).
|
|
1599
|
+
const windowRows: GitGraphRow[] = [...newRows];
|
|
1600
|
+
for (const r of seed.rows) {
|
|
1601
|
+
windowRows.push(refetched.get(r.sha) ?? r);
|
|
1602
|
+
}
|
|
1603
|
+
windowRows.length = Math.min(windowRows.length, trimTo);
|
|
1604
|
+
|
|
1605
|
+
// Building the fresh rows above populated `ids`/`total` (via `buildRowFromCommit`); reset and rebuild
|
|
1606
|
+
// them from the FINAL trimmed window so `ids`/`total`/the reachability boundary match a full walk
|
|
1607
|
+
// exactly (this is what makes `more()` continue identically).
|
|
1608
|
+
ids.clear();
|
|
1609
|
+
total = 0;
|
|
1610
|
+
for (const row of windowRows) {
|
|
1611
|
+
ids.add(row.sha);
|
|
1612
|
+
total++;
|
|
1613
|
+
const refs = accumulateRowState(
|
|
1614
|
+
row.sha,
|
|
1615
|
+
row.parents,
|
|
1616
|
+
row.heads ?? [],
|
|
1617
|
+
row.remotes ?? [],
|
|
1618
|
+
row.tags ?? [],
|
|
1619
|
+
row.sha === currentHeadSha,
|
|
1620
|
+
row.type === 'stash-node',
|
|
1621
|
+
);
|
|
1622
|
+
if (freshShas.has(row.sha)) {
|
|
1623
|
+
// Fresh rows are raw — run the full processor (contexts, emojify, avatar). Reused rows keep
|
|
1624
|
+
// their already-processed contexts/message; only their flags (below) are recomputed.
|
|
1625
|
+
row.reachability = refs?.size ? { partial: true, refs: [...refs.values()] } : undefined;
|
|
1626
|
+
rowProcessor.processRow(row, graphCtx);
|
|
1627
|
+
}
|
|
1628
|
+
// Authoritative flags for every commit row (membership can shift on reused rows too — e.g. a new
|
|
1629
|
+
// interior branch flips `+unique`). Stash rows carry none.
|
|
1630
|
+
if (row.type !== 'stash-node') {
|
|
1631
|
+
(row.contexts ??= {}).flags = computeGraphRowContextFlags(row.sha, refs?.values(), graphCtx);
|
|
1632
|
+
}
|
|
1633
|
+
finalizeRowReachability(row, row.sha, refs);
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
// Reconstruct the walk's first-call cursor so `more()` (which re-spawns git from `--skip`) continues
|
|
1637
|
+
// byte-identically off the trimmed window.
|
|
1638
|
+
iterations = 1;
|
|
1639
|
+
const lastSha = last(ids);
|
|
1640
|
+
const cursor = lastSha != null ? { sha: lastSha, skip: total - iterations } : undefined;
|
|
1641
|
+
const rowsStatsDeferred = buildRowsStatsDeferred(windowRows);
|
|
1642
|
+
|
|
1643
|
+
onResult?.({ path: 'fast', added: newRows.length });
|
|
1644
|
+
return {
|
|
1645
|
+
repoPath: repoPath,
|
|
1646
|
+
avatars: avatars,
|
|
1647
|
+
ids: ids,
|
|
1648
|
+
includes: options?.include,
|
|
1649
|
+
branches: branchMap,
|
|
1650
|
+
remotes: remoteMap,
|
|
1651
|
+
downstreams: downstreamMap,
|
|
1652
|
+
stashes: gitStash?.stashes,
|
|
1653
|
+
worktrees: worktrees,
|
|
1654
|
+
worktreesByBranch: worktreesByBranch,
|
|
1655
|
+
reachableFromHEAD: reachableFromHEAD,
|
|
1656
|
+
rewriteableFromHEAD: rewriteableFromHEAD,
|
|
1657
|
+
reachability: reachabilityBuilder.build(),
|
|
1658
|
+
refTips: refTips,
|
|
1659
|
+
decorationFingerprint: decorationFingerprint,
|
|
1660
|
+
shallow: shallow,
|
|
1661
|
+
rows: windowRows,
|
|
1662
|
+
// Mirror the full walk's `id` (`sha ?? rev`, sha = the resolved rev-or-HEAD) — NOT the actual HEAD,
|
|
1663
|
+
// which `currentHeadSha` now tracks separately when a rev anchor is passed.
|
|
1664
|
+
id: selectSha ?? rev,
|
|
1665
|
+
rowsStats: rowStats,
|
|
1666
|
+
rowsStatsDeferred: rowsStatsDeferred,
|
|
1667
|
+
paging: {
|
|
1668
|
+
limit: noLimit ? total : defaultLimit,
|
|
1669
|
+
startingCursor: undefined,
|
|
1670
|
+
hasMore: hasMore,
|
|
1671
|
+
},
|
|
1672
|
+
more: async (limit: number, sha?: string, cancellation?: AbortSignal): Promise<GitGraph | undefined> =>
|
|
1673
|
+
getCommitsForGraphCore.call(this, limit, sha, cursor, cancellation),
|
|
1674
|
+
};
|
|
1675
|
+
};
|
|
1676
|
+
|
|
1677
|
+
if (options?.incrementalSeed != null) {
|
|
1678
|
+
let fast: GitGraph | undefined;
|
|
1679
|
+
try {
|
|
1680
|
+
fast = await tryIncrementalGraph(options.incrementalSeed);
|
|
1681
|
+
} catch (ex) {
|
|
1682
|
+
// The fast path must never fail where the full walk it accelerates would succeed — its git
|
|
1683
|
+
// operations have failure modes the `--all` walk doesn't (per-tip `--not` argv on huge ref
|
|
1684
|
+
// sets, queue-depth overflow fanning out FF checks, transient git errors). Cancellation
|
|
1685
|
+
// still propagates; anything else degrades to the full walk below.
|
|
1686
|
+
if (isCancellationError(ex) || cancellation?.aborted) throw ex;
|
|
1687
|
+
|
|
1688
|
+
// The fast path may have died AFTER its mutation barrier (the affected-row refetch, or the
|
|
1689
|
+
// row processor) with the walk accumulators partially populated — a full walk over polluted
|
|
1690
|
+
// `ids` would silently DROP those rows (its loop dedups on `ids.has`). Reset every closure
|
|
1691
|
+
// accumulator to its pristine pre-walk state; the seeded reachability builder is append-only
|
|
1692
|
+
// and tolerates orphaned interns by design, and mutated reused-row objects are superseded by
|
|
1693
|
+
// the full walk's fresh rows.
|
|
1694
|
+
ids.clear();
|
|
1695
|
+
total = 0;
|
|
1696
|
+
iterations = 0;
|
|
1697
|
+
rowStats.clear();
|
|
1698
|
+
avatars.clear();
|
|
1699
|
+
reachableFromHEAD.clear();
|
|
1700
|
+
rewriteableFromHEAD.clear();
|
|
1701
|
+
reachableFromHeadUpstream.clear();
|
|
1702
|
+
reachableRefs.clear();
|
|
1703
|
+
tipShasWithChildren.clear();
|
|
1704
|
+
downstreamMap.clear();
|
|
1705
|
+
headSha = undefined;
|
|
1706
|
+
rewriteableNextSha = undefined;
|
|
1707
|
+
|
|
1708
|
+
scope?.warn(`incremental graph walk failed; falling back to full walk; ${String(ex)}`);
|
|
1709
|
+
incrementalFallbackReason = 'error';
|
|
1710
|
+
options.onIncrementalResult?.({ path: 'fallback', reason: 'error' });
|
|
1711
|
+
}
|
|
1712
|
+
if (fast != null) {
|
|
1713
|
+
return fast;
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
// Parent-rewriting fallbacks change boundary commits' true diffs — an unshallowed parent or a
|
|
1717
|
+
// replace-ref retarget makes previously-computed per-sha stats stale, so the fallback walk must
|
|
1718
|
+
// recompute them instead of carrying the prior generation's values forward. An `error` fallback
|
|
1719
|
+
// recomputes too: the throw may have preceded the replace-ref/shallow gates, so staleness can't
|
|
1720
|
+
// be ruled out.
|
|
1721
|
+
if (
|
|
1722
|
+
incrementalFallbackReason === 'shallow-changed' ||
|
|
1723
|
+
incrementalFallbackReason === 'replace-refs-changed' ||
|
|
1724
|
+
incrementalFallbackReason === 'error'
|
|
1725
|
+
) {
|
|
1726
|
+
rowsStatsSeed = undefined;
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
|
|
660
1730
|
let graph = await getCommitsForGraphCore.call(this, defaultLimit, selectSha, undefined, cancellation);
|
|
661
1731
|
|
|
662
1732
|
// Spurious-empty guard: the repo has branches (so `git log --all` should yield commits) yet the
|
|
@@ -745,8 +1815,37 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
745
1815
|
let stdin: string | undefined;
|
|
746
1816
|
let remappedIds: Map<string, string>;
|
|
747
1817
|
|
|
1818
|
+
let resolvedShas: Set<string> | undefined;
|
|
748
1819
|
if (shas?.size) {
|
|
749
|
-
|
|
1820
|
+
resolvedShas = await this.provider.revision.resolveShas(repoPath, shas, cancellation);
|
|
1821
|
+
// Never throw on cancellation here: the outer catch wraps non-GitSearchError into
|
|
1822
|
+
// GitSearchError, which surfaces as a false "Invalid search pattern". Return instead.
|
|
1823
|
+
if (cancellation?.aborted) {
|
|
1824
|
+
return {
|
|
1825
|
+
repoPath: repoPath,
|
|
1826
|
+
query: search,
|
|
1827
|
+
queryFilters: filters,
|
|
1828
|
+
comparisonKey: comparisonKey,
|
|
1829
|
+
results: existingResults ?? new Map<string, GitGraphSearchResultData>(),
|
|
1830
|
+
hasMore: true,
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
// Short SHA(s) matched no commit: return empty (empty stdin to `--no-walk --stdin`
|
|
1834
|
+
// would return HEAD, so we must not fall through to git).
|
|
1835
|
+
if (!resolvedShas.size) {
|
|
1836
|
+
return {
|
|
1837
|
+
repoPath: repoPath,
|
|
1838
|
+
query: search,
|
|
1839
|
+
queryFilters: filters,
|
|
1840
|
+
comparisonKey: comparisonKey,
|
|
1841
|
+
results: existingResults ?? new Map<string, GitGraphSearchResultData>(),
|
|
1842
|
+
hasMore: false,
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
if (resolvedShas?.size) {
|
|
1848
|
+
stdin = join(resolvedShas, '\n');
|
|
750
1849
|
args.push('--no-walk');
|
|
751
1850
|
|
|
752
1851
|
remappedIds = new Map();
|
|
@@ -794,6 +1893,11 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
794
1893
|
aborter.abort();
|
|
795
1894
|
};
|
|
796
1895
|
cancellation?.addEventListener('abort', onAbort, { once: true });
|
|
1896
|
+
// An ALREADY-aborted signal (e.g. `toAbortSignal` of a cancelled token) never fires listeners
|
|
1897
|
+
// added after the fact — without this the walk would run to completion unabortably.
|
|
1898
|
+
if (cancellation?.aborted) {
|
|
1899
|
+
onAbort();
|
|
1900
|
+
}
|
|
797
1901
|
using _disposable = createDisposable(() => cancellation?.removeEventListener('abort', onAbort));
|
|
798
1902
|
|
|
799
1903
|
const stream = this.git.stream(
|
|
@@ -957,3 +2061,277 @@ export class GraphGitSubProvider implements GitGraphSubProvider {
|
|
|
957
2061
|
}
|
|
958
2062
|
}
|
|
959
2063
|
}
|
|
2064
|
+
|
|
2065
|
+
/**
|
|
2066
|
+
* CLI-backed {@link GitGraphSession}: a stateful facade over {@link GraphGitSubProvider.getGraph}. It
|
|
2067
|
+
* owns the canonical accumulated window and builds the R6b incremental seed internally (from the window,
|
|
2068
|
+
* the prior walk's tips/reachability/stats, and the walk shape), so the host no longer mirrors loaded
|
|
2069
|
+
* rows, stamps ref tips, or hand-assembles a seed. Behavior-neutral: `refresh`/`more` reproduce exactly
|
|
2070
|
+
* what the host's `getState` seed construction + `setGraph` mirror maintenance + write-once avatar merge
|
|
2071
|
+
* did.
|
|
2072
|
+
*/
|
|
2073
|
+
class GraphSession implements GitGraphSession {
|
|
2074
|
+
// Assigned by `initialize` before the session is handed out; never read before then.
|
|
2075
|
+
private _current!: GitGraph;
|
|
2076
|
+
private _window: readonly GitGraphRow[] = [];
|
|
2077
|
+
// The walk shape (`ordering|onlyFollowFirstParent`) the current window was produced under — the
|
|
2078
|
+
// incremental seed is only valid when the NEXT walk uses the SAME shape (a graph object doesn't
|
|
2079
|
+
// record its shape, so it's tracked here). Undefined until the first walk lands.
|
|
2080
|
+
private _buildShape: string | undefined;
|
|
2081
|
+
|
|
2082
|
+
constructor(
|
|
2083
|
+
private readonly provider: GraphGitSubProvider,
|
|
2084
|
+
readonly repoPath: string,
|
|
2085
|
+
private readonly rowProcessor: GraphRowProcessor | undefined,
|
|
2086
|
+
private readonly getWalkShape: () => {
|
|
2087
|
+
ordering: 'date' | 'author-date' | 'topo';
|
|
2088
|
+
onlyFollowFirstParent: boolean;
|
|
2089
|
+
},
|
|
2090
|
+
) {}
|
|
2091
|
+
|
|
2092
|
+
get window(): readonly GitGraphRow[] {
|
|
2093
|
+
return this._window;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
get current(): GitGraph {
|
|
2097
|
+
return this._current;
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
/** First walk — no seed (nothing accumulated yet), equivalent to a plain `getGraph`. */
|
|
2101
|
+
async initialize(
|
|
2102
|
+
options?: { rev?: string; limit?: number; include?: { stats?: boolean } },
|
|
2103
|
+
cancellation?: AbortSignal,
|
|
2104
|
+
): Promise<void> {
|
|
2105
|
+
const shape = this.getWalkShape();
|
|
2106
|
+
const graph = await this.provider.getGraph(
|
|
2107
|
+
this.repoPath,
|
|
2108
|
+
options?.rev,
|
|
2109
|
+
{ include: options?.include, limit: options?.limit, rowProcessor: this.rowProcessor },
|
|
2110
|
+
cancellation,
|
|
2111
|
+
);
|
|
2112
|
+
this.applyRebuild(graph, shape);
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
/**
|
|
2116
|
+
* R7c restart persistence. Reconstruct the prior generation from a persisted snapshot as an R6 seed
|
|
2117
|
+
* WITHOUT any git (its window/tips/reachability/stats become this session's prior `current`/`window`/
|
|
2118
|
+
* `buildShape`), then IMMEDIATELY {@link refresh} to current truth — the enumeration + tip/FF/stash gates
|
|
2119
|
+
* reconcile a stale snapshot (fast when unchanged, a full walk on any structural change). The session
|
|
2120
|
+
* handed back is ALWAYS post-refresh; the raw snapshot is never surfaced. The caller has already validated
|
|
2121
|
+
* the snapshot structurally. Returns the refresh outcome so the caller can report the restore result.
|
|
2122
|
+
*/
|
|
2123
|
+
async restore(
|
|
2124
|
+
snapshot: GitGraphSessionSnapshot,
|
|
2125
|
+
options?: { rev?: string; limit?: number; include?: { stats?: boolean } },
|
|
2126
|
+
cancellation?: AbortSignal,
|
|
2127
|
+
): Promise<GitGraphSessionRefreshResult> {
|
|
2128
|
+
this._window = snapshot.rows;
|
|
2129
|
+
this._buildShape = snapshot.buildShape;
|
|
2130
|
+
this._current = buildRestoredGraph(snapshot);
|
|
2131
|
+
|
|
2132
|
+
// Anchor the re-walk on the window's BOTTOM commit so it spans the whole restored window (the host's
|
|
2133
|
+
// rebuild-anchor discipline), matching to at least the current limit so a since-grown repo still fills a
|
|
2134
|
+
// full page. Stash rows aren't real revs, so skip them when picking the anchor.
|
|
2135
|
+
let anchor: string | undefined;
|
|
2136
|
+
for (let i = snapshot.rows.length - 1; i >= 0; i--) {
|
|
2137
|
+
const type = snapshot.rows[i].type;
|
|
2138
|
+
if (type === 'commit-node' || type === 'merge-node') {
|
|
2139
|
+
anchor = snapshot.rows[i].sha;
|
|
2140
|
+
break;
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
const limit = Math.max(snapshot.rows.length, options?.limit ?? 0);
|
|
2144
|
+
|
|
2145
|
+
return this.refresh({ rev: anchor, limit: limit, include: options?.include }, cancellation);
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
async refresh(
|
|
2149
|
+
options?: GitGraphSessionRefreshOptions,
|
|
2150
|
+
cancellation?: AbortSignal,
|
|
2151
|
+
): Promise<GitGraphSessionRefreshResult> {
|
|
2152
|
+
const shape = this.getWalkShape();
|
|
2153
|
+
const buildShape = buildShapeKey(shape);
|
|
2154
|
+
const prior = this._current;
|
|
2155
|
+
|
|
2156
|
+
// Incremental head-walk seed: the FULL accumulated window + the prior walk's tips/reachability/stats,
|
|
2157
|
+
// gated on an unchanged walk shape (a first-parent/ordering change reshapes every row's parents/order,
|
|
2158
|
+
// so the cached rows can't be reused). Mirrors the host's former `incrementalSeed` construction and
|
|
2159
|
+
// `_graphBuildShape` gate — the session owns the shape, so it can't be handed a lying seed. The provider
|
|
2160
|
+
// still re-validates ordering/first-parent internally and falls back on any structural change.
|
|
2161
|
+
const incrementalSeed: GraphIncrementalSeed | undefined =
|
|
2162
|
+
options?.rebuild !== true && prior.refTips != null && this._buildShape === buildShape
|
|
2163
|
+
? {
|
|
2164
|
+
rows: this._window,
|
|
2165
|
+
tips: prior.refTips,
|
|
2166
|
+
ordering: shape.ordering,
|
|
2167
|
+
reachability: prior.reachability,
|
|
2168
|
+
rowsStats: prior.rowsStats,
|
|
2169
|
+
hasMore: prior.paging?.hasMore ?? false,
|
|
2170
|
+
onlyFollowFirstParent: shape.onlyFollowFirstParent,
|
|
2171
|
+
shallow: prior.shallow,
|
|
2172
|
+
decorationFingerprint: prior.decorationFingerprint,
|
|
2173
|
+
}
|
|
2174
|
+
: undefined;
|
|
2175
|
+
|
|
2176
|
+
let outcome: IncrementalGraphOutcome | undefined;
|
|
2177
|
+
let graph = await this.provider.getGraph(
|
|
2178
|
+
this.repoPath,
|
|
2179
|
+
options?.rev,
|
|
2180
|
+
{
|
|
2181
|
+
include: options?.include,
|
|
2182
|
+
limit: options?.limit,
|
|
2183
|
+
rowProcessor: this.rowProcessor,
|
|
2184
|
+
// Same-repo rebuild: continue the prior reachability generation (stable indices for retained
|
|
2185
|
+
// rows) and reuse immutable per-sha stats — exactly the host's former same-repo seeds.
|
|
2186
|
+
reachabilitySeed: prior.reachability,
|
|
2187
|
+
rowsStatsSeed: prior.rowsStats,
|
|
2188
|
+
incrementalSeed: incrementalSeed,
|
|
2189
|
+
onIncrementalResult: o => {
|
|
2190
|
+
outcome = o;
|
|
2191
|
+
},
|
|
2192
|
+
},
|
|
2193
|
+
cancellation,
|
|
2194
|
+
);
|
|
2195
|
+
|
|
2196
|
+
// Host-serialization backstop: the host serializes refresh against more() per repo. Should a more() still
|
|
2197
|
+
// land mid-refresh (`_current` swapped out from under this await), the rebuild predates that appended page
|
|
2198
|
+
// — refresh carries newer repo truth so we still apply it, but when the accumulated window outran the
|
|
2199
|
+
// rebuild the dropped page must re-page, not vanish. `paging.hasMore` is readonly, so re-wrap it truthful.
|
|
2200
|
+
if (this._current !== prior && graph.paging != null && this._window.length > graph.rows.length) {
|
|
2201
|
+
graph = { ...graph, paging: { ...graph.paging, hasMore: true } };
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
// Write-once cross-generation avatar merge (formerly in host `setGraph`): carry prior URLs forward
|
|
2205
|
+
// into the fresh graph's map without overwriting its own entries.
|
|
2206
|
+
mergeAvatarsForward(prior.avatars, graph.avatars);
|
|
2207
|
+
this.applyRebuild(graph, shape);
|
|
2208
|
+
|
|
2209
|
+
// The full path (seeded fallback or unseeded full walk) re-derives everything → every channel changed.
|
|
2210
|
+
// The fast path derives each channel honestly from what it actually touched — a false negative is data
|
|
2211
|
+
// loss, so a channel is `false` only when it PROVABLY didn't change (never merely when uncertain).
|
|
2212
|
+
if (outcome?.path === 'fast') {
|
|
2213
|
+
const changed: GitGraphSessionChangedChannels = {
|
|
2214
|
+
// A head-walk always reshapes the window; the publisher's ledger diff derives the precise splice
|
|
2215
|
+
// (including reused-row flag / reachability-index changes the re-derivation makes in place).
|
|
2216
|
+
rows: true,
|
|
2217
|
+
// The builder continues the prior generation (same id); a grown table means new dict/set entries
|
|
2218
|
+
// to append. A per-row index that re-points to an EXISTING set rides the rows channel, not this.
|
|
2219
|
+
reachability: reachabilityTableChanged(prior.reachability, graph.reachability),
|
|
2220
|
+
// Only NEW commit shas need stats (reused rows carry seeded, already-shipped stats), and only when
|
|
2221
|
+
// stats were requested at all. The host's deferred-completion hook re-marks this channel when the
|
|
2222
|
+
// background query lands, so this is just the synchronous signal.
|
|
2223
|
+
rowsStats: graph.includes?.stats === true && (outcome.added ?? 0) > 0,
|
|
2224
|
+
// Avatars are write-once merged across generations, so the map only grows — a larger size means
|
|
2225
|
+
// new emails. Value replacements (avatar proxy) ride the host's dedicated avatar path, not this.
|
|
2226
|
+
avatars: graph.avatars.size !== prior.avatars.size,
|
|
2227
|
+
// The fast path rebuilds the downstreams map from all rows; compare it against the prior.
|
|
2228
|
+
downstreams: downstreamsChanged(prior.downstreams, graph.downstreams),
|
|
2229
|
+
};
|
|
2230
|
+
return { path: 'fast', added: outcome.added, changed: changed };
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
const changed: GitGraphSessionChangedChannels = {
|
|
2234
|
+
rows: true,
|
|
2235
|
+
reachability: true,
|
|
2236
|
+
rowsStats: true,
|
|
2237
|
+
// Ties to the rowsStatsSeed drop above: these fallbacks recompute stats for shas already shipped
|
|
2238
|
+
// (`error` included — it drops the seed too, so its recompute must be re-shipped, not dedup-skipped).
|
|
2239
|
+
rowsStatsRecomputed:
|
|
2240
|
+
outcome?.path === 'fallback' &&
|
|
2241
|
+
(outcome.reason === 'shallow-changed' ||
|
|
2242
|
+
outcome.reason === 'replace-refs-changed' ||
|
|
2243
|
+
outcome.reason === 'error'),
|
|
2244
|
+
avatars: true,
|
|
2245
|
+
downstreams: true,
|
|
2246
|
+
};
|
|
2247
|
+
// A seeded fallback carries its reason; an unseeded full walk (no `onIncrementalResult` fired) carries none.
|
|
2248
|
+
if (outcome?.path === 'fallback') return { path: 'full', reason: outcome.reason, changed: changed };
|
|
2249
|
+
return { path: 'full', changed: changed };
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
async more(limit?: number, targetId?: string, cancellation?: AbortSignal): Promise<boolean> {
|
|
2253
|
+
const prior = this._current;
|
|
2254
|
+
const updated = await prior.more?.(limit ?? 0, targetId, cancellation);
|
|
2255
|
+
// A refresh swapped `current` out from under the page walk (stale generation) — benign; drop it and
|
|
2256
|
+
// the host re-requests on the next scroll.
|
|
2257
|
+
if (this._current !== prior) return false;
|
|
2258
|
+
// A live page walk yielding nothing is unexpected (hasMore said otherwise).
|
|
2259
|
+
if (updated == null) {
|
|
2260
|
+
debugger;
|
|
2261
|
+
return false;
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
mergeAvatarsForward(prior.avatars, updated.avatars);
|
|
2265
|
+
this.applyPage(updated);
|
|
2266
|
+
return true;
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
serialize(): GitGraphSessionSnapshot | undefined {
|
|
2270
|
+
const current = this._current;
|
|
2271
|
+
// Nothing worth persisting: no window yet, no build shape recorded, or no ref tips (the restore's
|
|
2272
|
+
// tip-diff gate has nothing to diff — never true for the CLI provider, but guards a defensive future).
|
|
2273
|
+
if (this._window.length === 0 || this._buildShape == null || current?.refTips == null) return undefined;
|
|
2274
|
+
|
|
2275
|
+
const [ordering, onlyFollowFirstParent] = this._buildShape.split('|');
|
|
2276
|
+
|
|
2277
|
+
// Cap the persisted window to a bounded top slice; a longer window persists its top with `hasMore`
|
|
2278
|
+
// forced true (restore behaves as a shorter loaded window — the bottom re-pages on demand). Slicing
|
|
2279
|
+
// makes a new array of the SAME row objects — no mutation of the live window.
|
|
2280
|
+
const capped = this._window.length > maxPersistedGraphRows;
|
|
2281
|
+
const rows = capped ? this._window.slice(0, maxPersistedGraphRows) : (this._window as GitGraphRow[]);
|
|
2282
|
+
const hasMore = capped || (current.paging?.hasMore ?? false);
|
|
2283
|
+
|
|
2284
|
+
// Stats are immutable per sha; when capped, trim to the persisted shas (entries for dropped rows are
|
|
2285
|
+
// dead weight). The reachability table is kept whole even when capped — it's proportional to distinct
|
|
2286
|
+
// ref-sets (small), the persisted rows' indices stay valid, and extra sets are harmless on decode.
|
|
2287
|
+
let rowsStats: [string, GitGraphRowStats][] | undefined;
|
|
2288
|
+
if (current.includes?.stats === true && current.rowsStats != null && current.rowsStats.size > 0) {
|
|
2289
|
+
const shas = capped ? new Set(rows.map(r => r.sha)) : undefined;
|
|
2290
|
+
rowsStats = [];
|
|
2291
|
+
for (const [sha, stats] of current.rowsStats) {
|
|
2292
|
+
if (shas != null && !shas.has(sha)) continue;
|
|
2293
|
+
|
|
2294
|
+
rowsStats.push([sha, stats]);
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
return {
|
|
2299
|
+
v: graphSessionSnapshotVersion,
|
|
2300
|
+
repoPath: this.repoPath,
|
|
2301
|
+
buildShape: this._buildShape,
|
|
2302
|
+
ordering: ordering as 'date' | 'author-date' | 'topo',
|
|
2303
|
+
onlyFollowFirstParent: onlyFollowFirstParent === 'true',
|
|
2304
|
+
rows: rows,
|
|
2305
|
+
refTips: [...current.refTips],
|
|
2306
|
+
decorationFingerprint: current.decorationFingerprint,
|
|
2307
|
+
reachability: current.reachability,
|
|
2308
|
+
rowsStats: rowsStats,
|
|
2309
|
+
downstreams: Array.from(current.downstreams, ([k, v]): [string, string[]] => [k, [...v]]),
|
|
2310
|
+
hasMore: hasMore,
|
|
2311
|
+
includesStats: current.includes?.stats === true,
|
|
2312
|
+
shallow: current.shallow ?? false,
|
|
2313
|
+
};
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
dispose(): void {
|
|
2317
|
+
// No-op — the window lives entirely in memory. R7c restart persistence is host-driven: the host
|
|
2318
|
+
// serializes this session (debounced + on its own dispose) and owns the storage IO.
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
/** A cursor-less rebuild (full walk / fast path) IS the full window. */
|
|
2322
|
+
private applyRebuild(graph: GitGraph, shape: { ordering: string; onlyFollowFirstParent: boolean }): void {
|
|
2323
|
+
this._current = graph;
|
|
2324
|
+
this._window = graph.rows;
|
|
2325
|
+
this._buildShape = buildShapeKey(shape);
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
/** A page-append: keep the window up to the cursor and append the page (the reducer's cursor-anchored
|
|
2329
|
+
* concatenation); the walk shape is unchanged (same generation). */
|
|
2330
|
+
private applyPage(page: GitGraph): void {
|
|
2331
|
+
this._current = page;
|
|
2332
|
+
const startingCursor = page.paging?.startingCursor;
|
|
2333
|
+
// A page always carries a cursor; a cursor-less page (shouldn't happen) is treated as a full window,
|
|
2334
|
+
// matching the host mirror's former fallback.
|
|
2335
|
+
this._window = startingCursor == null ? page.rows : appendRowsAtCursor(this._window, startingCursor, page.rows);
|
|
2336
|
+
}
|
|
2337
|
+
}
|