Skip to content

Commit 9457b22

Browse files
authored
Added extra stats for commits (#111)
1 parent cf0c0f0 commit 9457b22

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

ForgejoRepoAPI.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def get_commits(self, repo: Repository, files: bool = True) -> list[Commit]:
9090
files=(
9191
[f.filename for f in getattr(c, "files", [])] if files else None
9292
),
93+
additions=None, # TODO
94+
deletions=None, # TODO
9395
)
9496
for c in commits
9597
]

GitHubRepoAPI.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def get_commits(self, repo: Repository, files: bool = True) -> list[Commit]:
7373
author=self.get_user_data(c.author),
7474
date=c.commit.author.date,
7575
files=[f.filename for f in c.files] if files else None,
76+
additions=c.stats.additions,
77+
deletions=c.stats.deletions,
7678
)
7779
for c in commits
7880
]

commits_parser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class CommitData:
1919
changed_files: str = ''
2020
commit_id: str = ''
2121
branch: str = ''
22+
additions: str = ''
23+
deletions: str = ''
2224

2325

2426
def log_repository_commits(
@@ -54,6 +56,8 @@ def log_repository_commits(
5456
changed_files=changed_files,
5557
commit_id=commit._id,
5658
branch=branch,
59+
additions=commit.additions,
60+
deletions=commit.deletions,
5761
)
5862
info = asdict(commit_data)
5963

interface_wrapper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class Commit:
3939
author: User
4040
date: datetime
4141
files: list[str]
42+
additions: int
43+
deletions: int
4244

4345

4446
@dataclass

0 commit comments

Comments
 (0)