rebase: store/restore arguments correctly
Keep and keepbranches were lost after an interruption
issue1578: fix crash: do not use synthetic changesets as merge parents.
move encoding bits from util to encoding
In addition to cleaning up util, this gets rid of some circular dependencies.