@weshare/crd
Version:
48 lines (47 loc) • 1.57 kB
TypeScript
declare type Branch = {
remote: string;
merge: string;
remoteBranch?: string;
};
declare type CommandExec = {
stdout: string;
stderr: string;
};
export declare function createPromiseShell(command: string): Promise<CommandExec>;
/**
* 通过commitId获取到commitId所在的分支
* @param {string} commitId
*/
export declare function getBranchByCommit(commitId: string): Promise<RegExpMatchArray>;
/**
* 获取分支的对应表
*/
export declare const getBranchMap: () => Promise<{
[key: string]: Branch | undefined;
}>;
/**
* 根据本地分支获取远程分支
* @param {string} localBranch 本地分支
*/
export declare const getRemoteBranchByLocal: (localBranch: string) => Promise<Branch>;
/**
* 根据commitId获取远程分支
* @param {string} localBranch 本地分支
*/
export declare const getRemoteBranchByCommitId: (commitId: string) => Promise<Branch>;
/**
* 通过短的commitId的sha值获取完整的commitId
* @param {string} shortSha 短的commitId
*/
export declare const getLongShaByShort: (shortSha: string) => Promise<string>;
/**
* 获取当前分支
* @param {boolean} isShort 是否返回短分支(即不带有refs/heads的)
*/
export declare const getCurrentBranch: (isShort?: boolean) => Promise<string>;
/**
* 获取git的提交信息, 不传参数就是当前分支的第一条
* @param commitId git的提交id, 不传就是当前的第一条
*/
export declare const getCommitDetail: (commitId?: string | undefined) => Promise<any>;
export {};