164
throw new ProtocolError(JsonRpcErrorCodes.InternalError, localize('agentHost.changeset.pr.noChanges', "There are no branch changes to create a pull request for."));
165
}
167
>
168
>
this._logService.info(`[AgentHostPullRequestOperationHandler] Pushing branch ${branchName} for session ${sessionUri}`);
169
>
const upstreamPresent = await this._gitService.hasUpstream(workingDirectory, branchName);
170
>
this._throwIfCancelled(token);
171
>
try {
172
>
await this._gitService.push(workingDirectory, { ref: branchName, setUpstream: !upstreamPresent });
173
>
} catch (err) {
174
this._throwIfCancelled(token);
175
throw new ProtocolError(JsonRpcErrorCodes.InternalError, `Failed to push branch '${branchName}': ${err instanceof Error ? err.message : String(err)}`);
176
}
178
>
179
>
const existing = await this._octoKitService.findPullRequestByHeadBranch(gitHubState.owner, gitHubState.repo, branchName, authToken, signal);
180
>
if (existing) {
181
this._throwIfCancelled(token);
182
return await this._finalize(existing, true, sessionUri, gitHubState.owner, gitHubState.repo, authToken, signal, token);