Add patches

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2022-08-01 13:06:30 +02:00
committed by Alexis Sellier
parent cbbaadd330
commit c5d5053f0c
27 changed files with 1184 additions and 200 deletions
+10 -3
View File
@@ -1,4 +1,4 @@
import type { Stats, Person } from "@app/project";
import { Stats, Person, Project } from "@app/project";
import type { Diff } from "@app/diff";
import { ApiError } from "@app/api";
@@ -59,14 +59,14 @@ export interface CommitGroup {
week: number;
}
export interface CommitStats {
export interface DiffStats {
additions: number;
deletions: number;
}
export interface Commit {
header: CommitHeader;
stats: CommitStats;
stats: DiffStats;
diff: Diff;
branches: string[];
context: CommitContext;
@@ -129,6 +129,13 @@ export function groupCommits(commits: { header: CommitHeader; context: CommitCon
}
}
export async function fetchCommits(project: Project, parentCommit: string): Promise<GroupedCommitsHistory> {
const commitsQuery = await Project.getCommits(project.urn, project.seed.api, {
parent: parentCommit, verified: true
});
return groupCommitHistory(commitsQuery);
}
export function groupCommitsByWeek(commits: CommitMetadata[]): CommitGroup[] {
const groupedCommits: CommitGroup[] = [];
let groupDate: Date | undefined = undefined;