| Server IP : 217.160.0.141 / Your IP : 216.73.217.7 Web Server : Apache System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux User : p8818224 ( 2623854) PHP Version : 8.2.35 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /kunden/usr/share/doc/python3-dulwich/examples/ |
Upload File : |
#!/usr/bin/python
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
# Example printing the last author of a specified file
import sys
import time
from dulwich.repo import Repo
if len(sys.argv) < 2:
print(f"usage: {sys.argv[0]} filename")
sys.exit(1)
r = Repo(".")
path = sys.argv[1].encode("utf-8")
w = r.get_walker(paths=[path], max_entries=1)
try:
c = next(iter(w)).commit
except StopIteration:
print(f"No file {sys.argv[1]} anywhere in history.")
else:
print(
f"{sys.argv[1]} was last changed by {c.author} at {time.ctime(c.author_time)} (commit {c.id})"
)