Don't run background process with raw diff source

Test Plan:
  $ arc diff

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3553
Patch 'unix:filemode' property as 'svn:executable' in SVN

Summary: Patch created on Git contains 'unix:filemode' property which is useless in SVN.

Test Plan: Exported a bundle changing a file to executable in Git, applied it in SVN, verified that the file is executable.

Reviewers: epriestley

Reviewed By: epriestley

CC: ptarjan, aran, Korvin, digoangeline

Differential Revision: https://secure.phabricator.com/D3554
Delete flushing moved to libphutil

Test Plan:
  $ arc diff # under HPHP

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3563
Search for SVN commit in Git SVN repository

Summary: `arc patch` currently warns about "This diff is against commit svn+ssh://... but the commit is nowhere in the working copy" in Git SVN repository.

Test Plan:
  $ arc patch # in Git SVN repository
  $ svn find-rev r121212112 # invalid revision

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3539
Search for more test locations in PHPUnitTestEngine

Summary:
See https://github.com/facebook/arcanist/pull/53

  - Work correctly for directories with `%` in their name; this breaks under sprintf().
  - Search for `src/` -> `tests/` style directories.
  - Add coverage for search paths.

Test Plan:
Ran unit tests.

I don't have a working test case for PHPUnit tests, can one of you guys apply this and verify I didn't break your setups?

Reviewers: quard, aurelijus

Reviewed By: aurelijus

CC: aran

Differential Revision: https://secure.phabricator.com/D3558
Make `arc tasks` print output in a unicode-aware and console-width-aware way

Summary:
Currently, we print `arc tasks` in a console-agnostic and unicode-unaware way, so:

  - Tasks with multibyte characters get aligned incorrectly (see T1831); and
  - narrow terminals plus long task names results in a broken display.

Test Plan: Ran `arc tasks`. Will post screenshots.

Reviewers: btrahan, vrana, Korvin

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T749, T1831

Differential Revision: https://secure.phabricator.com/D3568
Amend commit after editing the message in diff

Summary:
We store the message to a scratch file.
But if I need to switch context, commit something else and then go back then I'll lose the message.
Amend the repository commit by it instead.
This also removes the annoying question "Do you want to use this message?".

Test Plan: Made an error in message, verified Git log.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3561
Improve handling of `--background` with `--base`

Summary:
Currently, we run `runDiffSetupBasics()` //after// splitting off background lint and unit tests. However, this means `--base` and any explicit revision name (like "HEAD^") will not be parsed, so the call to `getRelativeCommit()` in order to generate `arc lint --rev XXX` will fail or not work as expected, because it will ignore any arguments.

Instead, parse `--base`, explicit revisions, and other repository API arguments before doing lint and unit tests.

Test Plan:
  - Set global config for `base` to `arc:amended, git:branch-unique(origin/master)`.
  - Created a commit on master.
  - Ran `arc diff HEAD^`.
    - Before this change, the command fails with "Usage Exception: None of the rules in your 'base' configuration matched a valid commit. Adjust rules or specify which commit you want to use explicitly." when it attempts to run lint, because the `HEAD^` argument is never parsed. After
    - After this change, the command succeeds.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3574
Correctly mark patched text in lint console renderer

Summary:
Before:
`    >>> -      4 `**1**`* Copyright 2011 Facebook, Inc.`

After:
`    >>> -      4  * Copyright 201`**1**` Facebook, Inc.`

Test Plan: Rendered patchable message, multiline patchable message, unpatchable message.

Reviewers: andrewjcg, epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3604
make arc commit work on windows with multiline messages

Summary: cd && cmd won't work so use chdir; -m $multiline_message won't work so use -F $tmp_file

Test Plan: this is actually un-tested at the moment.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1617

Differential Revision: https://secure.phabricator.com/D3592
Retain newline style when generating diffs

Summary: Builds on D3441, D3440. Instead of exploding on "\r?\n" and then imploding on "\n", retain newline style throughout parsing.

