import { IEvent } from "oni-types" import { BranchSummary, FetchResult } from "simple-git/promise" export enum Statuses { staged, committed, modified, } export type FileStatusChangedEvent = Array<{ path: string status: Statuses }> export type BranchChangedEvent = string export type StagedFilesChangedEvent = string export interface StatusResult { ahead: number behind: number currentBranch: string modified: string[] staged: string[] conflicted: string[] created: string[] deleted: string[] untracked: string[] remoteTrackingBranch: string } export interface BlameArgs { lineOne: number lineTwo: number file: string } export interface Blame { author: string author_mail: string author_time: string author_tz: string committer: string committer_mail: string committer_time: string committer_tz: string filename: string hash: string line: { originalLine: string; finalLine: string; numberOfLines: string } summary: string } export interface VersionControlProvider { // Events onFileStatusChanged: IEvent onStagedFilesChanged: IEvent onBranchChanged: IEvent onPluginActivated: IEvent onPluginDeactivated: IEvent name: SupportedProviders isActivated: boolean deactivate(): void activate(): void canHandleWorkspace(dir?: string): Promise getStatus(): Promise getRoot(): Promise getBlame(args: BlameArgs): Promise getDiff(): Promise getBranch(): Promise getLogs(file?: string): Promise getLocalBranches(): Promise changeBranch(branch: string): Promise stageFile(file: string): Promise unstage(files: string[]): Promise uncommit(sha?: string): Promise commitFiles(message: string[], files?: string[]): Promise fetchBranchFromRemote(args: { branch: string origin?: string currentDir: string }): Promise } export interface DiffResultTextFile { file: string changes: number insertions: number deletions: number binary: boolean } export interface DiffResultBinaryFile { file: string before: number after: number binary: boolean } export interface Diff { files: Array insertions: number deletions: number } export interface Commits { author: null | { email: string name: string } branch: string commit: string summary: { changes: number insertions: number deletions: number } } export interface DefaultLogFields { hash: string date: string message: string author_name: string author_email: string } export interface ListLogSummary { all: ReadonlyArray total: number latest: T } export type Logs = ListLogSummary export type Summary = StatusResult export type SupportedProviders = "git" | "svn" export default VersionControlProvider