import { GitServiceInterface, GitServicePullListener, GitServicePushListener, GitFileCommitDescriptor, GitAuthor, GitCommitLogEntry, Logger, GitFileStatus } from '@stackbit/types'; import { Worker } from '@stackbit/utils'; import { CommandRunner } from '@stackbit/types'; export declare class GitService implements GitServiceInterface { private repoUrl; private repoBranch; private repoPublishBranch; private readonly repoDir; private readonly worker; private readonly runCommand; private readonly logger; private readonly userLogger; private readonly skipPush?; private pullListeners; private pushListeners; private branchFetched; private shadowRepoDir; private pulledFilesFromFetchHead; constructor(options: { repoUrl: string; repoDir: string; repoBranch: string; repoPublishBranch: string; worker: Worker; runCommand: CommandRunner; skipPush?: boolean; logger: Logger; userLogger: Logger; }); getRepoUrl(): string; setRepoUrl(repoUrl: string): void; getRepoBranch(): string; setRepoBranch(repoBranch: string): void; getRepoPublishBranch(): string; setRepoPublishBranch(publishBranch: string): void; getRepoDir(): string; addPullListener(listener: GitServicePullListener): void; removePullListener(listener: GitServicePullListener): void; notifyPullListeners(options: { branch: string; updatedFiles: string[]; }): Promise; addPushListener(listener: GitServicePushListener): void; removePushListener(listener: GitServicePushListener): void; notifyPushListeners(): Promise; private commit; private push; commitAndPush(author: GitAuthor, files: GitFileCommitDescriptor[]): Promise; pull(branch?: string): Promise; private publishAll; private publishFiles; publish(author: GitAuthor, filePaths?: string[]): Promise; private parseGitCommitAuthor; private diffBranches; diff(): Promise; diffFilesWithFetchHead(): Promise; private rollbackFilesFromHead; pullFilesFromFetchHead(files: GitFileStatus[]): Promise; createShadowRepo(): Promise; /** * Parse commit log between two branches * command: git log --pretty=format:commit:%H%n%at%n%ae%x28%an%x29 --name-status master..preview * * Every commit entry has the following pattern * ``` * commit:{COMMIT_HASH} * {UNIX_TIMESTAMP} * {AUTHOR_EMAIL}({AUTHOR_NAME}) * {OPTIONAL_CHANGES} * {OPTIONAL_CHANGES} * ``` * * The OPTIONAL_CHANGES can be one of the two following formats: * ``` * CODE PATH * CODE ORIG_PATH -> PATH * ``` * * The CODE can be one of the following: * M - modified * T - file type changed (regular file, symbolic link or submodule) * A = added * D = deleted * R = renamed * C = copied (if config option status.renames is set to "copies") * U = updated but unmerged * * The ORIG_PATH is where the renamed/copied contents came from. * The ORIG_PATH is only shown when the entry is renamed or copied. * * @example * commit:eeb5da951efd67177450340ed1d9f097de1880d1 * 1725289941 * john@doe.com(John Doe) * R100 content/pages/bar.md content/pages/bar2.md * * commit:c8e3582f5f5da508d288a704274a79c3c5910c2e * 1725289821 * john@doe.com(John Doe) * commit:99ccff89435652b049ff257a97f24ef7e138ecd2 * 1725289805 * john@doe.com(John Doe) * A content/pages/bar.md * * commit:1db31aba03eac648c93b5f18d87d555bf77380be * 1725288846 * john@doe.com(John Doe) * R071 content/pages/foo.md content/pages/foo2.md * * commit:eb392a5d1eacff5620bed8e558733bd6f2c4fc51 * 1725288806 * john@doe.com(John Doe) * commit:9b5dad9e257a506ef3a1da7cbec0d50f0e2a47db * 1725288647 * john@doe.com(John Doe) * A content/pages/foo.md * D content/pages/hello11.md * * commit:0adb4e9b3de382f80720d5acc1027f7efb240f14 * 1725229056 * john@doe.com(John Doe) * commit:81189019c5f6de62525a755333434a40c4ab4d44 * 1725228656 * john@doe.com(John Doe) * R100 content/pages/hello10.md content/pages/hello11.md */ commitLog(): Promise; } //# sourceMappingURL=git.d.ts.map