Fix parsing of "hg diff -r x:y" diffs

Summary: When you run `hg diff -r x:y`, we get two "-r" arguments in the diff header. Currently, we parse this incorrectly.

Test Plan: Added unit test which previously failed; test now passes.

Reviewers: dschleimer, btrahan

Reviewed By: dschleimer

CC: aran, cakoose

Maniphest Tasks: T1550

Differential Revision: https://secure.phabricator.com/D3061
Enrich arc configuration and add stronger typing

Summary:
See <https://github.com/facebook/arcanist/issues/45>

Currently, when the user types `arc set-config x false`, we set it as the string "false", which is usually not desirable. We have some steps toward typed config already, but expand on what we have and move as much stuff as possible into it, including all the config settings that aren't currently documented (there are still some lint-specific and project-specific settings not present here, but this is most of it).

Also make the `phutil_libraries` key a legacy name for `load`, and `immutable_history` a legacy name for `history.immutable`. Generally the goal here is to make config simpler and bring it more in-line with Git/Mercurial, which use dotted hierarchies.

I'll add some documentation here but I think most of the changes should be fairly straightforward.

Test Plan:
  - `arc set-config history.immutable on` (And similar -- sets to boolean true.)
  - `arc set-config history.immutable off` (And similar -- sets to boolean false.)
  - `arc set-config history.immutable derp` (And similar -- raises exception.)
  - `arc set-config history.immutable ''` (And similar -- removes setting value.)
  - `arc set-config --show`
  - `arc get-config`
  - `arc get-config base`

Reviewers: dschleimer, bos, btrahan, vrana

Reviewed By: dschleimer

CC: aran

Maniphest Tasks: T1546

Differential Revision: https://secure.phabricator.com/D3045
Allow hyphens in arc library names

Summary:
We've had these in our library names and they're quite useful as word
separators. Allowing them shouldn't cause any trouble.

Test Plan:
ran arc liberate in an empty directory, and it didn't complain when I gave
it a name with a hyphen.

Reviewers: epriestley, vrana, jungejason

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3070
Minor, improve behavior of arc get-config.
Added support for 'hg export' diff format

Summary: This diff format is used by de-facto mercurial GUI called "TortoiseHG".
It is available as the only way to copy diff into clipboard (right click commit,
select "export", select "copy patch". I added this format support into arcanist
so revisions in Differential can be created from TortoiseHG via simple copy-
paste. Unit test added, manually tested.

See: https://github.com/facebook/arcanist/pull/46

Reviewed by: epriestley
Include extension classes in the builtin list

Summary: Just like we ship with a list of extension functions, add a list of extension classes so people stop getting lint errors about DOMDocument just because some linter uses it.

Test Plan: Ran "arc lint".

Reviewers: vrana, btrahan, codeblock

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3082
Make arc patch show the superior error message if you are not authenticated

Summary: ...by making requireAuthentication return true if conduit is required.

Test Plan: mv ~/.arcrc ~/.arcrcbak; arc patch D12121; <verify error message>

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1522

Differential Revision: https://secure.phabricator.com/D3014
JSHint linter issue on windows

Summary: On windows there is no 'which', only 'where'

Test Plan: Run JSHint linter on windows and unix-like system.

Reviewers: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3096
Merge pull request #47 from aurelijus/master

JSHint linter issue on windows
Add mysql and mysqli functions to the phutil map whitelist

Summary: I originally excluded `mysql` these under the theory that it would be impossible to test anything without it, but `arc` doesn't need it and you could have only one of the mysql-flavored extensions without having the other one. Whitelist all the mysql and mysqli extension functions as far as depenencies are concerned.

Test Plan: @floatinglomas, let me know if this fixes things for you?

Reviewers: btrahan, vrana, floatinglomas

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D3119
Add an arc flag workflow

Summary:
Allow querying and modifying flags from arcanist. Currently
supports only printing and deleting flags for Differential revisions,
but it should be straightforward to add more capabilities (given Conduit
support).

Test Plan:
Run arc flag, passing it various revisions. Flags are
modified appropriately.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1556

Differential Revision: https://secure.phabricator.com/D3133
Use PhutilConsole in lint and unit

Test Plan:
`arc lint` with OK result and with patchable error.
`arc unit` with passes and errors.
`arc diff` with patchable lint error.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3151
Throw properly if there are uncommitted changes under Git

Summary: This was accidentally disabled with some Mercurial changes that allowed dirty working copies.

Test Plan: Ran `arc diff` with staged changes.

Reviewers: nh

Reviewed By: nh

CC: aran

Differential Revision: https://secure.phabricator.com/D3165
Merge branch 'master' of http://github.com/facebook/arcanist