diff --git a/src/vs/sessions/contrib/changes/browser/changesView.ts b/src/vs/sessions/contrib/changes/browser/changesView.ts index bb3322d1838..1d0b7bb50d4 100644 --- a/src/vs/sessions/contrib/changes/browser/changesView.ts +++ b/src/vs/sessions/contrib/changes/browser/changesView.ts @@ -91,6 +91,8 @@ const enum ChangesVersionMode { const changesVersionModeContextKey = new RawContextKey('sessions.changesVersionMode', ChangesVersionMode.AllChanges); const isMergeBaseBranchProtectedContextKey = new RawContextKey('sessions.isMergeBaseBranchProtected', false); const hasOpenPullRequestContextKey = new RawContextKey('sessions.hasOpenPullRequest', false); +const hasIncomingChangesContextKey = new RawContextKey('sessions.hasIncomingChanges', false); +const hasOutgoingChangesContextKey = new RawContextKey('sessions.hasOutgoingChanges', false); // --- List Item @@ -646,6 +648,18 @@ export class ChangesViewPane extends ViewPane { return metadata?.pullRequestUrl !== undefined; })); + this.renderDisposables.add(bindContextKey(hasIncomingChangesContextKey, this.scopedContextKeyService, reader => { + const repository = this.viewModel.activeSessionRepositoryObs.read(reader); + const repositoryState = repository?.state.read(reader); + return (repositoryState?.HEAD?.behind ?? 0) > 0; + })); + + this.renderDisposables.add(bindContextKey(hasOutgoingChangesContextKey, this.scopedContextKeyService, reader => { + const repository = this.viewModel.activeSessionRepositoryObs.read(reader); + const repositoryState = repository?.state.read(reader); + return (repositoryState?.HEAD?.ahead ?? 0) > 0; + })); + const scopedServiceCollection = new ServiceCollection([IContextKeyService, this.scopedContextKeyService]); const scopedInstantiationService = this.instantiationService.createChild(scopedServiceCollection); this.renderDisposables.add(scopedInstantiationService);