UNPKG

1.31 kBTypeScriptView Raw
1import { BlameHunk } from "./blame-hunk";
2import { BlameOptions } from "./blame-options";
3import { Repository } from "./repository";
4
5export namespace Blame {
6 const enum FLAG {
7 NORMAL = 0,
8 TRACK_COPIES_SAME_FILE = 1,
9 TRACK_COPIES_SAME_COMMIT_MOVES = 2,
10 TRACK_COPIES_SAME_COMMIT_COPIES = 4,
11 TRACK_COPIES_ANY_COMMIT_COPIES = 8,
12 FIRST_PARENT = 16,
13 }
14}
15
16export class Blame {
17 /**
18 * Retrieve the blame of a file
19 *
20 * @param repo - Repository that contains the file
21 * @param path - to the file to get the blame of
22 * @param [options] - Options for the blame
23 */
24 static file(repo: Repository, path: string, options?: BlameOptions): Promise<Blame>;
25 /**
26 * @param opts - The git_blame_options struct to initialize
27 * @param version - Version of struct; pass GIT_BLAME_OPTIONS_VERSION
28 */
29 static initOptions(opts: BlameOptions, version: number): number;
30
31 buffer(buffer: string, bufferLen: number): Promise<Blame>;
32
33 /**
34 * @returns - the hunk at the given index, or NULL on error
35 */
36 getHunkByIndex(index: number): BlameHunk;
37 /**
38 * @returns - the hunk that contains the given line, or NULL on error
39 */
40 getHunkByLine(lineNo: number): BlameHunk;
41
42 getHunkCount(): number;
43}