This describes the Ciao code review workflow using Phabricator and Arcanist.
[git stash] # optional step, only if you have changes to tracked files git checkout master git pull origin master
arc branch T42 # alternatively: arc feature T42The 'arc branch' command creates a local git task branch and switches to it. You should name your task branch the same as the Task you are working on. If you do so, Arcanist will automatically link your Diff and the Task together.
After you finish working on the task on the Task branch, you commit the changes and start a code review:
git commit -a "commit message" # or add the files individually and commit them as: # git add FILE(s) # git commit -m "commit message" arc diffThe commit message should be a one-liner (preferable no more than 80 characters) summarizing the changes. It must begin with a tag that specifies which part of the system was changed (e.g. (tests), (core), (rtchecks), fix(lpdoc), etc.).
The 'arc diff' command will open a text editor (provided in the EDITOR environment variable) with an extended commit message template. The first line(s) should correspond to the one-liner summary entered earlier. Fill the rest of the lines with the detailed information about the changes.
The Summary and Test fields are mandatory for filling (in some cases N/A can be put into Test field iff the changes do not affect any executable code). The Summary should include a more detailed explanation in several sentences or bullet points about the new changes/fixes in the Diff. The rest of the fields (Reviewers, Subscribers, Projects) can be filled later through the web interface.
When you save the commit message in the editor and exit it, Arcanist submits the changes to the Phabricator server for review and updates your local commit to include the URL of the revision on the server.
To create such revision it is enough to execute the 'git commit' and 'arc diff' commands.
To close such revision it is enough to execute the 'arc amend' (or 'arc close-revision') and 'git push' commands.
git commit -m "new changes description"
arc diff
Arcanist will send new changes back to the server for another round of review.At the point of committing the final changes (see 'arc land' below), all commits in the differential revision will be flattened to just one commit with all the changes. The messages entered at this point are mostly for self-orientation, and the developer can go back easily to previous states of the local branch with the traditional 'git checkout' commands. See also the documentation for the 'arc diff --plan-changes' option below.
If you had to roll back your commit before submitting an updated Diff and arc lost the track of it, you can still associate it with the specific revision with:
arc diff --update <revision>Alternatively, a brand new revision can be created with:
arc diff --create
arc landIf no conflicts occur Arcanist merges the changes into master, deletes the local working branch, and pushes the changes to origin. Note that arc land can be executed for a Diff that was not accepted by any reviewer, but it is not advised to do so.
If conflicts occur, in most cases they are caused by unsuccessful merging of the commits that happened while you were working on the task. In most cases it should suffice to do the following:
# fix conflicts git commit arc landIf this does not work, a rebase can be performed before landing:
git merge --abort git fetch git rebase -i origin/master # ... fix merge conflicts git add git rebase --continue # ... fix more conflicts should they occur, until the code is synced arc land