Blame

Repository.blame()

blame(path, [flags, min_match_characters, newest_commit, oldest_commit, min_line, max_line]) -> blame

Get the blame for a single file.

Arguments:

path
A path to file to consider.
flags
A GIT_BLAME_* 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=GIT_BLAME_TRACK_COPIES_SAME_FILE)

The Blame type

Blame.for_line(line_no) → hunk

Returns the blame hunk data for the given “line_no” in blame.

Arguments:

line_no
Line number, countings starts with 1.
iter(Blame)
len(Blame)
Blame[n]

The BlameHunk type

Attributes:

BlameHunk.lines_in_hunk

Number of lines.

BlameHunk.final_commit_id

Last changed oid.

BlameHunk.final_start_line_number

final start line no.

BlameHunk.orig_commit_id

oid where hunk was found.

BlameHunk.orig_path

Origin path.

BlameHunk.orig_start_line_number

Origin start line no.

BlameHunk.boundary

Tracked to a boundary commit.

Getters:

BlameHunk.final_committer

Final committer.

BlameHunk.orig_committer

Origin committer.

Constants

GIT_BLAME_NORMAL
GIT_BLAME_TRACK_COPIES_SAME_FILE
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES
GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES

Table Of Contents

Previous topic

Remotes

This Page