SCM - cleanup SourceControlHistoryProvider api (#227376)

* Remove provideHistoryItemSummary

* Remove resolveHistoryItemGroupCommonAncestor

* Remove provideHistoryItems

* Rename methods and remove unused code

* Remove duplicated code
This commit is contained in:
Ladislau Szomoru
2024-09-02 15:52:05 +02:00
committed by GitHub
parent 322f345106
commit a3aedeae3e
10 changed files with 30 additions and 202 deletions

View File

@@ -1508,16 +1508,13 @@ export class Repository implements Disposable {
private async getDefaultBranch(): Promise<Branch | undefined> {
try {
const defaultBranchResult = await this.repository.exec(['symbolic-ref', '--short', 'refs/remotes/origin/HEAD']);
if (defaultBranchResult.stdout.trim() === '' || defaultBranchResult.stderr) {
return undefined;
}
return this.getBranch(defaultBranchResult.stdout.trim());
const defaultBranch = await this.repository.getDefaultBranch();
return defaultBranch;
}
catch (err) {
this.logger.warn(`[Repository][getDefaultBranch] Failed to get default branch details: ${err.message}.`);
return undefined;
}
catch (err) { }
return undefined;
}
private async getUpstreamBranch(branch: Branch): Promise<Branch | undefined> {
@@ -1618,14 +1615,6 @@ export class Repository implements Disposable {
return this._EMPTY_TREE;
}
async getCommitCount(range: string): Promise<{ ahead: number; behind: number }> {
return await this.run(Operation.RevList, () => this.repository.getCommitCount(range));
}
async revParse(ref: string): Promise<string | undefined> {
return await this.run(Operation.RevParse, () => this.repository.revParse(ref));
}
async reset(treeish: string, hard?: boolean): Promise<void> {
await this.run(Operation.Reset, () => this.repository.reset(treeish, hard));
}