This commit is contained in:
tidy-dev 2021-03-30 15:48:38 -04:00
parent fe58e21158
commit c3f74f57eb
4 changed files with 12 additions and 18 deletions

View file

@ -776,7 +776,7 @@ export interface ICherryPickState {
readonly targetBranchUndoSha: string | null
/**
* Whether branch was created during cherry-pick operation
* Whether the target branch was created during cherry-pick operation
*/
readonly branchCreated: boolean
}

View file

@ -159,7 +159,7 @@ export class CherryPickFlow extends React.Component<ICherryPickFlowProps> {
const { dispatcher, repository, commits, sourceBranch } = this.props
if (this.props.step.kind !== CherryPickStepKind.CreateBranch) {
log.warn(
'[cherryPickFlow] - onBranchCreated should only be called during a create branch step.'
'[cherryPickFlow] - Invalid cherry-picking state for creating a branch.'
)
this.onFlowEnded()
return

View file

@ -106,13 +106,10 @@ export class ChooseTargetBranchDialog extends React.Component<
}
private canCherryPickOntoSelectedBranch() {
const {
selectedBranch,
isCreateBranchState: isNoBranchesState,
} = this.state
const { selectedBranch, isCreateBranchState } = this.state
return (
(selectedBranch !== null && !this.selectedBranchIsCurrentBranch()) ||
isNoBranchesState
isCreateBranchState
)
}
@ -127,12 +124,9 @@ export class ChooseTargetBranchDialog extends React.Component<
}
private renderOkButtonText() {
const {
selectedBranch,
isCreateBranchState: isNoBranchesState,
} = this.state
const { selectedBranch, isCreateBranchState } = this.state
if (isNoBranchesState) {
if (isCreateBranchState) {
return __DARWIN__
? 'Cherry-pick to New Branch'
: 'Cherry-pick to new branch'
@ -153,10 +147,10 @@ export class ChooseTargetBranchDialog extends React.Component<
}
private onFilterListResultsChanged = (resultCount: number) => {
const { isCreateBranchState: isNoBranchesState } = this.state
if (resultCount === 0 && !isNoBranchesState) {
const { isCreateBranchState } = this.state
if (resultCount === 0 && !isCreateBranchState) {
this.setState({ isCreateBranchState: true })
} else if (resultCount > 0 && isNoBranchesState) {
} else if (resultCount > 0 && isCreateBranchState) {
this.setState({ isCreateBranchState: false })
}
}
@ -209,8 +203,8 @@ export class ChooseTargetBranchDialog extends React.Component<
}
private onSubmit = async () => {
const { isCreateBranchState: isNoBranchesState, filterText } = this.state
if (isNoBranchesState) {
const { isCreateBranchState, filterText } = this.state
if (isCreateBranchState) {
this.props.onCreateNewBranch(filterText)
return
}

View file

@ -51,7 +51,7 @@ interface ICreateBranchProps {
readonly okButtonText?: string
/**
* If provided use, as the header
* If provided, use as the header
*/
readonly headerText?: string
}