src/vs/workbench/contrib/scm/browser/activity.ts/SCMActiveResourceContextKeyController/updateContextKey
class SCMActiveResourceContextKeyController:	private updateContextKey(): void {
		const activeResource = EditorResourceAccessor.getOriginalUri(this.editorService.activeEditor);

		if (activeResource?.scheme === Schemas.file || activeResource?.scheme === Schemas.vscodeRemote) {
			const activeResourceRepository = Iterable.find(
				this.scmService.repositories,
				r => Boolean(r.provider.rootUri && this.uriIdentityService.extUri.isEqualOrParent(activeResource, r.provider.rootUri))
			);

			this.activeResourceRepositoryContextKey.set(activeResourceRepository?.id);

			for (const resourceGroup of activeResourceRepository?.provider.groups.elements ?? []) {
				if (resourceGroup.elements
					.some(scmResource =>
						this.uriIdentityService.extUri.isEqual(activeResource, scmResource.sourceUri))) {
					this.activeResourceHasChangesContextKey.set(true);
					return;
				}
			}

			this.activeResourceHasChangesContextKey.set(false);
		} else {
			this.activeResourceHasChangesContextKey.set(false);
			this.activeResourceRepositoryContextKey.set(undefined);
		}
	}