Merge branch 'nwparker/term-speed-2-hidden-view-parking' into nwparker/term-speed-2-main-title-tracker
This commit is contained in:
@@ -10026,6 +10026,7 @@ export class OrcaRuntimeService {
|
||||
repoSelector: string
|
||||
name: string
|
||||
baseBranch?: string
|
||||
compareBaseRef?: string
|
||||
branchNameOverride?: string
|
||||
linkedIssue?: number | null
|
||||
linkedPR?: number | null
|
||||
@@ -10495,9 +10496,9 @@ export class OrcaRuntimeService {
|
||||
|
||||
const worktreeId = `${repo.id}::${created.path}`
|
||||
const now = Date.now()
|
||||
// Why: persisted compare refs must survive local branches whose names look
|
||||
// like remote labels, e.g. a local branch literally named "origin/main".
|
||||
const metadataBaseRef = remoteTrackingBase?.ref ?? baseBranch
|
||||
// Why: PR/MR-created worktrees can start from a head ref/SHA while Source
|
||||
// Control must compare against the review target branch.
|
||||
const metadataBaseRef = args.compareBaseRef ?? remoteTrackingBase?.ref ?? baseBranch
|
||||
const displayNameMeta = requestedDisplayName
|
||||
? { displayName: requestedDisplayName }
|
||||
: shouldSetDisplayName(effectiveRequestedName, branchName, effectiveSanitizedName)
|
||||
@@ -10799,6 +10800,7 @@ export class OrcaRuntimeService {
|
||||
args: {
|
||||
name: string
|
||||
baseBranch?: string
|
||||
compareBaseRef?: string
|
||||
branchNameOverride?: string
|
||||
linkedIssue?: number | null
|
||||
linkedPR?: number | null
|
||||
@@ -10844,6 +10846,7 @@ export class OrcaRuntimeService {
|
||||
name: args.name,
|
||||
...(args.displayName ? { displayName: args.displayName } : {}),
|
||||
...(args.baseBranch ? { baseBranch: args.baseBranch } : {}),
|
||||
...(args.compareBaseRef ? { compareBaseRef: args.compareBaseRef } : {}),
|
||||
...(args.branchNameOverride ? { branchNameOverride: args.branchNameOverride } : {}),
|
||||
...(args.runHooks ? { setupDecision: 'run' as const } : {}),
|
||||
...(!args.runHooks && args.setupDecision ? { setupDecision: args.setupDecision } : {}),
|
||||
@@ -11536,6 +11539,7 @@ export class OrcaRuntimeService {
|
||||
repoSelector: string
|
||||
prNumber: number
|
||||
headRefName?: string
|
||||
baseRefName?: string
|
||||
isCrossRepository?: boolean
|
||||
}): Promise<GitHubPrStartPoint | { error: string }> {
|
||||
if (!this.store) {
|
||||
@@ -11585,6 +11589,7 @@ export class OrcaRuntimeService {
|
||||
repoPath: repo.path,
|
||||
prNumber: args.prNumber,
|
||||
headRefName: args.headRefName,
|
||||
baseRefName: args.baseRefName,
|
||||
isCrossRepository: args.isCrossRepository,
|
||||
connectionId: repo.connectionId ?? null,
|
||||
gitExec,
|
||||
@@ -11597,8 +11602,11 @@ export class OrcaRuntimeService {
|
||||
repoSelector: string
|
||||
mrIid: number
|
||||
sourceBranch?: string
|
||||
targetBranch?: string
|
||||
isCrossRepository?: boolean
|
||||
}): Promise<{ baseBranch: string; pushTarget?: GitPushTarget } | { error: string }> {
|
||||
}): Promise<
|
||||
{ baseBranch: string; compareBaseRef?: string; pushTarget?: GitPushTarget } | { error: string }
|
||||
> {
|
||||
if (!this.store) {
|
||||
throw new Error('runtime_unavailable')
|
||||
}
|
||||
@@ -11617,6 +11625,7 @@ export class OrcaRuntimeService {
|
||||
: (gitArgs: string[]) => gitExecFileAsync(gitArgs, { cwd: repo.path })
|
||||
|
||||
let sourceBranch = args.sourceBranch?.trim() ?? ''
|
||||
let targetBranch = args.targetBranch?.trim() ?? ''
|
||||
let isCrossRepository = args.isCrossRepository === true
|
||||
|
||||
if (!sourceBranch) {
|
||||
@@ -11651,6 +11660,7 @@ export class OrcaRuntimeService {
|
||||
return { error: `MR !${args.mrIid} not found.` }
|
||||
}
|
||||
sourceBranch = (item.branchName ?? '').trim()
|
||||
targetBranch = (item.baseRefName ?? '').trim()
|
||||
if (!sourceBranch) {
|
||||
return { error: `MR !${args.mrIid} has no source branch.` }
|
||||
}
|
||||
@@ -11669,6 +11679,21 @@ export class OrcaRuntimeService {
|
||||
} catch (error) {
|
||||
return { error: error instanceof Error ? error.message : 'Could not resolve git remote.' }
|
||||
}
|
||||
const compareBaseRef = targetBranch ? `refs/remotes/${remote}/${targetBranch}` : undefined
|
||||
const fetchTargetBranch = async (): Promise<{ error: string } | null> => {
|
||||
if (!targetBranch || !compareBaseRef) {
|
||||
return null
|
||||
}
|
||||
try {
|
||||
await (sshGitProvider
|
||||
? sshGitProvider.fetchRemoteTrackingRef(repo.path, remote, targetBranch, compareBaseRef)
|
||||
: gitExec(['fetch', remote, `+refs/heads/${targetBranch}:${compareBaseRef}`]))
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
return { error: `Failed to fetch ${remote}/${targetBranch}: ${message.split('\n')[0]}` }
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
if (isCrossRepository) {
|
||||
const mrRef = `refs/merge-requests/${args.mrIid}/head`
|
||||
@@ -11690,7 +11715,11 @@ export class OrcaRuntimeService {
|
||||
if (!sha) {
|
||||
return { error: `Empty SHA resolving fork MR !${args.mrIid} head.` }
|
||||
}
|
||||
return { baseBranch: sha }
|
||||
const targetFetchError = await fetchTargetBranch()
|
||||
if (targetFetchError) {
|
||||
return targetFetchError
|
||||
}
|
||||
return { baseBranch: sha, ...(compareBaseRef ? { compareBaseRef } : {}) }
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -11710,7 +11739,15 @@ export class OrcaRuntimeService {
|
||||
} catch {
|
||||
return { error: `Remote ref ${remoteRef} does not exist after fetch.` }
|
||||
}
|
||||
return { baseBranch: remoteRef, pushTarget: { remoteName: remote, branchName: sourceBranch } }
|
||||
const targetFetchError = await fetchTargetBranch()
|
||||
if (targetFetchError) {
|
||||
return targetFetchError
|
||||
}
|
||||
return {
|
||||
baseBranch: remoteRef,
|
||||
...(compareBaseRef ? { compareBaseRef } : {}),
|
||||
pushTarget: { remoteName: remote, branchName: sourceBranch }
|
||||
}
|
||||
}
|
||||
|
||||
private async resolveGitLabIssueSourceRemote(
|
||||
|
||||
Reference in New Issue
Block a user