@jupyterlab/git
Version:
A JupyterLab extension for version control using git
952 lines (950 loc) • 37.1 kB
TypeScript
import { IChangedArgs } from '@jupyterlab/coreutils';
import { IDocumentManager } from '@jupyterlab/docmanager';
import { DocumentRegistry } from '@jupyterlab/docregistry';
import { ServerConnection } from '@jupyterlab/services';
import { ISettingRegistry } from '@jupyterlab/settingregistry';
import { JSONObject, ReadonlyJSONObject } from '@lumino/coreutils';
import { ISignal } from '@lumino/signaling';
import { Git, IGitExtension } from './tokens';
/**
* Get the diff provider for a filename
*
* The lookup first tries to find a provider registered for the filename's
* extension. If none is registered and `isText` is true, the fallback diff
* provider is returned (if one has been registered).
*
* @param filename Filename to look for
* @param isText Whether the file is a text file. When true and no
* extension-specific provider matches, the fallback provider (if any)
* is returned.
* @returns The diff provider callback or undefined
*/
export declare function getDiffProvider(filename: string, isText?: boolean): Git.Diff.Factory | undefined;
/**
* Class for creating a model for retrieving info from, and interacting with, a remote Git repository.
*/
export declare class GitExtension implements IGitExtension {
/**
* Returns an extension model.
*
* @param docmanager - document manager
* @param docRegistry - document registry
* @param settings - plugin settings
* @param serverSettings - optional server connection settings for API requests
* @returns extension model
*/
constructor(docmanager?: IDocumentManager | null, docRegistry?: DocumentRegistry | null, settings?: ISettingRegistry.ISettings, serverSettings?: ServerConnection.ISettings);
/**
* Branch list for the current repository.
*/
get branches(): Git.IBranch[];
/**
* Remote list for the current repository.
*/
get remotes(): Git.IGitRemote[];
/**
* Submodule list for the current repository.
*/
get submodules(): Git.ISubmodule[];
/**
* Tags list for the current repository.
*/
get tagsList(): Git.ITag[];
/**
* The current repository branch.
*/
get currentBranch(): Git.IBranch | null;
/**
* Boolean indicating whether the model has been disposed.
*/
get isDisposed(): boolean;
/**
* Boolean indicating whether the model is ready.
*/
get isReady(): boolean;
/**
* Promise which fulfills when the model is ready.
*/
get ready(): Promise<void>;
/**
* Git repository path.
*
* ## Notes
*
* - This is the full path of the top-level folder.
* - The return value is `null` if a repository path is not defined.
*/
get pathRepository(): string | null;
set pathRepository(v: string | null);
/**
* Custom model refresh standby condition
*/
get refreshStandbyCondition(): () => boolean;
set refreshStandbyCondition(v: () => boolean);
/**
* Selected file for single file history
*/
get selectedHistoryFile(): Git.IStatusFile | null;
set selectedHistoryFile(file: Git.IStatusFile | null);
/**
* Last author
*
*/
get lastAuthor(): Git.IIdentity | null;
set lastAuthor(lastAuthor: Git.IIdentity | null);
/**
* Git repository status
*/
get status(): Git.IStatus;
/**
* A signal emitted when the branches of the Git repository changes.
*/
get branchesChanged(): ISignal<IGitExtension, void>;
/**
* A signal emitted when the `HEAD` of the Git repository changes.
*/
get headChanged(): ISignal<IGitExtension, void>;
/**
* A signal emitted when the list of the Git repository changes.
*/
get tagsChanged(): ISignal<IGitExtension, void>;
/**
* A signal emitted when the submodules of the Git repository change.
*/
get submodulesChanged(): ISignal<IGitExtension, void>;
/**
* A signal emitted when the current marking of the Git repository changes.
*/
get markChanged(): ISignal<IGitExtension, void>;
/**
* A signal emitted when the current file selected for history of the Git repository changes.
*/
get selectedHistoryFileChanged(): ISignal<IGitExtension, Git.IStatusFile | null>;
/**
* A signal emitted when the Git stash changes.
*
*/
get stashChanged(): ISignal<IGitExtension, IChangedArgs<Git.IStash[]>>;
/**
* The repository stash
*/
get stash(): Git.IStash[];
/**
* A signal emitted when the current Git repository changes.
*/
get repositoryChanged(): ISignal<IGitExtension, IChangedArgs<string | null>>;
/**
* A signal emitted when the current status of the Git repository changes.
*/
get statusChanged(): ISignal<IGitExtension, Git.IStatus>;
/**
* A signal emitted whenever a model event occurs.
*/
get taskChanged(): ISignal<IGitExtension, string>;
/**
* A signal emitted when the Git repository remote changes.
*/
get remoteChanged(): ISignal<IGitExtension, Git.IRemoteChangedNotification | null>;
/**
* A signal emitted when the list of remotes of the Git repository changes.
*/
get remotesChanged(): ISignal<IGitExtension, void>;
/**
* Boolean indicating whether there are dirty files
* A dirty file is a file with unsaved changes that is staged in classical mode
* or modified in simple mode.
*/
get hasDirtyFiles(): boolean;
set hasDirtyFiles(value: boolean);
/**
* A signal emitted indicating whether there are dirty (e.g., unsaved) staged files.
* This signal is emitted when there is a dirty staged file but none previously,
* and vice versa, when there are no dirty staged files but there were some previously.
*/
get dirtyFilesStatusChanged(): ISignal<IGitExtension, boolean>;
/**
* Boolean indicating whether credentials are required from the user.
*/
get credentialsRequired(): boolean;
set credentialsRequired(value: boolean);
/**
* A signal emitted whenever credentials are required, or are not required anymore.
*/
get credentialsRequiredChanged(): ISignal<IGitExtension, boolean>;
/**
* Get the current markers
*
* Note: This makes sure it always returns non null value
*/
protected get _currentMarker(): BranchMarker;
/**
* Add one or more files to the repository staging area.
*
* ## Notes
*
* - If no filename is provided, all files are added.
*
* @param filename - files to add
* @returns promise which resolves upon adding files to the repository staging area
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
add(...filename: string[]): Promise<void>;
/**
* Match files status information based on a provided file path.
*
* If the file is tracked and has no changes, a StatusFile of unmodified will be returned.
*
* @param path the file path relative to the server root
* @returns The file status or null if path repository is null or path not in repository
*/
getFile(path: string): Git.IStatusFile | null;
/**
* Add all "unstaged" files to the repository staging area.
*
* @returns promise which resolves upon adding files to the repository staging area
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
addAllUnstaged(): Promise<void>;
/**
* Add all untracked files to the repository staging area.
*
* @returns promise which resolves upon adding files to the repository staging area
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
addAllUntracked(): Promise<void>;
/**
* Add a remote Git repository to the current repository.
*
* @param url - remote repository URL
* @param name - remote name
* @returns promise which resolves upon adding a remote
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
addRemote(url: string, name?: string): Promise<void>;
/**
* Show remote repository for the current repository
* @returns promise which resolves to a list of remote repositories
*/
getRemotes(): Promise<Git.IGitRemote[]>;
/**
* Remove a remote repository by name
*
* @param name - name of the remote to remove
* @returns promise which resolves upon removing the remote
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
removeRemote(name: string): Promise<void>;
/**
* Refresh the list of remotes of the current repository.
*
* Emit remotesChanged if the list of remotes changes.
*
* ## Notes
*
* - The cached list of remotes is kept on failure, unless the current
* path is not a Git repository anymore.
*
* @returns promise which resolves upon refreshing the remotes
*
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
refreshRemotes(): Promise<void>;
/**
* Checkout a branch.
*
* ## Notes
*
* - If a branch name is provided, checkout the provided branch (with or without creating it)
* - If a filename is provided, checkout the file, discarding all changes.
* - If nothing is provided, checkout all files, discarding all changes.
*
* TODO: Refactor into separate endpoints for each kind of checkout request
*
* @param options - checkout options
* @returns promise which resolves upon performing a checkout
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
checkout(options?: Git.ICheckoutOptions): Promise<Git.ICheckoutResult>;
/**
* Merge a branch into the current branch
*
* @param branch The branch to merge into the current branch
*/
merge(branch: string): Promise<Git.IResultWithMessage>;
/**
* Clone a repository.
*
* @param path - local path into which the repository will be cloned
* @param url - Git repository URL
* @param auth - remote repository authentication information
* @param versioning - boolean flag of Git metadata (default true)
* @param submodules - boolean flag of Git submodules (default false)
* @returns promise which resolves upon cloning a repository
*
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
clone(path: string, url: string, auth?: Git.IAuth, versioning?: boolean, submodules?: boolean): Promise<Git.IResultWithMessage>;
/**
* Commit all staged file changes. If message is None, then the commit is amended
*
* @param message - commit message
* @param amend - whether this is an amend commit
* @param author - override the commit author specified in config
* @returns promise which resolves upon committing file changes
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
commit(message?: string | null, amend?: boolean, author?: string | null): Promise<void>;
/**
* Check staged notebooks for outputs.
*
* @returns A promise resolving to an array of notebook paths that have outputs
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
checkNotebooksForOutputs(): Promise<string[]>;
/**
* Strip outputs from the given staged notebooks.
*
* @param notebooks - Array of notebook paths to clean
*
* @returns A promise resolving when the operation completes
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
stripNotebooksOutputs(notebooks: string[]): Promise<void>;
/**
* Get (or set) Git configuration options.
*
* @param options - configuration options to set
* @returns promise which resolves upon either getting or setting configuration options
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
config(options?: JSONObject): Promise<JSONObject | void>;
/**
* Delete a branch
*
* @param branchName Branch name
* @returns promise which resolves when the branch has been deleted.
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
deleteBranch(branchName: string): Promise<void>;
/**
* Fetch commit information.
*
* @param hash - commit hash
* @returns promise which resolves upon retrieving commit information
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
detailedLog(hash: string): Promise<Git.ISingleCommitFilePathInfo>;
/**
* Get the diff of two commits.
* If no commit is provided, the diff of HEAD and INDEX is returned.
* If the current commit (the commit to compare) is not provided,
* the diff of the previous commit and INDEX is returned.
*
* @param previous - the commit to compare against
* @param current - the commit to compare
* @returns promise which resolves upon retrieving the diff
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
diff(previous?: string, current?: string): Promise<Git.IDiffResult>;
/**
* Dispose of model resources.
*/
dispose(): void;
/**
* Ensure a .gitignore file exists
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
* @throws {Git.HiddenFile} If the file is hidden
*/
ensureGitignore(): Promise<void>;
/**
* Reads content of .gitignore file
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
readGitIgnore(): Promise<string>;
/**
* Overwrites content onto .gitignore file
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
writeGitIgnore(content: string): Promise<void>;
/**
* Fetch to get ahead/behind status
*
* @param auth - remote authentication information
* @returns promise which resolves upon fetching
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
fetch(auth?: Git.IAuth): Promise<Git.IResultWithMessage>;
/**
* Return the path of a file relative to the Jupyter server root.
*
* ## Notes
*
* - If no path is provided, returns the Git repository top folder relative path.
* - If no Git repository selected, returns `null`
*
* @param path - file path relative to the top folder of the Git repository
* @returns relative path
*/
getRelativeFilePath(path?: string): string | null;
/**
* Add an entry in .gitignore file
*
* @param filePath File to ignore
* @param useExtension Whether to ignore the file or its extension
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
* @throws {Git.HiddenFile} If hidden files are not enabled
*/
ignore(filePath: string, useExtension: boolean): Promise<void>;
/**
* Initialize a new Git repository at a specified path.
*
* @param path - path at which initialize a Git repository
* @returns promise which resolves upon initializing a Git repository
*
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
init(path: string): Promise<void>;
/**
* Retrieve commit logs.
*
* @param count - number of commits
* @returns promise which resolves upon retrieving commit logs
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
log(count?: number): Promise<Git.ILogResult>;
/**
* Fetch changes from a remote repository.
*
* @param auth - remote authentication information
* @returns promise which resolves upon fetching changes
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
pull(auth?: Git.IAuth): Promise<Git.IResultWithMessage>;
/**
* Push local changes to a remote repository.
*
* @param auth - remote authentication information
* @param force - whether or not to force the push
* @returns promise which resolves upon pushing changes
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
push(auth?: Git.IAuth, force?: boolean, remote?: string): Promise<Git.IResultWithMessage>;
/**
* Rebase the current branch onto the provided one.
*
* @param branch to rebase onto
* @returns promise which resolves upon rebase action
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
rebase(branch: string): Promise<Git.IResultWithMessage>;
/**
* Resolve in progress rebase.
*
* @param action to perform
* @returns promise which resolves upon rebase action
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
resolveRebase(action: 'continue' | 'skip' | 'abort'): Promise<Git.IResultWithMessage>;
/**
* Refresh the repository.
*
* @returns promise which resolves upon refreshing the repository
*/
refresh(): Promise<void>;
/**
* Refresh the list of repository branches.
*
* Emit headChanged if the branch or its top commit changes
*
* @returns promise which resolves upon refreshing repository branches
*/
refreshBranch(): Promise<void>;
/**
* Refresh the list of repository tags.
*
* @returns promise which resolves upon refreshing repository tags
*/
refreshTag(): Promise<void>;
/**
* Refresh the repository status.
*
* Emit statusChanged if required.
*
* @returns promise which resolves upon refreshing the repository status
*/
refreshStatus(): Promise<void>;
/**
* Collects files that have changed on the remote branch.
*
*/
remoteChangedFiles(): Promise<Git.IStatusFile[]>;
/**
* Determines if opened files are behind the remote and emits a signal if one
* or more are behind and the user hasn't been notified of them yet.
*
*/
checkRemoteChangeNotified(): Promise<void>;
/**
* Determines whether there are unsaved changes on files,
*
* @returns promise that resolves upon refreshing the dirty status of files
*/
refreshDirtyStatus(): Promise<void>;
/**
* Move files from the "staged" to the "unstaged" area.
*
* ## Notes
*
* - If no filename is provided, moves all files from the "staged" to the "unstaged" area.
*
* @param filename - file path to be reset
* @returns promise which resolves upon moving files
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
reset(filename?: string): Promise<void>;
/**
* Reset the repository to a specified commit.
*
* ## Notes
*
* - If a commit hash is not provided, resets the repository to `HEAD`.
*
* @param hash - commit identifier (hash)
* @returns promises which resolves upon resetting the repository
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
resetToCommit(hash?: string): Promise<void>;
/**
* Retrieve the prefix path of a directory `path` with respect to the root repository directory.
*
* @param path - directory path
* @returns promise which resolves upon retrieving the prefix path
*
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
showPrefix(path: string): Promise<string | null>;
/**
* Retrieve the top level repository path.
*
* @param path - current path
* @returns promise which resolves upon retrieving the top level repository path
*
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
showTopLevel(path: string): Promise<string | null>;
/**
* Apply a given stash
*
* @param index - Index of the stash to apply.
* @returns promise which resolves upon task completion
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
applyStash(index: number): Promise<void>;
/**
* Drop a stash entry, or clear the entire stash.
*
* @param index The index of the stash to be deleted. If no index is provided, the entire stash will be cleared.
*
* @returns promise which resolves when the task is done
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
dropStash(index?: number): Promise<void>;
/**
* Pop a stash
* @param index - Index of the stash to pop; pop the latest if not provided.
* @returns promise which resolves upon task completion
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*
*/
popStash(index?: number): Promise<void>;
/**
* Checks the stash list, and sets the stash property.
*
* @returns promise which resolves when the task is done.
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
refreshStash(): Promise<void>;
/**
* Stash the current changes in a dirty repository.
* @param stashMsg - Stash message
* @returns promise which resolves upon stashing changes
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
stashChanges(stashMsg?: string): Promise<void>;
/**
* Compares two arrays of stash entries for deep equality.
*
* @param a The first array of stash entries to be compared.
* @param b The second array of stash entries to be compared.
* @returns boolean value indicating if both arrays of stash entries are deeply equal.
*
* @returns promise which resolves to an array of stashes
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
protected isStashDeepEqual(a: Git.IStash[], b: Git.IStash[]): boolean;
/**
* Retrieve the list of tags in the repository, with the respective commits they point to.
*
* @returns promise which resolves upon retrieving the tag list
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
tags(): Promise<Git.ITagResult>;
/**
* Checkout the specified tag version
*
* @param tag - selected tag version
* @returns promise which resolves upon checking out the tag version of the repository
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
checkoutTag(tag: string): Promise<Git.ICheckoutResult>;
/**
* Set a tag pointing to a specific commit.
*
* @param tagName - name of new tag
* @param commitId - identifier of commit tag is pointing to
* @returns promise which resolves upon succesfully creating the new tag
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
setTag(tag: string, commitId: string): Promise<void>;
/**
* Add a file to the current marker object.
*
* @param fname - filename
* @param mark - mark to set
*/
addMark(fname: string, mark: boolean): void;
/**
* Set a file in the current marker object.
*
* @param fname - filename
* @param mark - mark to set
*/
setMark(fname: string, mark: boolean): void;
/**
* Return the current mark associated with a specified filename.
*
* @param fname - filename
* @returns mark
*/
getMark(fname: string): boolean;
/**
* Toggle the mark for a file in the current marker object
*
* @param fname - filename
*/
toggleMark(fname: string): void;
get markedFiles(): Git.IStatusFile[];
/**
* Register a new diff provider for specified file extensions
*
* @param fileExtensions File extension list
* @param factory Callback to use for the provided file extensions
*/
registerDiffProvider(name: string, fileExtensions: string[], factory: Git.Diff.Factory): void;
/**
* Register a fallback diff provider used for any text file that does not
* have an extension-specific provider registered.
*
* Only one fallback provider can be registered at a time; subsequent
* calls replace the previous fallback.
*
* @param factory Callback to use for text files without a specific provider
*/
registerFallbackDiffProvider(factory: Git.Diff.Factory): void;
/**
* Revert changes made after a specified commit.
*
* @param message - commit message
* @param hash - commit identifier (hash)
* @returns promise which resolves upon reverting changes
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
revertCommit(message: string, hash: string): Promise<void>;
/**
* Get the submodules in the current repository.
* @returns A promise that resolves upon getting submodule names
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
listSubmodules(): Promise<void>;
/**
* Checks if the hostname is a known host
*
* @param hostname - the host name to be checked
* @returns A boolean indicating that the host is a known one
*
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
checkKnownHost(hostname: string): Promise<boolean>;
/**
* Adds a hostname to the list of known host files
* @param hostname - the hostname to be added
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
addHostToKnownList(hostname: string): Promise<void>;
/**
* Make request for a list of all git branches in the repository
* Retrieve a list of repository branches.
*
* @returns promise which resolves upon fetching repository branches
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
protected _branch(): Promise<Git.IBranchResult>;
/**
* Get list of files changed between two commits or two branches.
*
* Notes:
* It assumes the Git path repository as already been checked.
*
* @param base id of base commit or base branch for comparison
* @param remote id of remote commit or remote branch for comparison
* @param singleCommit id of a single commit
*
* @returns the names of the changed files
*
* @throws {Git.GitResponseError} If the server response is not ok
* @throws {ServerConnection.NetworkError} If the request cannot be made
*/
protected _changedFiles(base?: string, remote?: string, singleCommit?: string): Promise<Git.IChangedFilesResult>;
/**
* Clear repository status
*/
protected _clearStatus(): void;
/**
* Make a request to the Git API, using the stored server settings if available.
*
* @param endPoint API REST end point for the extension
* @param method HTTP method
* @param body JSON object to be passed as body or null
* @param namespace API namespace
* @returns The response body interpreted as JSON
*/
protected _requestAPI<T>(endPoint?: string, method?: string, body?: Partial<ReadonlyJSONObject> | null, namespace?: string): Promise<T>;
/**
* Get the current Git repository path
*
* @throws {Git.NotInRepository} If the current path is not a Git repository
*/
protected _getPathRepository(): Promise<string>;
/**
* Resolve path to filetype
*/
protected _resolveFileType(path: string): DocumentRegistry.IFileType;
/**
* Set the repository status.
*
* @param v - repository status
*/
protected _setStatus(v: Git.IStatus): void;
/**
* Fetch poll action.
* This is blocked if Git credentials are required.
*/
private _fetchRemotes;
/**
* Callback invoked upon a change to plugin settings.
*
* @private
* @param settings - plugin settings
*/
private _onSettingsChange;
/**
* open new editor or show an existing editor of the
* .gitignore file. If the editor does not have unsaved changes
* then ensure the editor's content matches the file on disk
*/
private _openGitignore;
/**
* Refresh model status through a Poll
*/
private _refreshModel;
/**
* Standby test function for the refresh Poll
*
* Standby refresh if
* - webpage is hidden
* - not in a git repository
* - standby condition is true
*
* @returns The test function
*/
private _refreshStandby;
/**
* if file is open in JupyterLab find the widget and ensure the JupyterLab
* version matches the version on disk. Do nothing if the file has unsaved changes
*
* @param path path to the file to be reverted
*/
private _revertFile;
/**
* Set the marker object for a repository path and branch.
*/
private _setMarker;
private _status;
private _stash;
private _pathRepository;
private _branches;
private _remotes;
private _tagsList;
private _currentBranch;
private _docmanager;
private _docRegistry;
private _fetchPoll;
private _isDisposed;
private _markerCache;
private __currentMarker;
private _readyPromise;
private _pendingReadyPromise;
private _serverSettings;
private _settings;
private _standbyCondition;
private _statusPoll;
private _taskHandler;
private _remoteChangedFiles;
private _changeUpstreamNotified;
private _selectedHistoryFile;
private _hasDirtyFiles;
private _credentialsRequired;
private _lastAuthor;
private _submodules;
private _statusForDirtyState;
private _branchesChanged;
private _tagsChanged;
private _submodulesChanged;
private _headChanged;
private _markChanged;
private _selectedHistoryFileChanged;
private _repositoryChanged;
private _stashChanged;
private _statusChanged;
private _remoteChanged;
private _remotesChanged;
private _dirtyFilesStatusChanged;
private _credentialsRequiredChanged;
}
export declare class BranchMarker implements Git.IBranchMarker {
private _refresh;
constructor(_refresh: () => void);
add(fname: string, mark?: boolean): void;
get(fname: string): boolean;
set(fname: string, mark: boolean): void;
toggle(fname: string): void;
get markedFilePaths(): string[];
private _marks;
}
export declare class Markers {
private _refresh;
constructor(_refresh: () => void);
get(path: string, branch: string): BranchMarker;
static markerKey(path: string, branch: string): string;
private _branchMarkers;
}