INNER CODE UNIT · TypeScript

createJjVcsAdapter

modem-dev/hunk · packages/hunk-jj/src/index.ts:170

export function createJjVcsAdapter({ jjExecutable = "jj" }: Readonly<JjVcsAdapterOptions> = {}) {
  return {
    id: "jj",
    name: "Jujutsu",
    detect: detectJjRepo,
    // Above Git: a colocated jj repository carries a `.git` directory too, and
    // reviewing it as plain Git would show the wrong working copy.
    detectionPriority: HUNK_VCS_DETECTION_BASELINE_PRIORITY + 200,
    history: {
      open(input, { cwd }) {
        return openJjHistory(input, { cwd, jjExecutable });
      },
      // JJ's single-revision diff compares ordinary commits with their parent,
      // merges with their merged-parent tree, and first commits with the root.
      planReview(commit, _context?: unknown, options?: { parentRevisionId?: string }) {
        const parent = options?.parentRevisionId;
        if (parent && !commit.parentRevisionIds.includes(parent)) {
          throw new Error("The selected revision is not a parent of this Jujutsu commit.");

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…