When creating a diff using differential.createrawdiff there's no way for the created diff in Phabricator to know what base revision the diff/commit should be based on, and there's no way to modify the created diff to set that base revision. Without knowing the base revision, when patching down the diff Arcanist attempts to apply it to the working set.
Problem Description
I'm creating a Mercurial hook for a repository (not hosted by Phabricator). This hook is used to monitor commits pushed to the repository for changes to specific files. Upon identifying modifications, the hook creates a new Revision with a new Diff of only the modifications to the specific files and adds a reviewer group onto the new revision. This revision will then be reviewed (changes requested), then patched down by someone, modifications made, reviewed, landed, etc.
The issue is that when the "patched down by someone" happens, Arcanist applies the patch to the current working set instead of the parent which the original commit was made under. This will rarely be correct, and depending on the circumstance the patch will apply cleanly (i.e. not error from mercurial) which causes the diff to be applied to be incorrect.
If there is a way for the diff created by createrawdiff to have its base revision set, this would cause Arcanist to apply the patch to the appropriate changeset in the local repository.