Set cherry picking progress state from snapshot

This commit is contained in:
tidy-dev 2021-02-23 15:01:44 -05:00
parent da2c827dda
commit d2ee87bfb6
2 changed files with 23 additions and 0 deletions

View file

@ -279,6 +279,7 @@ import {
cherryPick,
CherryPickResult,
continueCherryPick,
getCherryPickSnapshot,
} from '../git/cherry-pick'
const LastSelectedRepositoryIDKey = 'last-selected-repository-id'
@ -5896,6 +5897,20 @@ export class AppStore extends TypedBaseStore<IAppState> {
return result || CherryPickResult.Error
}
/** This shouldn't be called directly. See `Dispatcher`. */
public async _setCherryPickProgressFromState(repository: Repository) {
const snapshot = await getCherryPickSnapshot(repository)
if (snapshot === null) {
return
}
const { progress } = snapshot
this.repositoryStateCache.updateCherryPickState(repository, () => ({
progress,
}))
}
}
/**

View file

@ -2703,4 +2703,12 @@ export class Dispatcher {
)
}
}
/**
* Update the cherry pick progress in application state by querying the Git
* repository state.
*/
public setCherryPickProgressFromState(repository: Repository) {
return this.appStore._setCherryPickProgressFromState(repository)
}
}