After arc diff creates a revision in Phabricator it amends the commit to include a link to the revision in the commit message. For Mercurial this is done with hg commit --amend --logfile however this will fail when trying to create a diff for a non-head commit.
This updates ArcanistMercurialAPI::amendCommit() to allow amending a non-head commit in two ways, depending on whether evolve is in use:
No evolve:
- Rebasing the current commit onto the current commit's parent, using the new commit message
- Rebasing all children + descendants of the current commit onto the new resulting commit
- Stripping the original commit
With evolve:
- Amend the commit with hg amend --logfile
- Run hg evolve to tidy up all commits