Move code common to merge and set-commit-status commands to new base class