/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { type ChangeRebaser, type GraphCommit } from "../core/index.js";
import type { ChangeEnricherReadonlyCheckout } from "./changeEnricher.js";
/**
 * Utility for enriching commits from a {@link Branch} before these commits are applied and submitted.
 */
export declare class BranchCommitEnricher<TChange> {
    private readonly transactionEnricher;
    private readonly enricher;
    /**
     * Maps each local commit to the corresponding enriched commit.
     * Entries are added when the commits are prepared (before being applied and submitted).
     * Entries are removed when the commits are retrieved for submission (after being applied).
     * It's possible an entry will linger in the map indefinitely if it is never retrieved for submission.
     * This would happen if applying a commit were to fail and the commit were not retrieved/purged after the failure.
     */
    private readonly preparedCommits;
    constructor(rebaser: ChangeRebaser<TChange>, enricher: ChangeEnricherReadonlyCheckout<TChange>);
    /**
     * @returns The number of commits that have been prepared but not yet retrieved.
     */
    get preparedCommitsCount(): number;
    startNewTransaction(): void;
    commitCurrentTransaction(): void;
    abortCurrentTransaction(): void;
    /**
     * Adds a commit to the enricher.
     * @param commit - A commit that is part of a transaction.
     */
    ingestTransactionCommit(commit: GraphCommit<TChange>): void;
    /**
     * Prepares an enriched commit for later submission (see {@link BranchCommitEnricher.getPreparedCommit}).
     * @param commit - The commit to prepare an enriched version of.
     * @param concludesOuterTransaction - Whether the commit concludes an outer transaction.
     *
     * Each call to this method must be followed by a call to {@link BranchCommitEnricher.getPreparedCommit} or
     * {@link BranchCommitEnricher.purgePreparedCommits}. Failing to do so will result in a memory leak.
     */
    prepareCommit(commit: GraphCommit<TChange>, concludesOuterTransaction: boolean): void;
    /**
     * @param commit - A commit previously passed to {@link BranchCommitEnricher.prepareCommit}.
     * @returns The enriched commit corresponds to the given commit.
     */
    getPreparedCommit(commit: GraphCommit<TChange>): GraphCommit<TChange>;
    /**
     * Purges all commits that have been prepared but not been retrieved.
     * This should be called to avoid memory leaks if the prepared commits are no longer needed.
     *
     * Does not affect ingested transaction commits.
     */
    purgePreparedCommits(): void;
}
//# sourceMappingURL=branchCommitEnricher.d.ts.map