Getting the commit message from a review without arcanist

When committing on the command line with git you need the commit message from your review. If you don’t use arcanist and you need the commit message from the Phabricator review you can simply use this little script:

---------------- get_commit_message.sh ----------------
#!/bin/bash
curl -s -S https://reviews.llvm.org/api/differential.getcommitmessage -d api.token=<phabricator-api-token> -d revision_id=${1:1} | jq -r ".result" -

You’ll need to get yourself an api token to replace <phabricator-api-token> from your phabricator account, to do this: Select settings

image

Followed Conduit API Tokens (over on the left)

image

Then “Generate Token”

This will generate you a new api token

image

That you can copy and paste that key into the above script and run it with:

./get_commit_message.sh D12345

This will output the commit message text from the review into standard out.

$ ./get_commit_message.sh D12345
[Reassociate]: Add intermediate subtract instructions created while negating to be redone later for more reassociate opportunities

Summary:
This is tackling the same issue as in http://reviews.llvm.org/D12096. Reassociate is currently unable to simplify expressions such as (2 * b - (5 * a - 3 * b))
As David Majnemer pointed out, running reassociate twice did simplify the same.
Redoing the intermediate instructions created while breaking up a subtract (Negating) can open up more opportunities for reassociation and in this case simplifies the above expression to 5 * (b - a)


Reviewers: chandlerc, majnemer, dberlin, llvm-commits, mcrosier

Reviewed By: mcrosier

Subscribers: hfinkel, resistor, dberlin, mcrosier

Differential Revision: https://reviews.llvm.org/D12345
5 Likes

That’s handy, thanks for sharing! I might be worth adding utilities like this to the set of utilities in the repo.