rebase: extract final changesets cleanup logic in a dedicated function
At the end of the rebase, rebased changesets are currently stripped. This
behavior will be eventually dropped in favor of obsolescence marker creation.
The main rebase function is already big and branchy enough. This changeset move
the clean-up logic in a dedicated function before we make it more complex.