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

2.5k views Asked by At

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?

2

There are 2 answers

1
Thomas Barthelemy On

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/

0
firfor On

the best practice is: You can prepare a template file like this. This file can be named msg.conf

${title}
Summary:
${summary_content}

修订人:
${reviewers}

订阅者:
RBA-DEV


Test Plan: 
${test_plan}

and then you can generate some content you need to fill this template and then. you can rum this command:

arc diff --create --allow-untracked --skip-binaries --message-file msg.conf origin/master