Phabricator for Ubers



Phabricator for Ubers

0 2


arc-diff-for-ubers

Phabricator/arcanist presentation for Ubers

On Github sectioneight / arc-diff-for-ubers

Phabricator for Ubers

Created by Aiden Scandella

What I'll Cover

  • Arcanist, a.k.a. arc — CLI
  • Differential — Code Review
  • Maniphest — Task Integration
  • Sample workflow

What I Won't Cover

Coming from GitHub

GitHub: Pull requests (commits and branches)

Phabricator: Revisions (everything is a diff)

Why does that matter?

  • For basic usage, it doesn't

  • Instead of pushing a branch and opening a pull request, you simply run arc diff

Hello, arc

$ git checkout -b add-toaster-oven
$ emacs
$ git commit
$ arc diff

Addressing review feedback

  • Make your changes
  • Create a new commit on top of your previously reviewed change
  • Run arc diff again
  • Note the lack of force-pushing

When You Get Lost

  • When a rebase leaves you in a strange state
  • When you're working on multiple feature branches
  • Use arc which to get a sense of your surroundings
$ arc which

arc which

Updating an existing revision

  • If you lose your commit message link and your tree changes
  • Use the --update revision-id
$ arc diff --update D123

Changing what's in the diff

  • By default, looks at all local changes between your upstream branch (e.g. origin/master) and HEAD
    • Roughly equivalent to:
      $ git diff $(git merge-base origin/master HEAD)..HEAD
    • This confuses some people
  • To override, specify a base reference (branch name, SHA, symbolic ref):
    $ arc diff <base-ref>
  • We set a global default, overriding upstream behavior, like this:
    $ arc set-config base "git:merge-base(origin/master), arc:prompt"

Complex scenario

I'm working off a co-worker's topic branch feature-a, I can send just my changes up for review:

$ git fetch && git checkout feature-a
$ git checkout -b feature-b
$ emacs
$ git commit
$ arc diff feature-a

You get two knobs

  • Only two things you usually want to tweak
  • The base, which specifies where your diff begins
  • Your differential revision (e.g. D456), which can be manually specified with
    $ arc diff --update D456

In review

  • Creates or updates a diff between HEAD and your upstream branch
    • If you're going to be pushing your branches pre- code-review, I highly recommend overriding your default base
  • If it recognizes an existing revision, updates
  • Otherwise it creates a new one
  • Behavior can be overriden by using --update D123 or specifying a base-ref

What's changed for reviewers?

  • Diff between versions of a revision (my FAVORITE)
    • What's changed since the last time I looked at this?
  • More explicit actions
    • Comment
    • Request Changes ✘
    • Accept Revision ✔

Maniphest Tasks

  • Like all objects in Phabricator, you can reference T<maniphest ID> to create a bi-directional link
  • Use special 'Fixes TXXX' to automatically mark a task resolved when the revision is landed

Auto-closing tasks

And now, some tibdits

Turn down the noise

By default, you get an email from Phabricator for every action you're a part of, including actions you trigger.

To turn this off, go to your email preferences page

But I liked getting all that email...

With GitHub, you get an email for every PR and every individual comment on every repository.

With Phabricator, it's much more targeted: only reviewers and CCs are notified of new diffs and comments.

If you want to opt-in, you can set up a herald rule.

Herald in action

Where can I test this out?

$ git clone gitolite@code.uber.internal:testing
$ cd testing
$ # arc diff to your heart's content

Questions?

Cool. And now, a demo

To view these slides online, go to

sectioneight.github.io/arc-diff-for-ubers/