import { IDisposable } from 'monaco-editor'; import { CancellationToken } from '../../../util/vs/base/common/cancellation'; import { Event } from '../../../util/vs/base/common/event'; import { IObservable } from '../../../util/vs/base/common/observableInternal'; import { URI } from '../../../util/vs/base/common/uri'; import { Branch, Change, CommitOptions, CommitShortStat, DiffChange, Ref, RefQuery, Repository, RepositoryAccessDetails, RepositoryKind, Worktree } from '../vscode/git'; export interface RepoContext { readonly rootUri: URI; readonly kind: RepositoryKind; readonly isUsingVirtualFileSystem: boolean; readonly headIncomingChanges: number | undefined; readonly headOutgoingChanges: number | undefined; readonly headBranchName: string | undefined; readonly headCommitHash: string | undefined; readonly upstreamBranchName: string | undefined; readonly upstreamRemote: string | undefined; readonly isRebasing: boolean; readonly remoteFetchUrls?: Array; readonly remotes: string[]; readonly worktrees: Worktree[]; readonly changes: { mergeChanges: Change[]; indexChanges: Change[]; workingTree: Change[]; untrackedChanges: Change[]; } | undefined; readonly headBranchNameObs: IObservable; readonly headCommitHashObs: IObservable; readonly upstreamBranchNameObs: IObservable; readonly upstreamRemoteObs: IObservable; readonly isRebasingObs: IObservable; isIgnored(uri: URI): Promise; } export declare const IGitService: import("../../../util/common/services").ServiceIdentifier; export interface IGitService extends IDisposable { readonly _serviceBrand: undefined; readonly onDidOpenRepository: Event; readonly onDidCloseRepository: Event; readonly onDidFinishInitialization: Event; readonly activeRepository: IObservable; readonly repositories: Array; readonly isInitialized: boolean; initRepository(uri: URI): Promise; getRecentRepositories(): Iterable; getRepository(uri: URI, forceOpen?: boolean): Promise; getRepository2(uri: URI): Promise; openRepository(uri: URI): Promise; getRepositoryFetchUrls(uri: URI): Promise | undefined>; initialize(): Promise; add(uri: URI, paths: string[]): Promise; diffBetweenPatch(uri: URI, ref1: string, ref2: string, path?: string): Promise; diffBetweenWithStats(uri: URI, ref1: string, ref2: string, path?: string): Promise; diffWith(uri: URI, ref: string): Promise; diffIndexWithHEADShortStats(uri: URI): Promise; getMergeBase(uri: URI, ref1: string, ref2: string): Promise; restore(uri: URI, paths: string[], options?: { staged?: boolean; ref?: string; }): Promise; createWorktree(uri: URI, options?: { path?: string; commitish?: string; branch?: string; noTrack?: boolean; }): Promise; deleteWorktree(uri: URI, path: string, options?: { force?: boolean; label?: string; }): Promise; migrateChanges(uri: URI, sourceRepositoryUri: URI, options?: { confirmation?: boolean; deleteFromSource?: boolean; untracked?: boolean; }): Promise; applyPatch(uri: URI, patch: string): Promise; commit(uri: URI, message: string | undefined, opts?: CommitOptions): Promise; getBranch(uri: URI, name: string): Promise; getBranchBase(uri: URI, name: string): Promise; getRefs(uri: URI, query: RefQuery, cancellationToken?: CancellationToken): Promise; isBranchProtected(uri: URI, branch?: string | Branch): Promise; generateRandomBranchName(uri: URI): Promise; exec(uri: URI, args: string[], env?: Record): Promise; } /** * Gets the best repo github repo id from the repo context. */ export declare function getGitHubRepoInfoFromContext(repoContext: RepoContext): { id: GithubRepoId; remoteUrl: string; } | undefined; export interface ResolvedRepoRemoteInfo { readonly fetchUrl: string | undefined; readonly repoId: ResolvedRepoId; } export type ResolvedRepoId = GithubRepoId | AdoRepoId; /** * Gets the repo info for any type of repo from the repo context. */ export declare function getOrderedRepoInfosFromContext(repoContext: RepoContext): Iterable; /** * Returns the remote URLs from repo context, starting with the best first. */ export declare function getOrderedRemoteUrlsFromContext(repoContext: RepoContext): Iterable; export declare function parseRemoteUrl(fetchUrl: string): { host: string; rawHost: string; path: string; } | undefined; export declare class GithubRepoId { readonly org: string; readonly repo: string; readonly host: string; readonly type = "github"; static parse(nwo: string): GithubRepoId | undefined; constructor(org: string, repo: string, host?: string); toString(): string; } export declare function toGithubNwo(id: GithubRepoId): string; export declare function toGithubWebUrl(id: GithubRepoId): string; /** * Extracts the GitHub repository name from a git fetch URL. * @param fetchUrl The git fetch URL to extract the repository name from. * @returns The repository name if the fetch URL is a valid GitHub URL, otherwise undefined. */ export declare function getGithubRepoIdFromFetchUrl(fetchUrl: string): GithubRepoId | undefined; export declare class AdoRepoId { readonly org: string; readonly project: string; readonly repo: string; readonly type = "ado"; constructor(org: string, project: string, repo: string); toString(): string; } /** * Extracts the ADO repository name from a git fetch URL. * @param fetchUrl The Git fetch URL to extract the repository name from. * @returns The repository name if the fetch URL is a valid ADO URL, otherwise undefined. */ export declare function getAdoRepoIdFromFetchUrl(fetchUrl: string): AdoRepoId | undefined; /** * Normalizes a remote repo fetch url into a standardized format * @param fetchUrl A remote repo fetch url in the form of http, https, or ssh. * @returns The normalized fetch url. Sanitized of any credentials, stripped of query params, and using https */ export declare function normalizeFetchUrl(fetchUrl: string): string; //# sourceMappingURL=gitService.d.ts.map