phabricator

Description

This extension provides a phabsend command which sends a stack of changesets to Phabricator, and a phabread command which prints a stack of revisions in a format suitable for hg import, and a phabupdate command to update statuses in batch.

By default, Phabricator requires Test Plan which might prevent some changeset from being sent. The requirement could be disabled by changing differential.require-test-plan-field config server side.

Config:

[phabricator]
# Phabricator URL
url = https://phab.example.com/

# Repo callsign. If a repo has a URL https://$HOST/diffusion/FOO, then its
# callsign is "FOO".
callsign = FOO

# curl command to use. If not set (default), use builtin HTTP library to
# communicate. If set, use the specified curl command. This could be useful
# if you need to specify advanced options that is not easily supported by
# the internal library.
curlcmd = curl --connect-timeout 2 --retry 3 --silent

[auth]
example.schemes = https
example.prefix = phab.example.com

# API token. Get it from https://$HOST/conduit/login/
example.phabtoken = cli-xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Commands

phabread

print patches from Phabricator suitable for importing:

hg phabread DREVSPEC [OPTIONS]

DREVSPEC could be a Differential Revision identity, like D123, or just the number 123. It could also have common operators like +, -, &, (, ) for complex queries. Prefix : could be used to select a stack.

abandoned, accepted, closed, needsreview, needsrevision could be used to filter patches by status. For performance reason, they only represent a subset of non-status selections and cannot be used alone.

For example, :D6+8-(2+D4) selects a stack up to D6, plus D8 and exclude D2 and D4. :D9 & needsreview selects "Needs Review" revisions in a stack up to D9.

If --stack is given, follow dependencies information and read all patches. It is equivalent to the : operator.

Options:

--stack read dependencies
--test-vcr <VALUE>
 Path to a vcr file. If nonexistent, will record a new vcr transcript, otherwise will mock all http requests using the specified vcr file. (ADVANCED)

phabsend

upload changesets to Phabricator:

hg phabsend REV [OPTIONS]

If there are multiple revisions specified, they will be send as a stack with a linear dependencies relationship using the order specified by the revset.

For the first time uploading changesets, local tags will be created to maintain the association. After the first time, phabsend will check obsstore and tags information so it can figure out whether to update an existing Differential Revision, or create a new one.

If --amend is set, update commit messages so they have the Differential Revision URL, remove related tags. This is similar to what arcanist will do, and is more desired in author-push workflows. Otherwise, use local tags to record the Differential Revision association.

The --confirm option lets you confirm changesets before sending them. You can also add following to your configuration file to make it default behaviour:

[phabsend]
confirm = true

phabsend will check obsstore and the above association to decide whether to update an existing Differential Revision, or create a new one.

Options:

-r, --rev <REV[+]>
 revisions to send
--amend update commit messages (default: True)
--reviewer <VALUE[+]>
 specify reviewers
--confirm ask for confirmation before sending
--test-vcr <VALUE>
 Path to a vcr file. If nonexistent, will record a new vcr transcript, otherwise will mock all http requests using the specified vcr file. (ADVANCED)

[+] marked option can be specified multiple times

phabupdate

update Differential Revision in batch:

hg phabupdate DREVSPEC [OPTIONS]

DREVSPEC selects revisions. See hg help phabread for its usage.

Options:

--accept accept revisions
--reject reject revisions
--abandon abandon revisions
--reclaim reclaim revisions
-m, --comment <VALUE>
 comment on the last revision
--test-vcr <VALUE>
 Path to a vcr file. If nonexistent, will record a new vcr transcript, otherwise will mock all http requests using the specified vcr file. (ADVANCED)