Test Plan:
All unit tests pass (the parser has substantial existing coverage). These new tests pass in the git commit-by-commit test case:

  commit 176a4c2c3fd88b2d598ce41a55d9c3958be9fd2d
  Author: epriestley <git@epriestley.com>
  Date:   Wed Sep 5 14:56:08 2012 -0700

      Convert \r\n newlines to \n newlines.

  commit a73b28e139296d23ade768f2346038318b331f94
  Author: epriestley <git@epriestley.com>
  Date:   Wed Sep 5 14:55:31 2012 -0700

      Add text with \r\n newlines.

  commit 337ccec314075a2bdb4a912ef467d35d04a713e4
  Author: epriestley <git@epriestley.com>
  Date:   Wed Sep 5 14:55:13 2012 -0700

      Convert \n newlines to \r\n newlines.

  commit 6d5e64a4a7a6a036c53b1d087184cb2c70099f2c
  Author: epriestley <git@epriestley.com>
  Date:   Wed Sep 5 14:53:39 2012 -0700

      Remove tabs.

  commit 49395994a1a8a06287e40a3b318be4349e8e0288
  Author: epriestley <git@epriestley.com>
  Date:   Wed Sep 5 14:53:33 2012 -0700

      Add tabs.

  commit a5a53c424f3c2a7e85f6aee35e834c8ec5b3dbe3
  Author: epriestley <git@epriestley.com>
  Date:   Wed Sep 5 14:52:57 2012 -0700

      Add trailing newline.

  commit d53dc614090c6c7d6d023e170877d7f611f18f5a
  Author: epriestley <git@epriestley.com>
  Date:   Wed Sep 5 14:52:41 2012 -0700

      Remove trailing newline.

Previously, the newline-related tests failed.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Maniphest Tasks: T866

Differential Revision: https://secure.phabricator.com/D3442
Decrease severity of preg_quote() warning

Summary: I use it more often without second parameter than with it.

Test Plan:
Lint of:

  preg_quote('');
  preg_quote('', '/');

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3647
Write to STDERR instead of php://stderr

Summary: See D3661.

Test Plan:
  $ arc diff --raw

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1261

Differential Revision: https://secure.phabricator.com/D3662
Fix typo in comment
Add missing newline in arc export

Summary:
Hunk may be missing newline at end of file. It produces exports like this:

  lang=diff
  --- a/third-party
  +++ b/third-party
  @@ -1 +1 @@
  -/mnt/gvfs/third-party/90cb1654197e56261b1733c704b387285f36208e
  \ No newline at end of file
  +/mnt/gvfs/third-party/7097083d10d37251218531da398545658872a47a
  \ No newline at end of filediff --git a/ti/proxygen/TARGETS b/ti/proxygen/TARGETS

Test Plan:
  $ arc export --git --diff 1

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, lesliepc16

Differential Revision: https://secure.phabricator.com/D3672
Added check for no tasks returned by 'arc tasks'

Test Plan: A lot of spew before. Not so much now.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3681
Allow to push revisions to review by himself to Differential (bug T1879, change 2/2, Arcanist part)

Summary:
The 'review its own revision' check is now handled by Differential (bug T1879)

Previous behavior:
    arc threw an "You can not be a reviewer for your own revision." exception
    if an users adds itself as reviewer, even when this configuration is
    allowed on the Differential remote install's configuration.

New behavior:
    Arc doesn't check that anymore. It still will be checked by the server.

Test Plan: Tested locally pushing revisions with "arc diff" to a Phabricator server with differential.allow-self-accept at true or false with myself or not as reviewer.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1879

Differential Revision: https://secure.phabricator.com/D3674
(T1889) arc cover supports Mercurial too

Summary: improving documentation: add cover supports Mercurial

Test Plan: ./bin/arc help cover

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1889

Differential Revision: https://secure.phabricator.com/D3683
Resolve diff property updates in parallel

Summary:
I was thinking about creating a method `differential.setdiffproperties` updating all properties at once or adding 'properties' to `differential.creatediff` (better) but it will require bumping Conduit version.

This looks simpler and with similar effect.
We could postpone resolving properties more but I don't want to risk not resolving them after an error.

Test Plan:
This diff for that it works.
Benchmark: 0.55 s before, 0.25 s after (with three properties, the difference will be bigger with more).

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3689
Provide getter for test results properties in `arc diff`

Summary: We want to use them in event.

Test Plan: Will use it in event.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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