Explorar el Código

Avoids unneeded Container.instance calls

main
Eric Amodio hace 2 años
padre
commit
f859c0415b
Se han modificado 5 ficheros con 13 adiciones y 15 borrados
  1. +3
    -3
      src/commands/git/worktree.ts
  2. +2
    -2
      src/views/commitsView.ts
  3. +1
    -2
      src/views/nodes/branchNode.ts
  4. +2
    -3
      src/views/nodes/tagNode.ts
  5. +5
    -5
      src/views/viewCommands.ts

+ 3
- 3
src/commands/git/worktree.ts Ver fichero

@ -1,7 +1,7 @@
import type { MessageItem } from 'vscode';
import { QuickInputButtons, Uri, window } from 'vscode';
import { configuration } from '../../configuration';
import { Container } from '../../container';
import type { Container } from '../../container';
import { PlusFeatures } from '../../features';
import {
WorktreeCreateError,
@ -168,8 +168,8 @@ export class WorktreeGitCommand extends QuickCommand {
protected async *steps(state: PartialStepState<State>): StepGenerator {
const context: Context = {
repos: Container.instance.git.openRepositories,
associatedView: Container.instance.worktreesView,
repos: this.container.git.openRepositories,
associatedView: this.container.worktreesView,
showTags: false,
title: this.title,
};

+ 2
- 2
src/views/commitsView.ts Ver fichero

@ -3,7 +3,7 @@ import { Disposable, ProgressLocation, ThemeIcon, TreeItem, TreeItemCollapsibleS
import type { CommitsViewConfig } from '../configuration';
import { configuration, ViewFilesLayout, ViewShowBranchComparison } from '../configuration';
import { Commands, ContextKeys, GlyphChars } from '../constants';
import { Container } from '../container';
import type { Container } from '../container';
import { setContext } from '../context';
import { GitUri } from '../git/gitUri';
import type { GitCommit } from '../git/models/commit';
@ -295,7 +295,7 @@ export class CommitsView extends ViewBase {
if (branch == null) return undefined;
// Check if the commit exists on the current branch
const branches = await Container.instance.git.getCommitBranches(commit.repoPath, commit.ref, {
const branches = await this.container.git.getCommitBranches(commit.repoPath, commit.ref, {
branch: branch.name,
commitDate: isCommit(commit) ? commit.committer.date : undefined,
});

+ 1
- 2
src/views/nodes/branchNode.ts Ver fichero

@ -2,7 +2,6 @@ import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleSta
import type { ViewShowBranchComparison } from '../../configuration';
import { ViewBranchesLayout } from '../../configuration';
import { Colors, GlyphChars } from '../../constants';
import { Container } from '../../container';
import type { GitUri } from '../../git/gitUri';
import type { GitBranch } from '../../git/models/branch';
import type { GitLog } from '../../git/models/log';
@ -434,7 +433,7 @@ export class BranchNode
}`;
tooltip += `\n\nLast commit ${this.branch.formatDateFromNow()} (${this.branch.formatDate(
Container.instance.BranchDateFormatting.dateFormat,
this.view.container.BranchDateFormatting.dateFormat,
)})`;
}

+ 2
- 3
src/views/nodes/tagNode.ts Ver fichero

@ -1,7 +1,6 @@
import { TreeItem, TreeItemCollapsibleState, window } from 'vscode';
import { ViewBranchesLayout } from '../../configuration';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { emojify } from '../../emojis';
import type { GitUri } from '../../git/gitUri';
import type { GitLog } from '../../git/models/log';
@ -85,13 +84,13 @@ export class TagNode extends ViewRefNode
})}${
this.tag.date != null
? `\n${this.tag.formatDateFromNow()} (${this.tag.formatDate(
Container.instance.TagDateFormatting.dateFormat,
this.view.container.TagDateFormatting.dateFormat,
)})`
: ''
}\n\n${emojify(this.tag.message)}${
this.tag.commitDate != null && this.tag.date !== this.tag.commitDate
? `\n${this.tag.formatCommitDateFromNow()} (${this.tag.formatCommitDate(
Container.instance.TagDateFormatting.dateFormat,
this.view.container.TagDateFormatting.dateFormat,
)})`
: ''
}`;

+ 5
- 5
src/views/viewCommands.ts Ver fichero

@ -10,7 +10,7 @@ import type {
import { GitActions } from '../commands/gitCommands.actions';
import { configuration, FileAnnotationType, ViewShowBranchComparison } from '../configuration';
import { Commands, ContextKeys, CoreCommands, CoreGitCommands } from '../constants';
import { Container } from '../container';
import type { Container } from '../container';
import { setContext } from '../context';
import { GitUri } from '../git/gitUri';
import type { GitStashReference } from '../git/models/reference';
@ -775,7 +775,7 @@ export class ViewCommands {
private async undoCommit(node: CommitNode | FileRevisionAsCommitNode) {
if (!(node instanceof CommitNode) && !(node instanceof FileRevisionAsCommitNode)) return;
const repo = await Container.instance.git.getOrOpenScmRepository(node.repoPath);
const repo = await this.container.git.getOrOpenScmRepository(node.repoPath);
const commit = await repo?.getCommit('HEAD');
if (commit?.hash !== node.ref.ref) {
@ -1194,16 +1194,16 @@ export class ViewCommands {
let uri = options.revisionUri;
if (uri == null) {
if (node instanceof ResultsFileNode || node instanceof MergeConflictFileNode) {
uri = Container.instance.git.getRevisionUri(node.uri);
uri = this.container.git.getRevisionUri(node.uri);
} else {
uri =
node.commit.file?.status === 'D'
? Container.instance.git.getRevisionUri(
? this.container.git.getRevisionUri(
(await node.commit.getPreviousSha()) ?? GitRevision.deletedOrMissing,
node.commit.file.path,
node.commit.repoPath,
)
: Container.instance.git.getRevisionUri(node.uri);
: this.container.git.getRevisionUri(node.uri);
}
}

Cargando…
Cancelar
Guardar