Merge pull request #16 from indiefan/master

Exposing stateWriteComplete.
Fix PhutilRemarkupEngine tests

Summary: Broken since D3336.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3381
Minor, fix an XHPAST Makefile path. See T1717.
Allow libphutil to start up in the presence of missing global functions

Summary:
See D3393.

  - When we fail to load a symbol, try to load everything else before we throw. Throw an arbitrary one of the failure(s) since it's not terribly important which one we pick.
  - When loading global functions fails, proceed anyway.

Test Plan: Removed a function, ran arc liberate, it was nuked from the library map.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3395
Support HTTPS proxies in libphutil

Summary:
When we connect via an HTTPS proxy (see detailed instructions in T1747), we get a response like this:

```
HTTP/1.0 200 Connection established

HTTP/1.1 200 OK
Normal-Http-Headers: values
More-Normal-Heders: blah

<html>actual response body</html>
```

Add code to drop these blocks when parsing responses, similar to how we drop "HTTP/1.0 100 Continue" header blocks already.

Test Plan: Followed instructions in T1747 and got normal operation with connections logged in Charles rather than unmitigated failure.

Reviewers: dreiss, vrana, btrahan

Reviewed By: dreiss

CC: aran

Maniphest Tasks: T1747

Differential Revision: https://secure.phabricator.com/D3417
Add a `writeLog()` method to PhutilConsole for writing debug/log information

Summary: Add a new console channel which we dump to stderr if `--trace` is set. In the future, we could refine this behavior.

Test Plan: Implemented the arcanist top level in terms of this; see next diff.

Reviewers: nh, vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3422
Hide option reference unless --full is passed

Summary:
A few people has voiced their opinion about the default help being to
noisy, and i agree myself. This limits the output to only show commands
+ synopses, unless you pass --full to help.

Test Plan: run a help workflow with and without --full

Reviewers: davidreuss

Reviewed By: davidreuss

CC: aran, Korvin, nh

Differential Revision: https://secure.phabricator.com/D3426
Add phutil_split_lines() for \r/\r\n/\n-aware line explosion

Summary:
We currently mishandle diffs with a mixture of \r, \n, and \r\n newlines (we discard them, but should retain them).

Add a function to correctly split a text corpus apart even if it has mixed newlines, since the regex wasn't exactly trivial.

Test Plan: Ran unit tests.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Maniphest Tasks: T866

Differential Revision: https://secure.phabricator.com/D3441
Allow getting information from a log

Summary:
In phabricator, we set data for the access log, but I want this information
to be available for use in D3458.

Test Plan: See D3458.

Reviewers: epriestley, vrana

Reviewed By: vrana

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3459
Fix lint error in XHPASTTreeTestCase

Summary: Discovered in D3461.

Test Plan:
  $ arc lint

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3462
Link libphutil test cases

Summary: See D3455.

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3461
Add `getTokenID()` to `AASTToken`

Summary: Used in D3463.

Test Plan: D3463

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3464
Add a simple directory fixture

Summary:
For T866, I want to write some tests which operate directly on a git repository. Provide a way to store such directories as tarballs and easily load/save them in tests.

This is similar to D2308 but much simpler since I don't yet have a good use case for class-bound fixtures. D2308 could be built on top of this sooner or later.

Test Plan: See next diff.

Reviewers: vrana, edward

Reviewed By: edward

CC: aran

Maniphest Tasks: T866

Differential Revision: https://secure.phabricator.com/D3439
Mark floats in printable value

Summary:
The output is confusing for `assertEqual(0, 0.0)`:

> Expected: 0
> Actual: 0

Test Plan: New test.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3475
Fix function name in exception message
Fix indenting
Move exec futures to a separate directory

Test Plan:
  $ arc liberate

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3541
Allow workflows to elect for partial parsing rather than full parsing

Summary:
This permits workflows to:

  - Delegate to sub-workflows ("help" isn't quite correct but is probably good enough).
  - Manually parse/manage raw argument vectors.

Test Plan:
  $ ./scripts/example/subworkflow.php do echo -a -b -c
  -a -b -c

Reviewers: davidreuss

Reviewed By: davidreuss

CC: aran

Differential Revision: https://secure.phabricator.com/D3552
Generalize flushing console buffer

Summary:
This generalizes concept introduced in D3543.
It helps under HPHP and it is useful also in PHP for outputs of size 1 (lower than our buffer size).

Test Plan:
  id(new PhutilArgumentParser(array('', '--recon')))->parseStandardArguments();
  echo "a";
  PhutilConsole::getConsole()->writeOut('b');

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3562
Add a method to determine console width

Summary:
I'm making `arc tasks` smarter about width-based printing for T1831 and want access to the console width to do so.

Getting it is kind of tricky without curses, which no one has. Get it to work reasonably.

Test Plan: Ran function, got correct output for my terminal.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1831

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