dulwich.reflog module

Utilities for reading and generating reflogs.

class dulwich.reflog.Entry(old_sha, new_sha, committer, timestamp, timezone, message)

Bases: tuple

Create new instance of Entry(old_sha, new_sha, committer, timestamp, timezone, message)

committer

Alias for field number 2

message

Alias for field number 5

new_sha

Alias for field number 1

old_sha

Alias for field number 0

timestamp

Alias for field number 3

timezone

Alias for field number 4

dulwich.reflog.drop_reflog_entry(f, index, rewrite=False)

Drop the specified reflog entry.

Parameters
  • f – File-like object

  • index – Reflog entry index (in Git reflog reverse 0-indexed order)

  • rewrite – If a reflog entry’s predecessor is removed, set its old SHA to the new SHA of the entry that now precedes it

dulwich.reflog.format_reflog_line(old_sha, new_sha, committer, timestamp, timezone, message)

Generate a single reflog line.

Parameters
  • old_sha – Old Commit SHA

  • new_sha – New Commit SHA

  • committer – Committer name and e-mail

  • timestamp – Timestamp

  • timezone – Timezone

  • message – Message

dulwich.reflog.parse_reflog_line(line)

Parse a reflog line.

Parameters

line – Line to parse

Returns: Tuple of (old_sha, new_sha, committer, timestamp, timezone,

message)

dulwich.reflog.read_reflog(f)

Read reflog.

Parameters

f – File-like object

Returns: Iterator over Entry objects