src/utils/remote.js
function pull(repoState, driver, opts = {}) {
    opts = Object.assign({
        branch: repoState.getCurrentBranch(),
        force: false,
        remote: {
            name: 'origin'
        }
    }, opts);

    return driver.pull(opts)
    // Update branch SHA
    .then(() => {
        return driver.fetchBranches();
    })
    .then((branches) => {
        const updatedBranch = branches.find((br) => {
            return br.name === opts.branch.name;
        });
        repoState = repoState.updateBranch(opts.branch, updatedBranch);

        return RepoUtils.fetchTree(repoState, driver, updatedBranch);
    });
}
function pull(repoState, driver, opts = {}) {
    opts = Object.assign({
        branch: repoState.getCurrentBranch(),
        force: false,
        remote: {
            name: 'origin'
        }
    }, opts);

    return driver.pull(opts)
    // Update branch SHA
    .then(() => {
        return driver.fetchBranches();
    })
    .then((branches) => {
        const updatedBranch = branches.find((br) => {
            return br.name === opts.branch.name;
        });
        repoState = repoState.updateBranch(opts.branch, updatedBranch);

        return RepoUtils.fetchTree(repoState, driver, updatedBranch);
    });
}
Pulls changes for local branch, from remote repository. Loses any
pending changes on it.
@param {RepositoryState} repoState
@param {Driver} driver
@param {Branch} [opts.branch] Branch to pull. Default to current
@param {String} [opts.remote.name=origin] Name of the remote
@param {String} [opts.remote.url] URL if the remote needs to be created
@param {Boolean} [opts.force=false] Ignore non fast forward
@param {String} [opts.auth.username] Authentication username
@param {String} [opts.auth.password] Authentication password
@return {Promise<RepositoryState>}
@throws {Promise<ERROR.NOT_FAST_FORWARD>}
@throws {Promise<ERROR.AUTHENTICATION_FAILED>}
@throws {Promise<ERROR.UNKNOWN_REMOTE>}