mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
f932d52fbd
* feat(platform): get all branch update dates in a more performant manner When Renovate is working on a repository with many /potential/ branches, as well as some actually created branches, it's possible for the calculation for `commitHourlyLimit` to end up taking significant time. This can lead to a less performant job generally, but can sometimes lead to the Renovate job failing to complete, and then timing out when executed by a job runner. To handle this, we can instead use use `git for-each-ref` to look up each Git ref (remotely) and request the commit date, which leads to a much more performant lookup. Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io> * fixup! feat(platform): get all branch update dates in a more performant manner Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io> * fixup! Merge remote-tracking branch 'origin/HEAD' into wip/commit-hourly-slow --------- Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
import type { DateTime } from 'luxon';
|
|
import * as git from '../../util/git/index.ts';
|
|
import type { CommitFilesConfig } from '../../util/git/types.ts';
|
|
import type { LongCommitSha } from '../../util/schema-utils/git.ts';
|
|
import type { PlatformScm } from './types.ts';
|
|
|
|
export class DefaultGitScm implements PlatformScm {
|
|
branchExists(branchName: string): Promise<boolean> {
|
|
return Promise.resolve(git.branchExists(branchName));
|
|
}
|
|
|
|
commitAndPush(
|
|
commitConfig: CommitFilesConfig,
|
|
): Promise<LongCommitSha | null> {
|
|
return git.commitFiles(commitConfig);
|
|
}
|
|
|
|
deleteBranch(branchName: string): Promise<void> {
|
|
return git.deleteBranch(branchName);
|
|
}
|
|
|
|
getBranchCommit(branchName: string): Promise<LongCommitSha | null> {
|
|
return Promise.resolve(git.getBranchCommit(branchName));
|
|
}
|
|
|
|
getBranchUpdateDate(branchName: string): Promise<DateTime | null> {
|
|
return git.getBranchUpdateDate(branchName);
|
|
}
|
|
|
|
getAllBranchUpdateDates(): Promise<Record<string, DateTime>> {
|
|
return git.getAllBranchUpdateDates();
|
|
}
|
|
|
|
isBranchBehindBase(branchName: string, baseBranch: string): Promise<boolean> {
|
|
return git.isBranchBehindBase(branchName, baseBranch);
|
|
}
|
|
|
|
isBranchConflicted(baseBranch: string, branch: string): Promise<boolean> {
|
|
return git.isBranchConflicted(baseBranch, branch);
|
|
}
|
|
|
|
isBranchModified(branchName: string, baseBranch: string): Promise<boolean> {
|
|
return git.isBranchModified(branchName, baseBranch);
|
|
}
|
|
|
|
getFileList(): Promise<string[]> {
|
|
return git.getFileList();
|
|
}
|
|
|
|
checkoutBranch(branchName: string): Promise<LongCommitSha> {
|
|
return git.checkoutBranch(branchName);
|
|
}
|
|
|
|
mergeAndPush(branchName: string): Promise<void> {
|
|
return git.mergeBranch(branchName);
|
|
}
|
|
|
|
mergeToLocal(branchName: string): Promise<void> {
|
|
return git.mergeToLocal(branchName);
|
|
}
|
|
|
|
syncForkWithUpstream(branchName: string): Promise<void> {
|
|
return git.syncForkWithUpstream(branchName);
|
|
}
|
|
}
|