0

Dear community members,

I'm working on a code analysis system and would like to replace calls to CLI Git application with Dulwich module. As a second step I need to replace "git log" command with Dulwich equivalent.

Specifically, I'm trying to reproduce the following command:

git log --format=%H -- <path_to_a_file>

which must be similar to:

git rev-list HEAD -- <path_to_a_file>

My ultimate goal is to get a list of blobs (e.g. represented with SHAs) related to a given file.

What would be the best way to achieve it?

Wladd
  • 21
  • 4

1 Answers1

1

The function dulwich.porcelain.log provides an implementation roughly equivalent to the ''git log'' command.

See https://www.dulwich.io/code/dulwich/blob/master/dulwich/porcelain.py#L-570

jelmer
  • 2,405
  • 14
  • 27