2011-05-23 16:42:58 +02:00
|
|
|
@title Arcanist User Guide
|
|
|
|
@group userguide
|
|
|
|
|
2012-03-22 20:06:46 +01:00
|
|
|
Guide to Arcanist, a command-line interface to Phabricator.
|
2011-05-23 16:42:58 +02:00
|
|
|
|
2012-03-22 20:06:46 +01:00
|
|
|
Arcanists provides command-line access to many Phabricator tools (like
|
|
|
|
Differential, Files, and Paste), integrates with static analysis ("lint") and
|
|
|
|
unit tests, and manages common workflows like getting changes into Differential
|
|
|
|
for review.
|
2011-05-23 16:42:58 +02:00
|
|
|
|
2015-05-31 02:07:45 +02:00
|
|
|
A detailed command reference is available by running `arc help`. This
|
2012-08-10 21:00:40 +02:00
|
|
|
document provides an overview of common workflows and installation.
|
2011-05-23 16:42:58 +02:00
|
|
|
|
|
|
|
Arcanist has technical, contributor-focused documentation here:
|
2015-07-07 22:35:57 +02:00
|
|
|
<https://secure.phabricator.com/book/arcanist/>
|
2011-05-23 16:42:58 +02:00
|
|
|
|
2012-08-10 21:00:40 +02:00
|
|
|
= Quick Start =
|
|
|
|
|
|
|
|
A quick start guide is available at @{article:Arcanist Quick Start}. It provides
|
|
|
|
a much more compact summary of how to get `arc` set up and running for a new
|
|
|
|
project. You may want to start there, and return here if you need more
|
|
|
|
information.
|
|
|
|
|
2011-05-23 16:42:58 +02:00
|
|
|
= Overview =
|
|
|
|
|
|
|
|
Arcanist is a wrapper script that sits on top of other tools (e.g.,
|
2011-08-26 02:42:16 +02:00
|
|
|
Differential, linters, unit test frameworks, git, Mercurial, and SVN) and
|
|
|
|
provides a simple command-line API to manage code review and some related
|
|
|
|
revision control operations.
|
2011-05-23 16:42:58 +02:00
|
|
|
|
2012-08-10 21:00:40 +02:00
|
|
|
For a detailed list of all available commands, run:
|
|
|
|
|
|
|
|
$ arc help
|
|
|
|
|
|
|
|
For detailed information about a specific command, run:
|
|
|
|
|
|
|
|
$ arc help <command>
|
|
|
|
|
2011-05-23 16:42:58 +02:00
|
|
|
Arcanist allows you to do things like:
|
|
|
|
|
2015-05-31 02:07:45 +02:00
|
|
|
- get detailed help about available commands with `arc help`
|
|
|
|
- send your code to Differential for review with `arc diff` (for detailed
|
2012-08-10 21:00:40 +02:00
|
|
|
instructions, see @{article:Arcanist User Guide: arc diff})
|
2015-05-31 02:07:45 +02:00
|
|
|
- show pending revision information with `arc list`
|
|
|
|
- find likely reviewers for a change with `arc cover`
|
|
|
|
- apply changes in a revision to the working copy with `arc patch`
|
|
|
|
- download a patch from Differential with `arc export`
|
|
|
|
- update Git commit messages after review with `arc amend`
|
|
|
|
- commit SVN changes with `arc commit`
|
|
|
|
- push Git and Mercurial changes with `arc land`
|
|
|
|
- view enhanced information about Git branches with `arc branch`
|
2011-05-23 16:42:58 +02:00
|
|
|
|
|
|
|
Once you've configured lint and unit test integration, you can also:
|
|
|
|
|
2015-05-31 02:07:45 +02:00
|
|
|
- check your code for syntax and style errors with `arc lint`
|
2012-08-10 21:00:40 +02:00
|
|
|
(see @{article:Arcanist User Guide: Lint})
|
2015-05-31 02:07:45 +02:00
|
|
|
- run unit tests that cover your changes with `arc unit`
|
2011-05-23 16:42:58 +02:00
|
|
|
|
2012-03-22 20:06:46 +01:00
|
|
|
Arcanist integrates with other tools:
|
|
|
|
|
2015-05-31 02:07:45 +02:00
|
|
|
- upload and download files with `arc upload` and `arc download`
|
|
|
|
- create and view pastes with `arc paste`
|
2012-03-22 20:06:46 +01:00
|
|
|
|
2011-05-23 16:42:58 +02:00
|
|
|
Arcanist has some advanced features as well, you can:
|
|
|
|
|
2015-05-31 02:07:45 +02:00
|
|
|
- execute Conduit method calls with `arc call-conduit`
|
|
|
|
- create or update libphutil libraries with `arc liberate`
|
|
|
|
- activate tab completion with `arc shell-complete`
|
2011-06-29 22:26:33 +02:00
|
|
|
- ...or extend Arcanist and add new commands.
|
2011-05-23 16:42:58 +02:00
|
|
|
|
|
|
|
Except where otherwise noted, these workflows are generally agnostic to the
|
2011-08-26 02:42:16 +02:00
|
|
|
underlying version control system and will work properly in git, Mercurial, or
|
|
|
|
SVN repositories.
|
2011-05-23 16:42:58 +02:00
|
|
|
|
|
|
|
= Installing Arcanist =
|
|
|
|
|
2012-03-22 20:06:46 +01:00
|
|
|
Arcanist is meant to be installed on your local machine or development server --
|
2013-10-25 17:58:42 +02:00
|
|
|
whatever machine you're editing code on. It runs on:
|
|
|
|
|
|
|
|
- Linux;
|
|
|
|
- Other operating systems which are pretty similar to Linux, or which
|
|
|
|
Linux is pretty similar to;
|
|
|
|
- FreeBSD, a fine operating system held in great esteem by many;
|
|
|
|
- Mac OS X (see @{article:Arcanist User Guide: Mac OS X}); and
|
|
|
|
- Windows (see @{article:Arcanist User Guide: Windows}).
|
2012-03-22 20:06:46 +01:00
|
|
|
|
|
|
|
Arcanist is written in PHP, so you need to install the PHP CLI first if you
|
|
|
|
don't already have it. Arcanist should run on PHP 5.2 and newer. If you don't
|
|
|
|
have PHP installed, you can download it from <http://www.php.net/>.
|
|
|
|
|
|
|
|
To install Arcanist, pick an install directory and clone the code from GitHub:
|
|
|
|
|
2014-06-03 18:40:16 +02:00
|
|
|
some_install_path/ $ git clone https://github.com/phacility/libphutil.git
|
|
|
|
some_install_path/ $ git clone https://github.com/phacility/arcanist.git
|
2012-03-22 20:06:46 +01:00
|
|
|
|
|
|
|
This should leave you with a directory structure like this
|
|
|
|
|
|
|
|
some_install_path/ # Wherever you chose to install it.
|
|
|
|
arcanist/ # Arcanist-specific code and libraries.
|
|
|
|
libphutil/ # A shared library Arcanist depends upon.
|
|
|
|
|
2015-05-31 02:07:45 +02:00
|
|
|
Now add `some_install_path/arcanist/bin/` to your PATH environment variable.
|
2012-03-22 20:06:46 +01:00
|
|
|
When you type "arc", you should see something like this:
|
|
|
|
|
|
|
|
Usage Exception: No command provided. Try 'arc help'.
|
|
|
|
|
|
|
|
If you get that far, you've done things correctly. If you get an error or have
|
|
|
|
trouble getting this far, see these detailed guides:
|
|
|
|
|
2012-06-15 23:02:19 +02:00
|
|
|
- On Windows: @{article:Arcanist User Guide: Windows}
|
|
|
|
- On Mac OS X: @{article:Arcanist User Guide: Mac OS X}
|
2012-03-22 20:06:46 +01:00
|
|
|
|
2012-06-15 23:02:19 +02:00
|
|
|
You can later upgrade Arcanist and libphutil to the latest versions with
|
|
|
|
`arc upgrade`:
|
2012-03-22 20:06:46 +01:00
|
|
|
|
2012-06-15 23:02:19 +02:00
|
|
|
$ arc upgrade
|
2012-03-22 20:06:46 +01:00
|
|
|
|
|
|
|
== Installing Arcanist for a Team ==
|
2011-05-23 16:42:58 +02:00
|
|
|
|
2012-08-10 21:00:40 +02:00
|
|
|
Arcanist changes quickly, so it can be something of a headache to get it
|
|
|
|
installed and keep people up to date. Here are some approaches you might be
|
|
|
|
able to use:
|
2011-05-23 16:42:58 +02:00
|
|
|
|
2012-03-22 20:06:46 +01:00
|
|
|
- Facebook does most development on development servers, which have a standard
|
|
|
|
environment and NFS mounts. Arcanist and libphutil themselves live on an
|
|
|
|
NFS mount, and the default `.bashrc` adds them to the PATH. Updating the
|
|
|
|
mount source updates everyone's versions, and new employees have a working
|
|
|
|
`arc` when they first log in.
|
|
|
|
- Another common approach is to write an install script as an action into
|
|
|
|
existing build scripts, so users can run `make install-arc` or
|
|
|
|
`ant install-arc` or similar.
|
2011-05-23 16:42:58 +02:00
|
|
|
|
|
|
|
== Installing Tab Completion ==
|
|
|
|
|
2015-05-31 02:07:45 +02:00
|
|
|
If you use `bash`, you can set up tab completion by adding something like this
|
|
|
|
to your `.bashrc`, `.profile` or similar:
|
2011-05-23 16:42:58 +02:00
|
|
|
|
|
|
|
source /path/to/arcanist/resources/shell/bash-completion
|
|
|
|
|
2013-04-20 20:44:29 +02:00
|
|
|
== Configuration ==
|
|
|
|
|
|
|
|
Some Arcanist commands can be configured. This configuration is read from
|
|
|
|
several sources:
|
|
|
|
|
|
|
|
# A customization can force any setting with
|
|
|
|
@{method@arcanist:ArcanistWorkingCopyIdentity::setRuntimeConfig}.
|
|
|
|
# User can specify settings for working copy in `arc/config` file located in
|
|
|
|
VCS directory (e.g. `.git/arc/config`) in JSON format. This file can also be
|
|
|
|
modified by running `arc set-config --local`.
|
|
|
|
# Repository can specify its config in `.arcconfig` in JSON format.
|
|
|
|
# User can specify the settings in `~/.arcrc` (JSON) through the `config` key.
|
|
|
|
This file can be modified also by `arc set-config --global`.
|
|
|
|
# Machine can specify the settings with `/etc/arcconfig` (JSON). On Windows,
|
2014-09-26 18:29:54 +02:00
|
|
|
the file path is `C:\ProgramData\Phabricator\Arcanist\config`.
|
2013-04-20 20:44:29 +02:00
|
|
|
|
|
|
|
The first place where the setting is defined wins.
|
|
|
|
|
2014-05-26 12:52:24 +02:00
|
|
|
Existing settings can be printed with `arc get-config`.
|
2013-04-20 20:44:29 +02:00
|
|
|
|
2012-04-07 19:39:51 +02:00
|
|
|
== Next Steps ==
|
2011-05-23 16:42:58 +02:00
|
|
|
|
2012-04-07 19:39:51 +02:00
|
|
|
Continue by:
|
2011-05-23 16:42:58 +02:00
|
|
|
|
2012-08-10 21:00:40 +02:00
|
|
|
- setting up a new project for use with `arc`, with
|
|
|
|
@{article:Arcanist User Guide: Configuring a New Project}; or
|
2012-04-07 19:39:51 +02:00
|
|
|
- learning how to use `arc` to send changes for review with
|
2012-04-07 19:58:46 +02:00
|
|
|
@{article:Arcanist User Guide: arc diff}.
|
2012-08-10 21:00:40 +02:00
|
|
|
|
|
|
|
Advanced topics are also available. These are detailed guides to configuring
|
|
|
|
technical features of `arc` that refine its behavior. You do not need to read
|
|
|
|
them to get it working.
|
|
|
|
|
|
|
|
- @{article:Arcanist User Guide: Commit Ranges}
|
|
|
|
- @{article:Arcanist User Guide: Lint}
|
|
|
|
- @{article:Arcanist User Guide: Customizing Existing Linters}
|
|
|
|
- @{article:Arcanist User Guide: Customizing Lint, Unit Tests and Workflows}
|
|
|
|
- @{article:Arcanist User Guide: Code Coverage}
|