sync()
Merge the released branch into the branches of its rules of sync from code, and know what was done to each branch.
Signature
ts
function sync(options?: SyncOptions): Promise<SyncResult>Options: SyncOptions. Result: SyncResult, one SyncBranchResult per branch.
Behavior
- Does what
relizy syncdoes: the branches of the rules whosefrommatches the released branch;branches,modeandfromare its--to,--sync-modeand--from. - Resolves with what was done to each branch, and with which
mode:merged,fast-forward,up-to-dateorpull-request(with itsnumberandurl,existingwhen it was already open). When no rule matches andbranchesis not given,branchesis empty. - Rejects with a
SyncErrorwhen a branch did not get the release (conflict, with itsconflictsand the commands inreason, orfailed), after the other branches are synced: itsresultholds every branch. dryRunfetches the branches and computes the merges: nothing is pushed nor opened.- In
release(), the same sync runs after the push, and a branch that does not get the release never rejects it: seesyncin theReleaseReport.
Example
ts
import { sync, SyncError } from 'relizy'
try {
const result = await sync({ branches: ['develop'] })
console.log(result.branches.map(branch => `${branch.branch}: ${branch.status}`))
}
catch (error) {
if (error instanceof SyncError) {
console.error(error.result.branches.filter(branch => branch.status === 'conflict'))
}
throw error
}