Make sure no one ever misunderstand the "unkonwn symbol" lint message ever again

Summary: A lot of new contributors don't resolve this. Make it easier to resolve, more comprehensive, and more explicit about not being ignorable.

Test Plan:
  >>> orbital ~/devtools/arcanist $ arc lint
  >>> Lint for src/lint/linter/ArcanistPhutilLibraryLinter.php:

     Error  (PHL1) Unknown Symbol
      Use of unknown class 'BlerpBarp'. Common causes are:

        - Your libphutil/ is out of date.
          This is the most common cause.
          Update this copy of libphutil: /INSECURE/devtools/libphutil

        - Some other library is out of date.
          Update the library this symbol appears in.

        - This symbol is misspelled.
          Spell the symbol name correctly.
          Symbol name spelling is case-sensitive.

        - This symbol was added recently.
          Run `arc liberate` on the library it was added to.

        - This symbol is external. Use `@phutil-external-symbol`.
          Use `grep` to find usage examples of this directive.

      *** ALTHOUGH USUALLY EASY TO FIX, THIS IS A SERIOUS ERROR.
      *** THIS ERROR IS YOUR FAULT. YOU MUST RESOLVE IT.

               181               "*** THIS ERROR IS YOUR FAULT. YOU MUST RESOLVE IT.");
               182
               183             if (false) {
      >>>      184               new BlerpBarp();
               185             }
               186           }
               187         }
  >>> orbital ~/devtools/arcanist $

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D7752
Make sure the local arc config directory exists on `ArcanistWorkingCopyIdentity::writeLocalArcConfig`

See: <https://github.com/facebook/arcanist/pull/126>

Reviewed by: epriestley
Parse the output of `svnlook diff ...`

Summary: Ref T4195. When figuring out changed content in SVN, the easiest approach is to use `svnlook diff`, but it has a slightly different header than we're used to. Adjust the parser for it and add some tests.

Test Plan: Clean unit tests.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4195

Differential Revision: https://secure.phabricator.com/D7790
Improve `arc lint --output summary`

Summary:
This currently output like this:

  file_a:
  file_b:
  file_c:
    Warning on line 29: blah blah

This isn't especially useful and can't be piped to other tools. Instead, emit output like:

  file_c:29:Warning: blah blah

This is greppable / pipeable.

Test Plan: Ran `arc lint --output summary`.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7788
Print a more useful error message if any PHPUnit tests crash

Summary:
Before, if PHPUnit crashed (syntax error, undefined constant, etc), you would get a relatively unhelpful error message:

    firehed@Eric-Sterns-Mac-Pro ~/dev/php-lcd: arc unit
    Exception
    Clover coverage XML report file is empty, it probably means that phpunit failed to run tests. Try running arc unit with --trace option and then run generated phpunit command yourself, you might get the answer.
    (Run with --trace for a full exception trace.)

This now checks the json and code coverage reports and tries to pull a useful error message:

  firehed@Eric-Sterns-Mac-Pro ~/dev/php-lcd: arc unit
  Exception
  The test '/Users/firehed/dev/php-lcd/tests/PlateButtonsTest.php' crashed with the following output:

  Fatal error: Undefined class constant 'EFT' in /Users/firehed/dev/php-lcd/tests/PlateButtonsTest.php on line 25

  Call Stack:
  	0.0002     233104   1. {main}() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/composer/bin/phpunit:0
  	0.0039     564872   2. PHPUnit_TextUI_Command::main() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/composer/bin/phpunit:63
  	0.0039     565496   3. PHPUnit_TextUI_Command->run() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
  	0.0247    2280168   4. PHPUnit_TextUI_TestRunner->doRun() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
  	0.0293    2730760   5. PHPUnit_Framework_TestSuite->run() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349
  	0.1211    3996832   6. PHPUnit_Framework_TestSuite->runTest() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
  	0.1211    3996832   7. PHPUnit_Framework_TestCase->run() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
  	0.1211    3996832   8. PHPUnit_Framework_TestResult->run() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
  	0.1233    3999752   9. PHPUnit_Framework_TestCase->runBare() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
  	0.1236    4016432  10. PHPUnit_Framework_TestCase->runTest() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838
  	0.1237    4017240  11. ReflectionMethod->invokeArgs() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983
  	0.1237    4017520  12. Firehed\PlateButtonsTest->testSingleButtonOnButtonDown() /Users/firehed/dev/php-lcd/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983

  (Run with --trace for a full exception trace.)

Or if nothing was written to `stderr`, you may get something like this:

  firehed@Eric-Sterns-Mac-Pro ~/dev/php-lcd: arc unit --no-coverage
  Exception
  Test Firehed\PlateButtonsTest::testSingleButtonOnButtonDown did not finish
  (Run with --trace for a full exception trace.)

Test Plan:
`arc unit` for arcanist itself
`arc unit` before and after the change on a project where:
* all tests pass
* some tests are failing
* a test causes a fatal error (undefined constant, bad method call, etc)
* a test file is invalid (syntax error)

No regressions that I could find, and all crashes now display a more useful error.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: epriestley

CC: aurelijus, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7848
Show current config and source using arc set-config --show

Summary:
`arc set-config --show` only show the user config
It would be better to contain local/global/system config

Test Plan: set config by local/global/system/user/project, and check the result of `arc set-config --show`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: epriestley

CC: epriestley, aran

Differential Revision: https://secure.phabricator.com/D7851
Recognize `ZipArchive` as an extension class

Summary: See D7879 for an example. This is an extension class.

Test Plan: You do it bwahaha

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7880
In Subversion, treat missing files similarly to conflicted files

