Blame

Repository.blame(path, flags: BlameFlag = BlameFlag.NORMAL, min_match_characters=None, newest_commit=None, oldest_commit=None, min_line=None, max_line=None)

Return a Blame object for a single file.

Parameters:

path

Path to the file to blame.

flags

An enums.BlameFlag constant.

min_match_characters

The number of alphanum chars that must be detected as moving/copying within a file for it to associate those lines with the parent commit.

newest_commit

The id of the newest commit to consider.

oldest_commit

The id of the oldest commit to consider.

min_line

The first line in the file to blame.

max_line

The last line in the file to blame.

Examples:

repo.blame('foo.c', flags=enums.BlameFlag.IGNORE_WHITESPACE)

The Blame type

Blame.for_line(line_no)

Returns the <BlameHunk> object for a given line given its number in the current Blame.

Parameters:

line_no

Line number, starts at 1.

Blame.__iter__()
Blame.__len__()
Blame.__getitem__(n)

The BlameHunk type

Attributes:

BlameHunk.lines_in_hunk

Number of lines

BlameHunk.final_commit_id
BlameHunk.final_start_line_number

Final start line number

BlameHunk.orig_commit_id
BlameHunk.orig_path

Original path

BlameHunk.orig_start_line_number

Origin start line number

BlameHunk.boundary

Tracked to a boundary commit

Getters:

BlameHunk.final_committer

Final committer

BlameHunk.orig_committer

Original committer

Constants

enums.BlameFlag.NORMAL
enums.BlameFlag.TRACK_COPIES_SAME_FILE
enums.BlameFlag.TRACK_COPIES_SAME_COMMIT_MOVES
enums.BlameFlag.TRACK_COPIES_SAME_COMMIT_COPIES
enums.BlameFlag.TRACK_COPIES_ANY_COMMIT_COPIES
enums.BlameFlag.FIRST_PARENT
enums.BlameFlag.USE_MAILMAP
enums.BlameFlag.IGNORE_WHITESPACE