我正在尝试在我的脚本中使用 GitPython 模块……但我不能。这不是很记录:GitPython Blame
我想我还没有到目前为止,因为我想重现的通常 git blame 如下:git blame -L127,+1 ../../core/src/filepath.cpp -e
这是我的脚本:
from git import *
repo = Repo("C:\\Path\\to\\my\\repos\\")
assert not repo.bare
# log_line = open("lineDeb.txt")
# for line in log_line:
repo.git.blame(L='127,+1' '../../core/src/filepath.cpp', e=True)
注释的两行是为了最终目标是在我的“lineDeb.txt”文件中的每个数字行上 git blame。
我有以下输出:
...
git.exc.GitCommandError: 'git blame -L127,+1../../core/src/filepath.cpp -e' returned with exit code 129
stderr: 'usage: git blame [options] [rev-opts] [rev] [--] file
...
我知道我可以使用 os 模块来实现,但我想保留在 python 中。
如果这个模块或python的一些专家可以帮助我?
也许我没有正确使用 GitPython?
目标是获取线路提交者的电子邮件......
提前致谢。