type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ClassDeclaration
export class CreateTableDto { name: string; userId: string; }
Binary-Future/applacarta-server
src/modules/table/dto/create-table.dto.ts
TypeScript
ClassDeclaration
export declare abstract class AgAbstractField<T> extends AgAbstractLabel { static EVENT_CHANGED: string; protected abstract displayTag: string; protected abstract className: string; protected value: T; onValueChange(callbackFn: (newValue: T) => void): this; getWidth(): number; setWidth(width: number): this; getValue(): T; setValue(value: T, silent?: boolean): this; }
Krumpet/ag-grid
dist/lib/widgets/agAbstractField.d.ts
TypeScript
TypeAliasDeclaration
export declare type FieldElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
Krumpet/ag-grid
dist/lib/widgets/agAbstractField.d.ts
TypeScript
MethodDeclaration
onValueChange(callbackFn: (newValue: T) => void): this;
Krumpet/ag-grid
dist/lib/widgets/agAbstractField.d.ts
TypeScript
MethodDeclaration
getWidth(): number;
Krumpet/ag-grid
dist/lib/widgets/agAbstractField.d.ts
TypeScript
MethodDeclaration
setWidth(width: number): this;
Krumpet/ag-grid
dist/lib/widgets/agAbstractField.d.ts
TypeScript
MethodDeclaration
getValue(): T;
Krumpet/ag-grid
dist/lib/widgets/agAbstractField.d.ts
TypeScript
MethodDeclaration
setValue(value: T, silent?: boolean): this;
Krumpet/ag-grid
dist/lib/widgets/agAbstractField.d.ts
TypeScript
ArrowFunction
c => affected.includes(c)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
(r, name) => `${name}(${r.id})`
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
(a, b) => (a.starred ? -1 : 1) - (b.starred ? -1 : 1) || a.index - b.index
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
b => !b.remote
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
b => b.ref
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
b => b.upstream != null
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
b => GitBranch.getRemote(b.upstream!.name)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
b => GitBranch.getNameWithoutRemote(b.upstream!.name)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
b => b.remote
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
b => GitBranch.getRemote(b.name)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
b => GitReference.getNameWithoutRemote(b)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
() => this.fetchCore(opts)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
b => b.name === name
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
r => r.name === remote
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
r => { if (!RichRemoteProvider.is(r.provider)) return undefined; return r.provider.onDidChange(() => this.fireChange(RepositoryChange.RemoteProviders)); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
() => this.fireChange(RepositoryChange.RemoteProviders)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
() => this.pullCore(opts)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
() => this.pushCore(opts)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
() => this.switchCore(ref, opts)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
() => this.stopWatchingFileSystem()
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
t => t.ref
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
u => u.fsPath
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
arg => arg.startsWith('#') || arg.includes("'") || arg.includes('(') || arg.includes(')') ? `"${arg}"` : arg
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ArrowFunction
() => this.fireChange(RepositoryChange.Unknown)
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
ClassDeclaration
export class RepositoryChangeEvent { private readonly _changes: Set<RepositoryChange>; constructor(public readonly repository: Repository, changes: RepositoryChange[]) { this._changes = new Set(changes); } toString(changesOnly: boolean = false): string { return changesOnly ? `changes=${join(this._changes, ', ')}` : `{ repository: ${this.repository?.name ?? ''}, changes: ${join(this._changes, ', ')} }`; } changed(...args: [...RepositoryChange[], RepositoryChangeComparisonMode]) { const affected = args.slice(0, -1) as RepositoryChange[]; const mode = args[args.length - 1] as RepositoryChangeComparisonMode; if (mode === RepositoryChangeComparisonMode.Any) { return some(this._changes, c => affected.includes(c)); } let changes = this._changes; if (mode === RepositoryChangeComparisonMode.Exclusive) { if ( affected.includes(RepositoryChange.CherryPick) || affected.includes(RepositoryChange.Merge) || affected.includes(RepositoryChange.Rebase) ) { if (!affected.includes(RepositoryChange.Status)) { affected.push(RepositoryChange.Status); } } else if (affected.includes(RepositoryChange.Status)) { changes = new Set(changes); changes.delete(RepositoryChange.CherryPick); changes.delete(RepositoryChange.Merge); changes.delete(RepositoryChange.Rebase); } } const intersection = [...filter(changes, c => affected.includes(c))]; return mode === RepositoryChangeComparisonMode.Exclusive ? intersection.length === changes.size : intersection.length === affected.length; } with(changes: RepositoryChange[]) { return new RepositoryChangeEvent(this.repository, [...this._changes, ...changes]); } }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
InterfaceDeclaration
export interface RepositoryFileSystemChangeEvent { readonly repository?: Repository; readonly uris: Uri[]; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
EnumDeclaration
export const enum RepositoryChange { // FileSystem = 'filesystem', Unknown = 'unknown', // No file watching required Closed = 'closed', Ignores = 'ignores', Starred = 'starred', // File watching required CherryPick = 'cherrypick', Config = 'config', Heads = 'heads', Index = 'index', Merge = 'merge', Rebase = 'rebase', Remotes = 'remotes', RemoteProviders = 'providers', Stash = 'stash', /* * Union of Cherry, Merge, and Rebase */ Status = 'status', Tags = 'tags', }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
EnumDeclaration
export const enum RepositoryChangeComparisonMode { Any, All, Exclusive, }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
toString(changesOnly: boolean = false): string { return changesOnly ? `changes=${join(this._changes, ', ')}` : `{ repository: ${this.repository?.name ?? ''}, changes: ${join(this._changes, ', ')} }`; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
changed(...args: [...RepositoryChange[], RepositoryChangeComparisonMode]) { const affected = args.slice(0, -1) as RepositoryChange[]; const mode = args[args.length - 1] as RepositoryChangeComparisonMode; if (mode === RepositoryChangeComparisonMode.Any) { return some(this._changes, c => affected.includes(c)); } let changes = this._changes; if (mode === RepositoryChangeComparisonMode.Exclusive) { if ( affected.includes(RepositoryChange.CherryPick) || affected.includes(RepositoryChange.Merge) || affected.includes(RepositoryChange.Rebase) ) { if (!affected.includes(RepositoryChange.Status)) { affected.push(RepositoryChange.Status); } } else if (affected.includes(RepositoryChange.Status)) { changes = new Set(changes); changes.delete(RepositoryChange.CherryPick); changes.delete(RepositoryChange.Merge); changes.delete(RepositoryChange.Rebase); } } const intersection = [...filter(changes, c => affected.includes(c))]; return mode === RepositoryChangeComparisonMode.Exclusive ? intersection.length === changes.size : intersection.length === affected.length; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
with(changes: RepositoryChange[]) { return new RepositoryChangeEvent(this.repository, [...this._changes, ...changes]); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
static formatLastFetched(lastFetched: number, short: boolean = true): string { const formatter = getFormatter(new Date(lastFetched)); if (Date.now() - lastFetched < millisecondsPerDay) { return formatter.fromNow(); } if (short) { return formatter.format(Container.instance.config.defaultDateShortFormat ?? 'MMM D, YYYY'); } let format = Container.instance.config.defaultDateFormat ?? `dddd, MMMM Do, YYYY [at] ${Container.instance.config.defaultTimeFormat ?? 'h:mma'}`; if (!/[hHm]/.test(format)) { format += ` [at] ${Container.instance.config.defaultTimeFormat ?? 'h:mma'}`; } return formatter.format(format); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
static getLastFetchedUpdateInterval(lastFetched: number): number { const timeDiff = Date.now() - lastFetched; return timeDiff < millisecondsPerDay ? (timeDiff < millisecondsPerHour ? millisecondsPerMinute : millisecondsPerHour) / 2 : 0; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
static sort(repositories: Repository[]) { return repositories.sort((a, b) => (a.starred ? -1 : 1) - (b.starred ? -1 : 1) || a.index - b.index); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
dispose() { this.stopWatchingFileSystem(); this._remotesDisposable?.dispose(); this._repoWatcherDisposable?.dispose(); this._disposable.dispose(); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private onConfigurationChanged(e?: ConfigurationChangeEvent) { if (configuration.changed(e, 'remotes', this.folder.uri)) { this._providers = RemoteProviderFactory.loadProviders(configuration.get('remotes', this.folder.uri)); if (e != null) { this.resetCaches('remotes'); this.fireChange(RepositoryChange.Remotes); } } }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private onFileSystemChanged(uri: Uri) { // Ignore .git changes if (/\.git(?:\/|\\|$)/.test(uri.fsPath)) return; this.fireFileSystemChange(uri); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@debug() private onRepositoryChanged(uri: Uri | undefined) { this._lastFetched = undefined; const match = uri != null ? /(?<ignore>\/\.gitignore)|\.git\/(?<type>config|index|HEAD|FETCH_HEAD|ORIG_HEAD|CHERRY_PICK_HEAD|MERGE_HEAD|REBASE_HEAD|rebase-merge|refs\/(?:heads|remotes|stash|tags))/.exec( uri.path, ) : undefined; if (match?.groups != null) { const { ignore, type } = match.groups; if (ignore) { this.fireChange(RepositoryChange.Ignores); return; } switch (type) { case 'config': this.resetCaches(); this.fireChange(RepositoryChange.Config, RepositoryChange.Remotes); return; case 'index': this.fireChange(RepositoryChange.Index); return; case 'FETCH_HEAD': // Ignore any changes to FETCH_HEAD as unless other things change, nothing changes that we care about return; case 'HEAD': case 'ORIG_HEAD': this.resetCaches('branches'); this.fireChange(RepositoryChange.Heads); return; case 'CHERRY_PICK_HEAD': this.fireChange(RepositoryChange.CherryPick, RepositoryChange.Status); return; case 'MERGE_HEAD': this.fireChange(RepositoryChange.Merge, RepositoryChange.Status); return; case 'REBASE_HEAD': case 'rebase-merge': this.fireChange(RepositoryChange.Rebase, RepositoryChange.Status); return; case 'refs/heads': this.resetCaches('branches'); this.fireChange(RepositoryChange.Heads); return; case 'refs/remotes': this.resetCaches(); this.fireChange(RepositoryChange.Remotes); return; case 'refs/stash': this.fireChange(RepositoryChange.Stash); return; case 'refs/tags': this.fireChange(RepositoryChange.Tags); return; } } this.fireChange(RepositoryChange.Unknown); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@log() branch(...args: string[]) { this.runTerminalCommand('branch', ...args); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@log() branchDelete( branches: GitBranchReference | GitBranchReference[], { force, remote }: { force?: boolean; remote?: boolean } = {}, ) { if (!Array.isArray(branches)) { branches = [branches]; } const localBranches = branches.filter(b => !b.remote); if (localBranches.length !== 0) { const args = ['--delete']; if (force) { args.push('--force'); } this.runTerminalCommand('branch', ...args, ...branches.map(b => b.ref)); if (remote) { const trackingBranches = localBranches.filter(b => b.upstream != null); if (trackingBranches.length !== 0) { const branchesByOrigin = groupByMap(trackingBranches, b => GitBranch.getRemote(b.upstream!.name)); for (const [remote, branches] of branchesByOrigin.entries()) { this.runTerminalCommand( 'push', '-d', remote, ...branches.map(b => GitBranch.getNameWithoutRemote(b.upstream!.name)), ); } } } } const remoteBranches = branches.filter(b => b.remote); if (remoteBranches.length !== 0) { const branchesByOrigin = groupByMap(remoteBranches, b => GitBranch.getRemote(b.name)); for (const [remote, branches] of branchesByOrigin.entries()) { this.runTerminalCommand( 'push', '-d', remote, ...branches.map(b => GitReference.getNameWithoutRemote(b)), ); } } }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@log() cherryPick(...args: string[]) { this.runTerminalCommand('cherry-pick', ...args); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
containsUri(uri: Uri) { if (GitUri.is(uri)) { uri = uri.repoPath != null ? this.container.git.getAbsoluteUri(uri.repoPath) : uri.documentUri(); } return this.folder === workspace.getWorkspaceFolder(uri); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@gate() @log() async fetch( options: { all?: boolean; branch?: GitBranchReference; progress?: boolean; prune?: boolean; pull?: boolean; remote?: string; } = {}, ) { const { progress, ...opts } = { progress: true, ...options }; if (!progress) return this.fetchCore(opts); return void (await window.withProgress( { location: ProgressLocation.Notification, title: opts.branch != null ? `${opts.pull ? 'Pulling' : 'Fetching'} ${opts.branch.name}...` : `Fetching ${opts.remote ? `${opts.remote} of ` : ''}${this.formattedName}...`, }, () => this.fetchCore(opts), )); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private async fetchCore( options: { all?: boolean; branch?: GitBranchReference; prune?: boolean; pull?: boolean; remote?: string } = {}, ) { try { void (await this.container.git.fetch(this.path, options)); this.fireChange(RepositoryChange.Unknown); } catch (ex) { Logger.error(ex); void Messages.showGenericErrorMessage('Unable to fetch repository'); } }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
async getBranch(name?: string): Promise<GitBranch | undefined> { if (name) { const { values: [branch], } = await this.getBranches({ filter: b => b.name === name }); return branch; } if (this._branch == null) { this._branch = this.container.git.getBranch(this.path); } return this._branch; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
getBranches( options: { filter?: (b: GitBranch) => boolean; paging?: { cursor?: string; limit?: number }; sort?: boolean | BranchSortOptions; } = {}, ) { return this.container.git.getBranches(this.path, options); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
getChangedFilesCount(sha?: string): Promise<GitDiffShortStat | undefined> { return this.container.git.getChangedFilesCount(this.path, sha); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
getCommit(ref: string): Promise<GitLogCommit | undefined> { return this.container.git.getCommit(this.path, ref); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
getContributors(options?: { all?: boolean; ref?: string; stats?: boolean }): Promise<GitContributor[]> { return this.container.git.getContributors(this.path, options); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@gate() async getLastFetched(): Promise<number> { if (this._lastFetched == null) { const hasRemotes = await this.hasRemotes(); if (!hasRemotes || this.container.vsls.isMaybeGuest) return 0; } try { const lastFetched = await this.container.git.getLastFetchedTimestamp(this.path); // If we don't get a number, assume the fetch failed, and don't update the timestamp if (lastFetched != null) { this._lastFetched = lastFetched; } } catch { this._lastFetched = undefined; } return this._lastFetched ?? 0; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
getMergeStatus(): Promise<GitMergeStatus | undefined> { return this.container.git.getMergeStatus(this.path); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
getRebaseStatus(): Promise<GitRebaseStatus | undefined> { return this.container.git.getRebaseStatus(this.path); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
async getRemote(remote: string): Promise<GitRemote | undefined> { return (await this.getRemotes()).find(r => r.name === remote); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
async getRemotes(options: { filter?: (remote: GitRemote) => boolean; sort?: boolean } = {}): Promise<GitRemote[]> { if (this._remotes == null) { if (this._providers == null) { const remotesCfg = configuration.get('remotes', this.folder.uri); this._providers = RemoteProviderFactory.loadProviders(remotesCfg); } // Since we are caching the results, always sort this._remotes = this.container.git.getRemotes(this.path, { providers: this._providers, sort: true }); void this.subscribeToRemotes(this._remotes); } return options.filter != null ? (await this._remotes).filter(options.filter) : this._remotes; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
async getRichRemote(connectedOnly: boolean = false): Promise<GitRemote<RichRemoteProvider> | undefined> { return this.container.git.getRichRemoteProvider(await this.getRemotes(), { includeDisconnected: !connectedOnly, }); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private async subscribeToRemotes(remotes: Promise<GitRemote[]>) { this._remotesDisposable?.dispose(); this._remotesDisposable = undefined; this._remotesDisposable = Disposable.from( ...filterMap(await remotes, r => { if (!RichRemoteProvider.is(r.provider)) return undefined; return r.provider.onDidChange(() => this.fireChange(RepositoryChange.RemoteProviders)); }), ); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
getStash(): Promise<GitStash | undefined> { return this.container.git.getStash(this.path); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
getStatus(): Promise<GitStatus | undefined> { return this.container.git.getStatusForRepo(this.path); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
getTags(options?: { filter?: (t: GitTag) => boolean; sort?: boolean | TagSortOptions }) { return this.container.git.getTags(this.path, options); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
async hasRemotes(): Promise<boolean> { const remotes = await this.getRemotes(); return remotes?.length > 0; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
async hasRichRemote(connectedOnly: boolean = false): Promise<boolean> { const remote = await this.getRichRemote(connectedOnly); return remote?.provider != null; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
async hasUpstreamBranch(): Promise<boolean> { const branch = await this.getBranch(); return branch?.upstream != null; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@log() merge(...args: string[]) { this.runTerminalCommand('merge', ...args); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@gate() @log() async pull(options: { progress?: boolean; rebase?: boolean } = {}) { const { progress, ...opts } = { progress: true, ...options }; if (!progress) return this.pullCore(); return void (await window.withProgress( { location: ProgressLocation.Notification, title: `Pulling ${this.formattedName}...`, }, () => this.pullCore(opts), )); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private async pullCore(options: { rebase?: boolean } = {}) { try { const upstream = await this.hasUpstreamBranch(); if (upstream) { void (await commands.executeCommand( options.rebase ? BuiltInGitCommands.PullRebase : BuiltInGitCommands.Pull, this.path, )); } else if (configuration.getAny<boolean>(BuiltInGitConfiguration.FetchOnPull, Uri.file(this.path))) { void (await this.container.git.fetch(this.path)); } this.fireChange(RepositoryChange.Unknown); } catch (ex) { Logger.error(ex); void Messages.showGenericErrorMessage('Unable to pull repository'); } }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@gate() @log() async push( options: { force?: boolean; progress?: boolean; reference?: GitReference; publish?: { remote: string; }; } = {}, ) { const { progress, ...opts } = { progress: true, ...options }; if (!progress) return this.pushCore(opts); return void (await window.withProgress( { location: ProgressLocation.Notification, title: GitReference.isBranch(opts.reference) ? `${opts.publish != null ? 'Publishing ' : 'Pushing '}${opts.reference.name}...` : `Pushing ${this.formattedName}...`, }, () => this.pushCore(opts), )); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private async showCreatePullRequestPrompt(remoteName: string, branch: GitBranchReference) { if (!this.container.actionRunners.count('createPullRequest')) return; if (!(await Messages.showCreatePullRequestPrompt(branch.name))) return; const remote = await this.getRemote(remoteName); void executeActionCommand<CreatePullRequestActionContext>('createPullRequest', { repoPath: this.path, remote: remote != null ? { name: remote.name, provider: remote.provider != null ? { id: remote.provider.id, name: remote.provider.name, domain: remote.provider.domain, } : undefined, url: remote.url, } : { name: remoteName }, branch: { name: branch.name, isRemote: branch.remote, upstream: branch.upstream?.name, }, }); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private async pushCore( options: { force?: boolean; reference?: GitReference; publish?: { remote: string; }; } = {}, ) { try { if (GitReference.isBranch(options.reference)) { const repo = await this.container.git.getOrOpenScmRepository(this.path); if (repo == null) return; if (options.publish != null) { await repo?.push(options.publish.remote, options.reference.name, true); void this.showCreatePullRequestPrompt(options.publish.remote, options.reference); } else { const branch = await this.getBranch(options.reference.name); if (branch == null) return; const currentBranch = await this.getBranch(); if (branch.id === currentBranch?.id) { void (await commands.executeCommand( options.force ? BuiltInGitCommands.PushForce : BuiltInGitCommands.Push, this.path, )); } else { await repo?.push(branch.getRemoteName(), branch.name); } } } else if (options.reference != null) { const repo = await this.container.git.getOrOpenScmRepository(this.path); if (repo == null) return; const branch = await this.getBranch(); if (branch == null) return; await repo?.push(branch.getRemoteName(), `${options.reference.ref}:${branch.getNameWithoutRemote()}`); } else { void (await commands.executeCommand( options.force ? BuiltInGitCommands.PushForce : BuiltInGitCommands.Push, this.path, )); } this.fireChange(RepositoryChange.Unknown); } catch (ex) { Logger.error(ex); void Messages.showGenericErrorMessage('Unable to push repository'); } }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@log() rebase(configs: string[] | undefined, ...args: string[]) { this.runTerminalCommand( configs != null && configs.length !== 0 ? `${configs.join(' ')} rebase` : 'rebase', ...args, ); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@log() reset(...args: string[]) { this.runTerminalCommand('reset', ...args); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
resetCaches(...cache: ('branches' | 'remotes')[]) { if (cache.length === 0 || cache.includes('branches')) { this._branch = undefined; } if (cache.length === 0 || cache.includes('remotes')) { this._remotes = undefined; this._remotesDisposable?.dispose(); this._remotesDisposable = undefined; } }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
resume() { if (!this._suspended) return; this._suspended = false; // If we've come back into focus and we are dirty, fire the change events if (this._pendingRepoChange != null) { this._fireChangeDebounced!(); } if (this._pendingFileSystemChange != null) { this._fireFileSystemChangeDebounced!(); } }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@log() revert(...args: string[]) { this.runTerminalCommand('revert', ...args); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
searchForCommits( search: SearchPattern, options: { limit?: number; skip?: number } = {}, ): Promise<GitLog | undefined> { return this.container.git.getLogForSearch(this.path, search, options); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
star(branch?: GitBranch) { return this.updateStarred(true, branch); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@gate() @log() async stashApply(stashName: string, options: { deleteAfter?: boolean } = {}) { void (await this.container.git.stashApply(this.path, stashName, options)); this.fireChange(RepositoryChange.Stash); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@gate() @log() async stashDelete(stashName: string, ref?: string) { void (await this.container.git.stashDelete(this.path, stashName, ref)); this.fireChange(RepositoryChange.Stash); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@gate() @log() async stashSave(message?: string, uris?: Uri[], options: { includeUntracked?: boolean; keepIndex?: boolean } = {}) { void (await this.container.git.stashSave(this.path, message, uris, options)); this.fireChange(RepositoryChange.Stash); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@gate() @log() async switch(ref: string, options: { createBranch?: string | undefined; progress?: boolean } = {}) { const { progress, ...opts } = { progress: true, ...options }; if (!progress) return this.switchCore(ref, opts); return void (await window.withProgress( { location: ProgressLocation.Notification, title: `Switching ${this.formattedName} to ${ref}...`, cancellable: false, }, () => this.switchCore(ref, opts), )); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private async switchCore(ref: string, options: { createBranch?: string } = {}) { try { void (await this.container.git.checkout(this.path, ref, options)); this.fireChange(RepositoryChange.Unknown); } catch (ex) { Logger.error(ex); void Messages.showGenericErrorMessage('Unable to switch to reference'); } }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
toAbsoluteUri(path: string, options?: { validate?: boolean }): Uri | undefined { const uri = this.container.git.getAbsoluteUri(path, this.path); return !(options?.validate ?? true) || this.containsUri(uri) ? uri : undefined; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
unstar(branch?: GitBranch) { return this.updateStarred(false, branch); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private async updateStarred(star: boolean, branch?: GitBranch) { if (branch != null) { await this.updateStarredCore(WorkspaceState.StarredBranches, branch.id, star); } else { await this.updateStarredCore(WorkspaceState.StarredRepositories, this.id, star); } this.fireChange(RepositoryChange.Starred); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private async updateStarredCore(key: WorkspaceState, id: string, star: boolean) { let starred = this.container.context.workspaceState.get<Starred>(key); if (starred === undefined) { starred = Object.create(null) as Starred; } if (star) { starred[id] = true; } else { const { [id]: _, ...rest } = starred; starred = rest; } await this.container.context.workspaceState.update(key, starred); this.fireChange(RepositoryChange.Starred); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
startWatchingFileSystem(): Disposable { this._fsWatchCounter++; if (this._fsWatcherDisposable == null) { const watcher = workspace.createFileSystemWatcher(new RelativePattern(this.uri, '**')); this._fsWatcherDisposable = Disposable.from( watcher, watcher.onDidChange(this.onFileSystemChanged, this), watcher.onDidCreate(this.onFileSystemChanged, this), watcher.onDidDelete(this.onFileSystemChanged, this), ); } return { dispose: () => this.stopWatchingFileSystem() }; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
stopWatchingFileSystem(force: boolean = false) { if (this._fsWatcherDisposable == null) return; if (--this._fsWatchCounter > 0 && !force) return; this._fsWatchCounter = 0; this._fsWatcherDisposable.dispose(); this._fsWatcherDisposable = undefined; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
suspend() { this._suspended = true; }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@log() tag(...args: string[]) { this.runTerminalCommand('tag', ...args); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@log() tagDelete(tags: GitTagReference | GitTagReference[]) { if (!Array.isArray(tags)) { tags = [tags]; } const args = ['--delete']; this.runTerminalCommand('tag', ...args, ...tags.map(t => t.ref)); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@debug() private fireChange(...changes: RepositoryChange[]) { const cc = Logger.getCorrelationContext(); this._updatedAt = Date.now(); if (this._fireChangeDebounced == null) { this._fireChangeDebounced = debounce(this.fireChangeCore.bind(this), 250); } this._pendingRepoChange = this._pendingRepoChange?.with(changes) ?? new RepositoryChangeEvent(this, changes); this.onDidRepositoryChange(this, new RepositoryChangeEvent(this, changes)); if (this._suspended) { Logger.debug(cc, `queueing suspended ${this._pendingRepoChange.toString(true)}`); return; } this._fireChangeDebounced(); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
private fireChangeCore() { const e = this._pendingRepoChange; if (e == null) return; this._pendingRepoChange = undefined; Logger.debug(`Repository(${this.id}) firing ${e.toString(true)}`); this._onDidChange.fire(e); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript
MethodDeclaration
@debug() private fireFileSystemChange(uri: Uri) { const cc = Logger.getCorrelationContext(); this._updatedAt = Date.now(); if (this._fireFileSystemChangeDebounced == null) { this._fireFileSystemChangeDebounced = debounce(this.fireFileSystemChangeCore.bind(this), 2500); } if (this._pendingFileSystemChange == null) { this._pendingFileSystemChange = { repository: this, uris: [] }; } const e = this._pendingFileSystemChange; e.uris.push(uri); if (this._suspended) { Logger.debug(cc, `queueing suspended fs changes=${e.uris.map(u => u.fsPath).join(', ')}`); return; } this._fireFileSystemChangeDebounced(); }
Levistator/vscode-gitlens
src/git/models/repository.ts
TypeScript