nl_tokens: Flush a commit from the current branch using a driver Then update the reference and pull new workingState
pl_tokens: function flush ( repoState , driver , commitBuilder , options = { } ) { options = Object . assign ( { branch : repoState . getCurrentBranch ( ) , ignoreEmpty : true } , options ) ; if ( options . ignoreEmpty && commitBuilder . isEmpty ( ) && commitBuilder . getParents ( ) . count ( ) < 2 ) { return Q ( repoState ) ; } // Create new commit return driver . flushCommit ( commitBuilder ) // Forward the branch . then ( ( commit ) => { return driver . forwardBranch ( options . branch , commit . getSha ( ) ) // Fetch new workingState and replace old one . then ( function updateBranch ( ) { const updated = options . branch . merge ( { commit } ) ; return repoState . updateBranch ( options . branch , updated ) ; } , function nonFF ( err ) { if ( err . code === ERRORS . NOT_FAST_FORWARD ) { // Provide the created commit to allow merging it back. err . commit = commit ; } throw <mask> ; } ) ; } ) . then ( function updateWorkingState ( forwardedRepoState ) { const forwardedBranch = forwardedRepoState . getBranch ( options . branch . getFullName ( ) ) ; return RepoUtils . fetchTree ( forwardedRepoState , driver , forwardedBranch ) ; } ) ; }