[llvm-dev] Getting the commit message from Phabricator

MyDeveloper Day via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 13 00:54:44 PDT 2019


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 https://reviews.llvm.org/api/differential.getcommitmessage -d
api.token=<api-token> -d revision_id=${1:1} | jq -r ".result" -

jq    - https://stedolan.github.io/jq/download/
curl - https://curl.haxx.se/download.html

MyDeveloperDay

On Mon, Mar 4, 2019 at 6:04 PM Jordan Rupprecht <rupprecht at google.com>
wrote:

> 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".
>
> On Sat, Mar 2, 2019, 2:07 AM MyDeveloper Day via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> 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 https://reviews.llvm.org
>>
>> ----------------------------
>> get_commit_message.sh
>> ----------------------------
>> echo '{ "revision_id": '${1:1}' }' | arc call-conduit --conduit-uri
>> https://reviews.llvm.org/ --conduit-token
>> <replace_with_phabricator_api_token> differential.getcommitmessage | jq
>> ".response" | sed 's/^.\(.*\).$/\1/' - | sed 's/\\n/\
>> /g' -
>> ----------------------------
>>
>> This simply pulls the commit message as json and then replaces \n with
>> newlines (there are probably better ways of doing this, I'm not a jq
>> expert!)
>>
>> Given an example review https://reviews.llvm.org/D58250
>>
>> simply run
>>
>> get_commit_message.sh D58250
>>
>> And you get all the relevant information (see below) about the
>> message,revision,reviewers, subsribers etc.. returned  (as if arc was going
>> to commit it)
>>
>> (names changed to protect the innocent)
>>
>> ---------------------------------------------------------------------------------
>> [AIX][CMake] Changes for building on AIX with XL and GCC
>>
>> Summary: In support of IBM's efforts to produce a viable C and C++ LLVM
>> compiler for AIX (ref: RFC at
>> http://lists.llvm.org/pipermail/llvm-dev/2019-February/130175.html),
>> this patch adds customizations to the CMake files in order to properly
>> invoke the host toolchain for the build on AIX. Additional changes to
>> enable a successful build will follow.
>>
>> Reviewers: john doe
>>
>> Reviewed By: jane doe,walter smith
>>
>> Subscribers: jane doe, llvm-commits
>>
>> Tags: #llvm
>>
>> Differential Revision: https://reviews.llvm.org/D58250
>>
>> ---------------------------------------------------------------------------------
>>
>> You can then copy and paste this into your commit message.
>>
>> I hope this helps..
>>
>> MyDeveloperDay
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190313/3c4a1bb7/attachment-0001.html>


More information about the llvm-dev mailing list