HomePhabricator

Make corrections to the "arc amend" workflow in Mercurial repositories to be…

Description

Make corrections to the "arc amend" workflow in Mercurial repositories to be compatible with PHP 5+

Summary:
Refs T13665

In the update to D21716 the str_starts_with function was added which is only available in PHP 8. This changes it to use strncmp() which is compatible back to PHP 4.

Additionally fixed running into an error when trying to run arc amend on a commit which already matches the content known in Phabricator. Mercurial throws an error when running amend without file changes and using the exact same commit message it already has.

Test Plan:
I created a commit and revision then used hg amend -e to modify the commit message locally.
I used arc amend to update the commit message back to the appropriate message from Phabricator.
I ran arc amend again to verify that the command did not fail even though the commit message is unchanged.

I ran arc inspect --explore -- 'commit(674492bb460)' and verified it matched the appropriate commit, to verify the substring matching works properly.

Reviewers: Blessed Reviewers, epriestley

Reviewed By: Blessed Reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T13665

Differential Revision: https://secure.phabricator.com/D21723