Browse Source

Removes unused code

main
Eric Amodio 2 years ago
parent
commit
cf5e1c246b
3 changed files with 3 additions and 69 deletions
  1. +1
    -32
      src/env/node/git/localGitProvider.ts
  2. +1
    -3
      src/git/gitProvider.ts
  3. +1
    -34
      src/plus/github/githubGitProvider.ts

+ 1
- 32
src/env/node/git/localGitProvider.ts View File

@ -26,7 +26,7 @@ import type {
import { configuration } from '../../../configuration';
import { CoreGitConfiguration, GlyphChars, Schemes } from '../../../constants';
import type { Container } from '../../../container';
import { Features, PlusFeatures } from '../../../features';
import { Features } from '../../../features';
import {
StashApplyError,
StashApplyErrorReason,
@ -108,7 +108,6 @@ import { SearchPattern } from '../../../git/search';
import { LogCorrelationContext, Logger } from '../../../logger';
import { Messages } from '../../../messages';
import { WorkspaceStorageKeys } from '../../../storage';
import { SubscriptionPlanId } from '../../../subscription';
import { countStringLength, filterMap } from '../../../system/array';
import { gate } from '../../../system/decorators/gate';
import { debug, log } from '../../../system/decorators/log';
@ -404,36 +403,6 @@ export class LocalGitProvider implements GitProvider, Disposable {
};
}
private _allowedFeatures = new Map<string, Map<PlusFeatures, boolean>>();
async allows(feature: PlusFeatures, plan: SubscriptionPlanId, repoPath?: string): Promise<boolean> {
if (plan === SubscriptionPlanId.Free) return false;
if (plan === SubscriptionPlanId.Pro) return true;
if (repoPath == null) {
const repositories = [...this.container.git.getOpenRepositories(this.descriptor.id)];
for await (const result of fastestSettled(repositories.map(r => this.allows(feature, plan, r.path)))) {
if (result.status !== 'fulfilled' || !result.value) return false;
}
return true;
}
let allowedByRepo = this._allowedFeatures.get(repoPath);
let allowed = allowedByRepo?.get(feature);
if (allowed != null) return allowed;
allowed = GitProviderService.previewFeatures?.get(feature)
? true
: (await this.visibility(repoPath)) !== RepositoryVisibility.Private;
if (allowedByRepo == null) {
allowedByRepo = new Map<PlusFeatures, boolean>();
this._allowedFeatures.set(repoPath, allowedByRepo);
}
allowedByRepo.set(feature, allowed);
return allowed;
}
private _supportedFeatures = new Map<Features, boolean>();
async supports(feature: Features): Promise<boolean> {
let supported = this._supportedFeatures.get(feature);

+ 1
- 3
src/git/gitProvider.ts View File

@ -1,7 +1,6 @@
import { Disposable, Event, Range, TextDocument, Uri, WorkspaceFolder } from 'vscode';
import type { Commit, InputBox } from '../@types/vscode.git';
import { Features, PlusFeatures } from '../features';
import type { SubscriptionPlanId } from '../subscription';
import { Features } from '../features';
import type { GitUri } from './gitUri';
import type {
BranchSortOptions,
@ -116,7 +115,6 @@ export interface GitProvider extends Disposable {
): Repository;
openRepositoryInitWatcher?(): RepositoryInitWatcher;
allows(feature: PlusFeatures, plan: SubscriptionPlanId, repoPath?: string): Promise<boolean>;
supports(feature: Features): Promise<boolean>;
visibility(repoPath: string): Promise<RepositoryVisibility>;

+ 1
- 34
src/plus/github/githubGitProvider.ts View File

@ -25,7 +25,7 @@ import {
OpenVirtualRepositoryError,
OpenVirtualRepositoryErrorReason,
} from '../../errors';
import { Features, PlusFeatures } from '../../features';
import { Features } from '../../features';
import {
GitProvider,
GitProviderId,
@ -38,7 +38,6 @@ import {
RepositoryVisibility,
ScmRepository,
} from '../../git/gitProvider';
import { GitProviderService } from '../../git/gitProviderService';
import { GitUri } from '../../git/gitUri';
import {
BranchSortOptions,
@ -82,12 +81,10 @@ import { RemoteProviderFactory, RemoteProviders } from '../../git/remotes/factor
import { RemoteProvider, RichRemoteProvider } from '../../git/remotes/provider';
import { SearchPattern } from '../../git/search';
import { LogCorrelationContext, Logger } from '../../logger';
import { SubscriptionPlanId } from '../../subscription';
import { gate } from '../../system/decorators/gate';
import { debug, log } from '../../system/decorators/log';
import { filterMap, some } from '../../system/iterable';
import { isAbsolute, isFolderGlob, maybeUri, normalizePath, relative } from '../../system/path';
import { fastestSettled } from '../../system/promise';
import { CachedBlame, CachedLog, GitDocumentState } from '../../trackers/gitDocumentTracker';
import { TrackedDocument } from '../../trackers/trackedDocument';
import { getRemoteHubApi, GitHubAuthorityMetadata, Metadata, RemoteHubApi } from '../remotehub';
@ -189,36 +186,6 @@ export class GitHubGitProvider implements GitProvider, Disposable {
);
}
private _allowedFeatures = new Map<string, Map<PlusFeatures, boolean>>();
async allows(feature: PlusFeatures, plan: SubscriptionPlanId, repoPath?: string): Promise<boolean> {
if (plan === SubscriptionPlanId.Free) return false;
if (plan === SubscriptionPlanId.Pro) return true;
if (repoPath == null) {
const repositories = [...this.container.git.getOpenRepositories(this.descriptor.id)];
for await (const result of fastestSettled(repositories.map(r => this.allows(feature, plan, r.path)))) {
if (result.status !== 'fulfilled' || !result.value) return false;
}
return true;
}
let allowedByRepo = this._allowedFeatures.get(repoPath);
let allowed = allowedByRepo?.get(feature);
if (allowed != null) return allowed;
allowed = GitProviderService.previewFeatures?.get(feature)
? true
: (await this.visibility(repoPath)) === RepositoryVisibility.Public;
if (allowedByRepo == null) {
allowedByRepo = new Map<PlusFeatures, boolean>();
this._allowedFeatures.set(repoPath, allowedByRepo);
}
allowedByRepo.set(feature, allowed);
return allowed;
}
// private _supportedFeatures = new Map<Features, boolean>();
async supports(feature: Features): Promise<boolean> {
// const supported = this._supportedFeatures.get(feature);

Loading…
Cancel
Save