Skip to content

Commit 4550cd6

Browse files
committed
Slims Repository to use proxied GitProviderService
- Avoids reimplementing many GitProviderService methods on Repository
1 parent 630146a commit 4550cd6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+521
-629
lines changed

src/commands/closeUnchangedFiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class CloseUnchangedFilesCommand extends Command {
2727
const repository = await getRepositoryOrShowPicker('Close All Unchanged Files');
2828
if (repository == null) return;
2929

30-
const status = await this.container.git.getStatusForRepo(repository.uri);
30+
const status = await this.container.git.getStatus(repository.uri);
3131
if (status == null) {
3232
void window.showWarningMessage('Unable to close unchanged files');
3333

src/commands/copyCurrentBranch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class CopyCurrentBranchCommand extends ActiveEditorCommand {
2424
if (repository == null) return;
2525

2626
try {
27-
const branch = await repository.getBranch();
27+
const branch = await repository.git.getBranch();
2828
if (branch?.name) {
2929
await env.clipboard.writeText(branch.name);
3030
}

src/commands/createPullRequestOnRemote.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class CreatePullRequestOnRemoteCommand extends Command {
3535
if (repo == null) return;
3636

3737
if (args == null) {
38-
const branch = await repo.getBranch();
38+
const branch = await repo.git.getBranch();
3939
if (branch?.upstream == null) {
4040
void window.showErrorMessage(
4141
`Unable to create a pull request for branch \`${branch?.name}\` because it has no upstream branch`,
@@ -51,11 +51,11 @@ export class CreatePullRequestOnRemoteCommand extends Command {
5151
};
5252
}
5353

54-
const compareRemote = await repo.getRemote(args.remote);
54+
const compareRemote = await repo.git.getRemote(args.remote);
5555
if (compareRemote?.provider == null) return;
5656

5757
const providerId = compareRemote.provider.id;
58-
const remotes = (await repo.getRemotes({
58+
const remotes = (await repo.git.getRemotes({
5959
filter: r => r.provider?.id === providerId,
6060
sort: true,
6161
})) as GitRemote<RemoteProvider>[];

src/commands/diffWithRevision.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class DiffWithRevisionCommand extends ActiveEditorCommand {
6161
getState: async () => {
6262
const items: (CommandQuickPickItem | DirectiveQuickPickItem)[] = [];
6363

64-
const status = await this.container.git.getStatusForRepo(gitUri.repoPath);
64+
const status = await this.container.git.getStatus(gitUri.repoPath);
6565
if (status != null) {
6666
for (const f of status.files) {
6767
if (f.workingTreeStatus === '?' || f.workingTreeStatus === '!') {

src/commands/externalDiff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class ExternalDiffCommand extends Command {
8888
const repository = await getRepositoryOrShowPicker('Open All Changes (difftool)');
8989
if (repository == null) return undefined;
9090

91-
const status = await this.container.git.getStatusForRepo(repository.uri);
91+
const status = await this.container.git.getStatus(repository.uri);
9292
if (status == null) {
9393
return window.showInformationMessage("The repository doesn't have any changes");
9494
}

src/commands/ghpr/openOrCreateWorktree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class OpenOrCreateWorktreeCommand extends Command {
8686
const remoteUrl = remoteUri.toString();
8787
const [, remoteDomain, remotePath] = parseGitRemoteUrl(remoteUrl);
8888

89-
const remotes = await repo.getRemotes({ filter: r => r.matches(remoteDomain, remotePath) });
89+
const remotes = await repo.git.getRemotes({ filter: r => r.matches(remoteDomain, remotePath) });
9090
const remote = remotes[0] as GitRemote | undefined;
9191

9292
let addRemote: { name: string; url: string } | undefined;

src/commands/git/branch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export class BranchGitCommand extends QuickCommand {
338338
const result = yield* pickBranchOrTagStep(state, context, {
339339
placeholder: context =>
340340
`Choose a branch${context.showTags ? ' or tag' : ''} to create the new branch from`,
341-
picked: state.reference?.ref ?? (await state.repo.getBranch())?.ref,
341+
picked: state.reference?.ref ?? (await state.repo.git.getBranch())?.ref,
342342
titleContext: ' from',
343343
value: isRevisionReference(state.reference) ? state.reference.ref : undefined,
344344
});

src/commands/git/cherry-pick.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class CherryPickGitCommand extends QuickCommand<State> {
131131
}
132132

133133
if (context.destination == null) {
134-
const branch = await state.repo.getBranch();
134+
const branch = await state.repo.git.getBranch();
135135
if (branch == null) break;
136136

137137
context.destination = branch;
@@ -179,7 +179,7 @@ export class CherryPickGitCommand extends QuickCommand<State> {
179179
{ mode: 'contains' },
180180
);
181181
if (branches.length) {
182-
const branch = await state.repo.getBranch(branches[0]);
182+
const branch = await state.repo.git.getBranch(branches[0]);
183183
if (branch != null) {
184184
context.selectedBranchOrTag = branch;
185185
}

src/commands/git/log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class LogGitCommand extends QuickCommand<State> {
118118
assertStateStepRepository(state);
119119

120120
if (state.reference === 'HEAD') {
121-
const branch = await state.repo.getBranch();
121+
const branch = await state.repo.git.getBranch();
122122
state.reference = branch;
123123
}
124124

src/commands/git/merge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class MergeGitCommand extends QuickCommand<State> {
121121
}
122122

123123
if (context.destination == null) {
124-
const branch = await state.repo.getBranch();
124+
const branch = await state.repo.git.getBranch();
125125
if (branch == null) break;
126126

127127
context.destination = branch;

0 commit comments

Comments
 (0)