Summary: See <https://github.com/facebook/arcanist/issues/133>. Treat "!" files like "C" and "?" files and make the user deal with them.

Test Plan:
  >>> orbital ~/repos/INIS $ svn st
  !       README
  >>> orbital ~/repos/INIS $ arc diff
  Usage Exception: You have missing files in this working copy. Revert or formally remove them (with `svn rm`) before proceeding.

    Working copy: /INSECURE/repos/INIS/

    Missing files in working copy:
      README

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7886
Allow tests to be executed in the root library directory

See: <https://github.com/facebook/arcanist/pull/135>

Reviewed by: epriestley
Allow `ArcanistLinterTestCase` to find "lint-test" files at an arbitrary depth

Summary: Self-explanatory

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7910
Allow `PhutilUnitTestEngine::getTestsForPaths` to return paths from the library root directory

Summary: Currently, running `arc unit -- src/` returns with `No tests to run`, even if there are test classes in `src/__tests__/`. This diff changes this behaviour so that `arc unit -- src/` executes unit tests in `src/__tests__/`.

Test Plan: N/A. I suppose you could create a file `src/__tests__/SomeTestCase.php` and see for yourself.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7915
Skip unit tests if `ArcanistLinter::getCacheVersion` throws an `ArcanistUsageException`

Summary: Fixes T4288

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4288

Differential Revision: https://secure.phabricator.com/D7913
Added test namespace field to `ArcanistUnitTestResult`

Summary: See https://github.com/facebook/libphutil/issues/34

Test Plan: Run `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7952
Added `ArcanistTextLinter::LINT_BOF_WHITESPACE` and `ArcanistTextLinter::LINT_EOF_WHITESPACE`

Summary: This might not be universally desireable, but I found myself writing an additional linter (which I had called `WhitespaceTextLinter`) for the sake of these two linter tests. I figured it may be of use upstream, and so I decided to submit it as a diff. I won't be offended if it is rejected however.

Test Plan: `arc lint` and `arc unit` are both okay with it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7957
Prompt user for commit message when auto-committing

See: <https://github.com/facebook/arcanist/pull/137>

Reviewed by: epriestley
Call willLintPath() hook from PhutilLinter

Summary:
Some callpaths end up here, which doesn't cause the internal linter's willLintPath() method. This can mean its `activePath` is set wrong, which results in us raising lint for the wrong file.

Particularly, if you apply D7979 (diff 18069) and `arc lint` it, you'll get a syntax error message in the wrong file.

Test Plan: Applied D7979 and linted it, got proper error message.

Reviewers: btrahan

Reviewed By: btrahan

CC: aarwine, aran

Differential Revision: https://secure.phabricator.com/D7988
Fix exception on diff parse on FreeBSD

FreeBSD 9.2 comes with diff tool version 2.8.7 which behaves
a bit different from how it is expected to. Namely for diff
between two binary files it says:

  Files A and B are differ

This was leading to an exception when browsing revisions with
changes in binary files.

Tweaked parse patterns in order to fix this issue. Now both
older and newer diff tools are supported.

See: <https://github.com/facebook/arcanist/pull/139>

Reviewed by: epriestley
Use `user.query`, not `user.find`, in `arc tasks`

Summary: I'm going to deprecate `user.find`, `user.query` is more modern/powerful and obsoletes it.

Test Plan: Ran `arc tasks --owner epriestley`.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D8070
Allow `arc` to identify repositories without "project_id"

Summary:
Ref T4343. Continues the process of reducing the prominence of Arcanist Projects. Primarily:

  - Query Phabricator to identify the working copy based on explicit configuration, or guess based on heuristics.
  - Enhance `arc which` to explain the process to the user.
  - The `project_id` key is no longer required in `.arcconfig`.

Minor/cleanup changes:

  - Rename `project_id` to `project.name` (consistency, clarity).
  - Rename `conduit_uri` to `phabricator.uri` (consistency, clairty).
  - These both need documentation updates.
  - Add `repository.callsign` to explicitly bind to a repository.
  - Updated `.arcconfig` for the new values.
  - Fix a unit test which broke a while ago when we fixed a rare definition of "unstaged".
  - Make `getRepositoryUUID()` generic so we can get rid of one `instanceof`.

Test Plan:
  - Ran `arc which`.
  - Ran `arc diff`.
  - This doesn't really change anything, so the only real risk is version compatibility breaks. This //does// introduce such a break, but the window is very narrow: if you upgrade `arc` after this commit, and try to diff against a Phabricator which was updated after yesterday (D8068) but before D8072 lands, the lookup will work so we'll add `repositoryPHID` to the `differential.creatediff` call, but it won't exist in Phabricator yet. This window is so narrow that I'm not going to try to fix it, as I'd guess there is a significant chance that no users will be affected. I don't see a clever way to fix it that doesn't involve a lot of work, either.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4343

Differential Revision: https://secure.phabricator.com/D8073
Restore "project.name" (previously "project_id") to .arcconfig for arcanist

Summary:
A couple of things actually still care about this:

  - The code that detects if we're running `arc` on `arc`, and then runs the `arc` we're running on instead of the `arc` we ran, checks for the project being "arcanist" (`reenter_if_this_is_arcanist_or_libphutil()`).
  - Some of the symbol stuff still relies on it.
  - Removing it was really more to prove it works (which it seems to) than to accomplish any concrete goals.

Test Plan: looked at the file I guess

Reviewers: btrahan, talshiri

Reviewed By: talshiri

CC: aran

Differential Revision: https://secure.phabricator.com/D8076