Getting the commit message from Phabricator

I’m not sure if this is well known, but it helped me so I thought I’d share it with you.

When committing to gitmonorepo, (with git llvm push) you need to have committed to your local repo first and so you need to have crafted your commit message from your the Phabricator revision. (e.g. D12345)

Phabricator has the ability to give you this commit message it would have used, even if you do not use arc to perform the commit/land

This small script (attached) uses arc, jq and sed (but it can be relatively easily changed to use curl instead of arc)

You need to provide your own conduit api token in place of <replace_with_phabricator_api_token>

You can get one of these from you Profile->Setting->Conduit API Tokens in the top right hand corner of Phabricator (242 Bytes)

If you already have arc setup, then “arc amend” (or “arc amend --revision D12345”) updates the git commit message as well. I never got “arc land” working, but I use “arc diff”, “arc amend”, then “git llvm push”.

Just as a follow up for completeness, if you don’t use arc (or don’t have it installed) you can just user curl and jq with the following in a bash script passing in the DXXXX number as an argument

curl -s -S -d api.token= -d revision_id=${1:1} | jq -r “.result” -

jq -

curl -