mirror of
https://github.com/desktop/desktop
synced 2024-09-19 16:12:20 +00:00
Add Conflict Flow Step
This commit is contained in:
parent
f58f6e51b3
commit
5215e27288
|
@ -11,7 +11,10 @@ export interface ICherryPickSnapshot {
|
|||
}
|
||||
|
||||
/** Union type representing the possible states of the cherry pick flow */
|
||||
export type CherryPickFlowStep = ChooseTargetBranchesStep | ShowProgressStep
|
||||
export type CherryPickFlowStep =
|
||||
| ChooseTargetBranchesStep
|
||||
| ShowProgressStep
|
||||
| ShowConflictsStep
|
||||
|
||||
export const enum CherryPickStepKind {
|
||||
/**
|
||||
|
@ -29,6 +32,15 @@ export const enum CherryPickStepKind {
|
|||
* This should be the default view when there are no conflicts to address.
|
||||
*/
|
||||
ShowProgress = 'ShowProgress',
|
||||
|
||||
/**
|
||||
* The cherry pick has encountered conflicts that need resolved. This will be
|
||||
* shown as a list of files and the conflict state.
|
||||
*
|
||||
* Once the conflicts are resolved, the user can continue the cherry pick and
|
||||
* the view will switch back to `ShowProgress`.
|
||||
*/
|
||||
ShowConflicts = 'ShowConflicts',
|
||||
}
|
||||
|
||||
/** Shape of data needed to choose the base branch for a cherry pick */
|
||||
|
@ -52,3 +64,8 @@ export type ShowProgressStep = {
|
|||
*/
|
||||
readonly action: (() => Promise<void>) | null
|
||||
}
|
||||
|
||||
/** Shape of data to show conflicts that need to be resolved by the user */
|
||||
export type ShowConflictsStep = {
|
||||
readonly kind: CherryPickStepKind.ShowConflicts
|
||||
}
|
||||
|
|
|
@ -76,6 +76,8 @@ export class CherryPickFlow extends React.Component<ICherryPickFlowProps> {
|
|||
emoji={this.props.emoji}
|
||||
/>
|
||||
)
|
||||
case CherryPickStepKind.ShowConflicts:
|
||||
return null
|
||||
default:
|
||||
return assertNever(step, 'Unknown cherry pick step found')
|
||||
}
|
||||
|
|
|
@ -2552,7 +2552,7 @@ export class Dispatcher {
|
|||
log.info(`[cherryPick] - git reset ${beforeSha} --hard`)
|
||||
}
|
||||
|
||||
/** Starts a cherry pick from commits in the revisionRange onto the target
|
||||
/** Starts a cherry pick of the commits onto the target
|
||||
* branch */
|
||||
public async cherryPick(
|
||||
repository: Repository,
|
||||
|
@ -2571,7 +2571,11 @@ export class Dispatcher {
|
|||
case CherryPickResult.CompletedWithoutError:
|
||||
await this.completeCherryPick(repository, targetBranch.name)
|
||||
break
|
||||
// TODO: handle conflicts and other handled errors
|
||||
case CherryPickResult.ConflictsEncountered:
|
||||
this.setCherryPickFlowStep(repository, {
|
||||
kind: CherryPickStepKind.ShowConflicts,
|
||||
})
|
||||
break
|
||||
default:
|
||||
this.appStore._endCherryPickFlow(repository)
|
||||
throw Error(
|
||||
|
|
Loading…
Reference in a new issue