@atomist/automation-client
Version:
Atomist API for software low-level client
93 lines • 2.84 kB
TypeScript
import { RemoteRepoRef } from "../../operations/common/RepoId";
import { LocalProject } from "../local/LocalProject";
import { Configurable } from "./Configurable";
import { GitStatus } from "./gitStatus";
/**
* Git push options. See git-push(1) for more information.
*/
export interface GitPushOptions {
follow_tags?: boolean;
force?: boolean;
force_with_lease?: boolean | string;
quiet?: boolean;
verbose?: boolean;
}
/**
* Local project using git. Provides the ability to perform git operations
* such as commit, and to set and push to a remote.
*/
export interface GitProject extends LocalProject, Configurable {
branch: string;
remote: string;
newRepo: boolean;
/**
* Init git for this project.
*/
init(): Promise<this>;
/**
* Get some status information
*/
gitStatus(): Promise<GitStatus>;
/**
* Remote is of form https://github.com/USERNAME/REPOSITORY.git
* @param remote
*/
setRemote(remote: string): Promise<this>;
/**
* Sets the given user and email as the running git commands
* @param {string} user
* @param {string} email
*/
setUserConfig(user: string, email: string): Promise<this>;
/**
* Sets the user config by using GitHub user information. Make sure to use a token that
* has user scope.
*/
configureFromRemote(): Promise<this>;
/**
* Does the project have uncommitted changes in Git? Success means it's clean
*/
isClean(): Promise<boolean>;
/**
* Create a remote repository and set this repository's remote to it.
* @param gid: RemoteRepoRef
* @param {string} description
* @param {"private" | "public"} visibility
*/
createAndSetRemote(gid: RemoteRepoRef, description: string, visibility: "private" | "public"): Promise<this>;
/**
* Raise a PR after a push to this branch
* @param title
* @param body
* @param targetBranch
*/
raisePullRequest(title: string, body: string, targetBranch?: string): Promise<this>;
/**
* Commit to local git
* @param {string} message
*/
commit(message: string): Promise<this>;
/**
* Check out a particular commit. We'll end in detached head state
* @param sha sha or branch identifier
*/
checkout(sha: string): Promise<this>;
/**
* Revert all changes since last commit
*/
revert(): Promise<this>;
/**
* Push to the remote.
*/
push(options?: GitPushOptions): Promise<this>;
/**
* Create a new branch and switch to it.
* @param {string} name Name of the new branch
*/
createBranch(name: string): Promise<this>;
/**
* Check for existence of a branch
*/
hasBranch(name: string): Promise<boolean>;
}
//# sourceMappingURL=GitProject.d.ts.map