Skip to content

Commit 3d301e5

Browse files
committed
Fix tests
1 parent b66eb6b commit 3d301e5

4 files changed

Lines changed: 10 additions & 15 deletions

File tree

src/@types/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,7 @@ declare module 'vscode' {
646646
}
647647

648648
export interface ChatRequest {
649-
readonly modeInstructions?: string;
650-
readonly modeInstructions2?: ChatRequestModeInstructions;
651-
}
652-
653-
export interface ChatRequestModeInstructions {
654-
readonly content: string;
655-
readonly toolReferences?: readonly ChatLanguageModelToolReference[];
656-
readonly metadata?: Record<string, boolean | string | number>;
649+
modeInstructions?: string;
650+
modeInstructionsToolReferences?: readonly ChatLanguageModelToolReference[];
657651
}
658652
}

src/@types/vscode.proposed.chatParticipantPrivate.d.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ declare module 'vscode' {
187187

188188
isQuotaExceeded?: boolean;
189189

190-
isRateLimited?: boolean;
191-
192190
level?: ChatErrorLevel;
193191

194192
code?: string;
@@ -241,7 +239,6 @@ declare module 'vscode' {
241239
export class ExtendedLanguageModelToolResult extends LanguageModelToolResult {
242240
toolResultMessage?: string | MarkdownString;
243241
toolResultDetails?: Array<Uri | Location>;
244-
toolMetadata?: unknown;
245242
}
246243

247244
// #region Chat participant detection

src/github/pullRequestGitHelper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ export class PullRequestGitHelper {
103103
branch = await repository.getBranch(localBranchName);
104104
// Check if local branch is pointing to the same commit as the remote
105105
if (branch.commit !== trackedBranch.commit) {
106-
Logger.debug(`Local branch ${localBranchName} commit ${branch.commit} differs from remote commit ${trackedBranch.commit}. Creating new branch to avoid overwriting user's work.`, PullRequestGitHelper.ID);
106+
Logger.appendLine(`Local branch ${localBranchName} commit ${branch.commit} differs from remote commit ${trackedBranch.commit}. Creating new branch to avoid overwriting user's work.`, PullRequestGitHelper.ID);
107107
// Instead of deleting the user's branch, create a unique branch name to avoid conflicts
108108
const uniqueBranchName = await PullRequestGitHelper.calculateUniqueBranchNameForPR(repository, pullRequest);
109-
Logger.debug(`Creating branch ${uniqueBranchName} for PR checkout`, PullRequestGitHelper.ID);
109+
Logger.appendLine(`Creating branch ${uniqueBranchName} for PR checkout`, PullRequestGitHelper.ID);
110110
progress.report({ message: vscode.l10n.t('Creating branch {0} for pull request', uniqueBranchName) });
111111
await repository.createBranch(uniqueBranchName, false, trackedBranch.commit);
112112
await repository.setBranchUpstream(uniqueBranchName, trackedBranchName);

src/test/mocks/mockRepository.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,12 @@ export class MockRepository implements Repository {
149149
return Promise.reject(new Error('Unexpected hashObject(...)'));
150150
}
151151

152+
private _hasBranch(ref: string) {
153+
return this._branches.some(b => b.name === ref);
154+
}
155+
152156
async createBranch(name: string, checkout: boolean, ref?: string | undefined): Promise<void> {
153-
if (this._branches.some(b => b.name === name)) {
157+
if (this._hasBranch(name)) {
154158
throw new Error(`A branch named ${name} already exists`);
155159
}
156160

@@ -275,7 +279,7 @@ export class MockRepository implements Repository {
275279
throw new Error(`Unexpected fetch(${remoteName}, ${ref}, ${depth})`);
276280
}
277281

278-
if (ref) {
282+
if (ref && !this._hasBranch(ref)) {
279283
const match = /^(?:\+?[^:]+\:)?(.*)$/.exec(ref);
280284
if (match) {
281285
const [, localRef] = match;

0 commit comments

Comments
 (0)