use sha, use only one commit per sha
This commit is contained in:
parent
cc72221ee2
commit
6b0cd6a9a7
2 changed files with 14 additions and 2 deletions
|
@ -39,6 +39,7 @@ class Commit(NamedTuple):
|
||||||
dt: datetime
|
dt: datetime
|
||||||
message: str
|
message: str
|
||||||
repo: str
|
repo: str
|
||||||
|
sha: str
|
||||||
# TODO filter so they are authored by me
|
# TODO filter so they are authored by me
|
||||||
|
|
||||||
def iter_commits(repo: str):
|
def iter_commits(repo: str):
|
||||||
|
@ -51,6 +52,7 @@ def iter_commits(repo: str):
|
||||||
dt=c.committed_datetime, # TODO authored??
|
dt=c.committed_datetime, # TODO authored??
|
||||||
message=c.message.strip(),
|
message=c.message.strip(),
|
||||||
repo=rr,
|
repo=rr,
|
||||||
|
sha=c.hexsha,
|
||||||
)
|
)
|
||||||
|
|
||||||
def is_git_repo(d: str):
|
def is_git_repo(d: str):
|
||||||
|
@ -75,5 +77,12 @@ def iter_all_commits():
|
||||||
|
|
||||||
|
|
||||||
def get_all_commits():
|
def get_all_commits():
|
||||||
ss = set(iter_all_commits())
|
res = {}
|
||||||
return list(sorted(ss, key=lambda c: c.dt))
|
for c in iter_all_commits():
|
||||||
|
nn = res.get(c.sha, None)
|
||||||
|
if nn is None:
|
||||||
|
res[c.sha] = c
|
||||||
|
else:
|
||||||
|
res[c.sha] = min(nn, c, key=lambda c: c.sha)
|
||||||
|
|
||||||
|
return list(sorted(res.values(), key=lambda c: c.dt))
|
||||||
|
|
3
run
Executable file
3
run
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eu
|
||||||
|
python3 -m commits
|
Loading…
Add table
Reference in a new issue