HomePhabricator

Update ArcanistMercurialAPI to support getting the current commit ref

Description

Update ArcanistMercurialAPI to support getting the current commit ref

Summary:
Mercurial does not have an implementation for querying commit symbol hardpoints, which is what the "arc amend" workflow uses.

This provides an implementation for Mercurial as well as updating ArcanistMercurialAPI to specify the current working directory symbol as ..

Additionally removed an erroneous early return in ArcanistAmendWorkflow which prevents a check against uncommitted changes.

Fixes T13665

Test Plan:

  1. I created a diff on a Mercurial revision.
  2. I updated the revisions summary in phabricator.
  3. I ran arc amend and it successfully amended the local commit with the updated commit message.
  4. I modified a file in the repository and left the change uncommitted.
  5. I ran arc amend and verified that it reported an error due to uncommited commits.

I ran the following commands to verify that they resolved to the correct commits

  1. arc inspect --explore -- 'commit(674492bb460)' properly matched the right commit as a commit hash prefix
  2. arc inspect --explore -- 'commit(674492bb4606666d5321feb38d2a467a8733c786)' properly matched the right commit as a full commit hash
  3. arc inspect --explore -- 'commit(master)' properly matched the right commit as a bookmark
  4. arc inspect --explore -- 'commit(tip)' properly matched the right commit as a tag
  5. arc inspect --explore -- 'commit(.)' properly matched the right commit as the working directory
  6. arc inspect --explore -- 'commit(cafe)' properly matched the right commit as a commit hash prefix
  7. I created a 'cafe' bookmark on a changeset
  8. arc inspect --explore -- 'commit(cafe)' properly matched the right commit as a bookmark
  9. arc inspect --explore -- 'commit(67449)' properly matched the right commit as a revision number
  10. arc inspect --explore -- 'commit(2147483648)' properly did not match any revision (no python exception)
  11. arc inspect --explore -- 'commit(0)' properly matched the first commit

Reviewers: Blessed Reviewers, epriestley

Reviewed By: Blessed Reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T13665

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