From 4194cbfdf8b5b5b83a7a525b5470bdddb39da2ea Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:56:22 +0100 Subject: [PATCH] =?UTF-8?q?Git=20-=20=F0=9F=92=84=20more=20history=20provi?= =?UTF-8?q?der=20logging=20(#205101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Git - 💄 more history provider logging * Fix up more logging --- extensions/git/src/historyProvider.ts | 10 +++++++--- src/vs/workbench/contrib/scm/browser/scmViewPane.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/extensions/git/src/historyProvider.ts b/extensions/git/src/historyProvider.ts index db987344028..64230ecf46b 100644 --- a/extensions/git/src/historyProvider.ts +++ b/extensions/git/src/historyProvider.ts @@ -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; diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts index 3a92ee61bdc..73ce611ad21 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts @@ -3559,7 +3559,7 @@ class SCMTreeDataSource implements IAsyncDataSource