Git - 💄 more history provider logging (#205101)

* Git - 💄 more history provider logging

* Fix up more logging
This commit is contained in:
Ladislau Szomoru 2024-02-13 14:56:22 +01:00 committed by GitHub
parent c5d0386f54
commit 4194cbfdf8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -83,7 +83,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
this._HEAD?.upstream?.name !== this.repository.HEAD?.upstream?.name ||
this._HEAD?.upstream?.remote !== this.repository.HEAD?.upstream?.remote ||
this._HEAD?.upstream?.commit !== this.repository.HEAD?.upstream?.commit) {
this.logger.trace('GitHistoryProvider:onDidRunGitStatus - Upstream has changed');
this.logger.trace(`GitHistoryProvider:onDidRunGitStatus - Upstream has changed (${force})`);
this._onDidChangeCurrentHistoryItemGroupBase.fire();
}
@ -176,6 +176,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
if (!historyItemId2) {
const upstreamRef = await this.resolveHistoryItemGroupBase(historyItemId1);
if (!upstreamRef) {
this.logger.info(`GitHistoryProvider:resolveHistoryItemGroupCommonAncestor - Failed to resolve history item group base for '${historyItemId1}'`);
return undefined;
}
@ -184,14 +185,16 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
const ancestor = await this.repository.getMergeBase(historyItemId1, historyItemId2);
if (!ancestor) {
this.logger.info(`GitHistoryProvider:resolveHistoryItemGroupCommonAncestor - Failed to resolve common ancestor for '${historyItemId1}' and '${historyItemId2}'`);
return undefined;
}
try {
const commitCount = await this.repository.getCommitCount(`${historyItemId1}...${historyItemId2}`);
this.logger.trace(`GitHistoryProvider:resolveHistoryItemGroupCommonAncestor - Resolved common ancestor for '${historyItemId1}' and '${historyItemId2}': ${JSON.stringify({ id: ancestor, ahead: commitCount.ahead, behind: commitCount.behind })}`);
return { id: ancestor, ahead: commitCount.ahead, behind: commitCount.behind };
} catch (err) {
this.logger.error(`Failed to get ahead/behind for '${historyItemId1}...${historyItemId2}': ${err.message}`);
this.logger.error(`GitHistoryProvider:resolveHistoryItemGroupCommonAncestor - Failed to get ahead/behind for '${historyItemId1}...${historyItemId2}': ${err.message}`);
}
return undefined;
@ -212,6 +215,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
// Base (config -> reflog -> default)
const remoteBranch = await this.repository.getBranchBase(historyItemId);
if (!remoteBranch?.remote || !remoteBranch?.name || !remoteBranch?.commit || remoteBranch?.type !== RefType.RemoteHead) {
this.logger.info(`GitHistoryProvider:resolveHistoryItemGroupBase - Failed to resolve history item group base for '${historyItemId}'`);
return undefined;
}
@ -222,7 +226,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
};
}
catch (err) {
this.logger.error(`Failed to get branch base for '${historyItemId}': ${err.message}`);
this.logger.error(`GitHistoryProvider:resolveHistoryItemGroupBase - Failed to get branch base for '${historyItemId}': ${err.message}`);
}
return undefined;

View File

@ -3559,7 +3559,7 @@ class SCMTreeDataSource implements IAsyncDataSource<ISCMViewService, TreeElement
let incomingHistoryItemGroup = historyProviderCacheEntry?.incomingHistoryItemGroup;
let outgoingHistoryItemGroup = historyProviderCacheEntry?.outgoingHistoryItemGroup;
if (!incomingHistoryItemGroup || !outgoingHistoryItemGroup) {
if (!incomingHistoryItemGroup && !outgoingHistoryItemGroup) {
// Common ancestor, ahead, behind
const ancestor = await historyProvider.resolveHistoryItemGroupCommonAncestor(currentHistoryItemGroup.id, currentHistoryItemGroup.base?.id);
if (!ancestor) {