Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to run arc diff in a script, without prompting for a message

Phabricator's arcanist command line tool allows you to add a "diff" for revision. This is useful because you can quickly generate a diff which your colleagues can review.

Normally, running arc diff master, for example, will prompt your for a diff message, a test plan, and some other information, and then create a diff on Phabricator.

However, I would like to run arc diff from a continuous integration server, therefore assuming yes to all questions and passing the message and test plan as an argument to the command. What I have now is:

arc diff master --allow-untracked

Still, it is assuming that it is being called from a human user, and asking for a message, which fails when called from a continuous integration server. How can skip the prompts?

like image 384
alberto56 Avatar asked Mar 15 '23 17:03

alberto56


1 Answers

I think what you are looking for is the --verbatim option. Considering the changes are committed so that it has a commit message you can run a command like:

arc diff --verbatim --reviewers xxxx --uncommitted --allow-untracked

This implies you set the Test plan to optional, else you have to specify it as well.

Finally you can also read revision info from a file using --message-file.

Another approach would be:

  1. Create a Diff (but not a rev) with arc diff --raw-command "git diff origin/master"
  2. Read the result to get the diff Id
  3. Use the createrevision conduit call as described here to create the revision:

https://secure.phabricator.com/conduit/method/differential.createrevision/

like image 186
Thomas Barthelemy Avatar answered Mar 18 '23 05:03

Thomas Barthelemy