Skip to content

Commit d262aad

Browse files
committed
Renames branches method
1 parent e7b8dbd commit d262aad

File tree

12 files changed

+27
-27
lines changed

12 files changed

+27
-27
lines changed

src/commands/git/cherry-pick.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export class CherryPickGitCommand extends QuickCommand<State> {
173173
}
174174

175175
if (context.selectedBranchOrTag == null && state.references?.length) {
176-
const branches = await state.repo.git.branches().getBranchesForCommit(
176+
const branches = await state.repo.git.branches().getBranchesWithCommits(
177177
state.references.map(r => r.ref),
178178
undefined,
179179
{ mode: 'contains' },

src/commands/quickCommand.steps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2085,7 +2085,7 @@ async function getShowCommitOrStashStepItems<
20852085
const branch = await state.repo.git.branches().getBranch();
20862086
const [branches, published] = await Promise.all([
20872087
branch != null
2088-
? state.repo.git.branches().getBranchesForCommit([state.reference.ref], branch.name, {
2088+
? state.repo.git.branches().getBranchesWithCommits([state.reference.ref], branch.name, {
20892089
commitDate: isCommit(state.reference) ? state.reference.committer.date : undefined,
20902090
})
20912091
: undefined,

src/env/node/git/sub-providers/branches.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,24 +245,24 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
245245
}
246246

247247
@log()
248-
async getBranchesForCommit(
248+
async getBranchesWithCommits(
249249
repoPath: string,
250-
refs: string[],
250+
commits: string[],
251251
branch?: string | undefined,
252252
options?:
253253
| { all?: boolean; commitDate?: Date; mode?: 'contains' | 'pointsAt' }
254254
| { commitDate?: Date; mode?: 'contains' | 'pointsAt'; remotes?: boolean },
255255
): Promise<string[]> {
256256
if (branch != null) {
257-
const data = await this.git.branchOrTag__containsOrPointsAt(repoPath, refs, {
257+
const data = await this.git.branchOrTag__containsOrPointsAt(repoPath, commits, {
258258
type: 'branch',
259259
mode: 'contains',
260260
name: branch,
261261
});
262262
return data ? [data?.trim()] : [];
263263
}
264264

265-
const data = await this.git.branchOrTag__containsOrPointsAt(repoPath, refs, { type: 'branch', ...options });
265+
const data = await this.git.branchOrTag__containsOrPointsAt(repoPath, commits, { type: 'branch', ...options });
266266
if (!data) return [];
267267

268268
return filterMap(data.split('\n'), b => b.trim() || undefined);

src/env/node/git/sub-providers/status.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class StatusGitSubProvider implements GitStatusSubProvider {
133133
const [branchResult, mergeBaseResult, possibleSourceBranchesResult] = await Promise.allSettled([
134134
this.provider.branches.getBranch(repoPath),
135135
this.provider.branches.getMergeBase(repoPath, 'MERGE_HEAD', 'HEAD'),
136-
this.provider.branches.getBranchesForCommit(repoPath, ['MERGE_HEAD'], undefined, {
136+
this.provider.branches.getBranchesWithCommits(repoPath, ['MERGE_HEAD'], undefined, {
137137
all: true,
138138
mode: 'pointsAt',
139139
}),
@@ -224,7 +224,7 @@ export class StatusGitSubProvider implements GitStatusSubProvider {
224224
rebaseHead != null
225225
? this.provider.branches.getMergeBase(repoPath, rebaseHead, 'HEAD')
226226
: this.provider.branches.getMergeBase(repoPath, onto, origHead),
227-
this.provider.branches.getBranchesForCommit(repoPath, [onto], undefined, {
227+
this.provider.branches.getBranchesWithCommits(repoPath, [onto], undefined, {
228228
all: true,
229229
mode: 'pointsAt',
230230
}),

src/git/gitProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ export interface GitBranchesSubProvider {
388388
},
389389
): Promise<PagedResult<GitBranch>>;
390390
getBranchContributionsOverview(repoPath: string, ref: string): Promise<BranchContributionsOverview | undefined>;
391-
getBranchesForCommit(
391+
getBranchesWithCommits(
392392
repoPath: string,
393393
refs: string[],
394394
branch?: string | undefined,

src/plus/drafts/draftsService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export class DraftService implements Disposable {
257257
.branches()
258258
.getBranch()
259259
.then(b => (b != null ? [b.name] : undefined))
260-
: change.repository.git.branches().getBranchesForCommit([change.revision.to, change.revision.from]),
260+
: change.repository.git.branches().getBranchesWithCommits([change.revision.to, change.revision.from]),
261261
change.contents == null
262262
? change.repository.git.getDiff(change.revision.to, change.revision.from)
263263
: undefined,

src/plus/integrations/providers/github/github.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,8 +1267,8 @@ export class GitHubApi implements Disposable {
12671267
return { ...(commit ?? results.values[0]), viewer: results.viewer };
12681268
}
12691269

1270-
@debug<GitHubApi['getCommitBranches']>({ args: { 0: '<token>' } })
1271-
async getCommitBranches(
1270+
@debug<GitHubApi['getBranchesWithCommits']>({ args: { 0: '<token>' } })
1271+
async getBranchesWithCommits(
12721272
token: string,
12731273
owner: string,
12741274
repo: string,
@@ -1296,7 +1296,7 @@ export class GitHubApi implements Disposable {
12961296
const limit = mode === 'contains' ? 10 : 1;
12971297

12981298
try {
1299-
const query = `query getCommitBranches(
1299+
const query = `query getBranchesWithCommits(
13001300
$owner: String!
13011301
$repo: String!
13021302
$since: GitTimestamp!
@@ -1406,8 +1406,8 @@ export class GitHubApi implements Disposable {
14061406
}
14071407
}
14081408

1409-
@debug<GitHubApi['getCommitOnBranch']>({ args: { 0: '<token>' } })
1410-
async getCommitOnBranch(
1409+
@debug<GitHubApi['getBranchWithCommit']>({ args: { 0: '<token>' } })
1410+
async getBranchWithCommit(
14111411
token: string,
14121412
owner: string,
14131413
repo: string,
@@ -1433,7 +1433,7 @@ export class GitHubApi implements Disposable {
14331433
const limit = mode === 'contains' ? 100 : 1;
14341434

14351435
try {
1436-
const query = `query getCommitOnBranch(
1436+
const query = `query getBranchWithCommit(
14371437
$owner: String!
14381438
$repo: String!
14391439
$ref: String!

src/plus/integrations/providers/github/sub-providers/branches.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
266266
}
267267

268268
@log()
269-
async getBranchesForCommit(
269+
async getBranchesWithCommits(
270270
repoPath: string,
271-
refs: string[],
271+
commits: string[],
272272
branch?: string | undefined,
273273
options?:
274274
| { all?: boolean; commitDate?: Date; mode?: 'contains' | 'pointsAt' }
@@ -284,21 +284,21 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
284284
let branches;
285285

286286
if (branch) {
287-
branches = await github.getCommitOnBranch(
287+
branches = await github.getBranchWithCommit(
288288
session.accessToken,
289289
metadata.repo.owner,
290290
metadata.repo.name,
291291
branch,
292-
refs.map(stripOrigin),
292+
commits.map(stripOrigin),
293293
options?.mode ?? 'contains',
294294
options?.commitDate,
295295
);
296296
} else {
297-
branches = await github.getCommitBranches(
297+
branches = await github.getBranchesWithCommits(
298298
session.accessToken,
299299
metadata.repo.owner,
300300
metadata.repo.name,
301-
refs.map(stripOrigin),
301+
commits.map(stripOrigin),
302302
options?.mode ?? 'contains',
303303
options?.commitDate,
304304
);

src/views/branchesView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export class BranchesView extends ViewBase<'branches', BranchesViewNode, Branche
253253
// Get all the branches the commit is on
254254
const branches = await this.container.git
255255
.branches(commit.repoPath)
256-
.getBranchesForCommit(
256+
.getBranchesWithCommits(
257257
[commit.ref],
258258
undefined,
259259
isCommit(commit) ? { commitDate: commit.committer.date } : undefined,

src/views/commitsView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ export class CommitsView extends ViewBase<'commits', CommitsViewNode, CommitsVie
352352
if (branch == null) return undefined;
353353

354354
// Check if the commit exists on the current branch
355-
const branches = await branchesProvider.getBranchesForCommit([commit.ref], branch.name, {
355+
const branches = await branchesProvider.getBranchesWithCommits([commit.ref], branch.name, {
356356
commitDate: isCommit(commit) ? commit.committer.date : undefined,
357357
});
358358
if (!branches.length) return undefined;

0 commit comments

Comments
 (0)