src/utils/repo.js
function checkout(repoState, branch) {
    let _branch = branch;
    if (!(branch instanceof Branch)) {
        _branch = repoState.getBranch(branch);
        if (branch === null) {
            throw Error('Unknown branch ' + branch);
        }
    }

    if (!repoState.isFetched(_branch)) {
        throw Error('Tree for branch ' + _branch.getFullName() + ' must be fetched first');
    }
    return repoState.set('currentBranchName', _branch.getFullName());
}
function checkout(repoState, branch) {
    let _branch = branch;
    if (!(branch instanceof Branch)) {
        _branch = repoState.getBranch(branch);
        if (branch === null) {
            throw Error('Unknown branch ' + branch);
        }
    }

    if (!repoState.isFetched(_branch)) {
        throw Error('Tree for branch ' + _branch.getFullName() + ' must be fetched first');
    }
    return repoState.set('currentBranchName', _branch.getFullName());
}
Change current branch in the repository (sync). Requires to have
fetched the branch.
@param {RepositoryState} repoState
@param {Branch | String} branch Can provide the fullname of the branch instead
@return {RepositoryState}