]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
14 years agoDon't use empty commit message in commit from `arc diff`
vrana [Mon, 19 Nov 2012 22:14:38 +0000 (14:14 -0800)]
Don't use empty commit message in commit from `arc diff`

Summary:
There was a bug in Git: https://github.com/git/git/commit/d9a935

Also fix a bug with discovering existing commits.

Test Plan:
  $ arc diff # yes
  # abort
  $ arc diff # didn't see fatal

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2025

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

14 years agomake arcanist backwards compatible with various conduit versions
Bob Trahan [Tue, 20 Nov 2012 01:32:09 +0000 (17:32 -0800)]
make arcanist backwards compatible with various conduit versions

Summary: pragmatism wins the day, though I think eventually we might want something really fancy to deal with arcanist and conduit not being up to date with respect to one another

Test Plan: php -l

Reviewers: epriestley

Reviewed By: epriestley

CC: zeeg, aran, Korvin
Maniphest Tasks: T2088

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

14 years agoReintroduce `arc diff --advice`
vrana [Mon, 19 Nov 2012 21:20:44 +0000 (13:20 -0800)]
Reintroduce `arc diff --advice`

Summary:
Some users want be stopped even if there are lint advices.

NOTE: Deleted by D3364.

Test Plan:
On diff with lint advice:

  $ arc diff --preview # advice just printed
  $ arc diff --preview --advice # excuse required

Reviewers: epriestley

Reviewed By: epriestley

CC: akramer, aran, Korvin
Differential Revision: https://secure.phabricator.com/D3982

14 years agoAllow running `arc diff` without `git commit`
vrana [Thu, 15 Nov 2012 20:33:36 +0000 (12:33 -0800)]
Allow running `arc diff` without `git commit`

Summary:
There's quite some logic in here:

- It automatically decides whether to create a new commit or amend.
- It partially respects 'default-relative-commit'.
- However if it points to a closed revision then it creates a new commit.

Resolves T2025.

Test Plan:
`arc diff` on:

- Clean committed repository.
- Dirty repository without commit since 'default-relative-commit'.
- Dirty repository with non-revision commit since 'default-relative-commit'.
- Dirty repository with revision commit since 'default-relative-commit'.
- `arc diff HEAD^` on dirty repository on top of closed revision.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2025

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

14 years agoRevert "accommodate git's diff.suppress-blank-empty=true setting (D3963)"
epriestley [Thu, 15 Nov 2012 23:47:43 +0000 (15:47 -0800)]
Revert "accommodate git's diff.suppress-blank-empty=true setting (D3963)"

Summary: Reverts D3963, which is obsoleted by D3969.

Test Plan: Straight revert.

Reviewers: vrana, jiiix, btrahan

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D3970

14 years agoAllow ArcanistDiffParser to parse `diff.suppress-blank-empty` Git diffs
epriestley [Thu, 15 Nov 2012 23:47:35 +0000 (15:47 -0800)]
Allow ArcanistDiffParser to parse `diff.suppress-blank-empty` Git diffs

Summary: See D3963. Instead, parse these diffs so they'll work with `--raw`, etc.

Test Plan:
Generated a failing diff, added it as a test case. Fixed issue. Ran test suite. Ran `arc` against it:

  $ git -c diff.suppress-blank-empty=true diff HEAD | arc diff --raw --only --conduit-uri=http://local.aphront.com:8080/
  Reading diff from stdin...
  Created a new Differential diff:
          Diff URI: http://local.aphront.com:8080/differential/diff/103/

  Included changes:
    M       things

Reviewers: vrana, jiiix, btrahan

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D3969

14 years agoaccommodate git's diff.suppress-blank-empty=true setting
Jim Meyering [Tue, 13 Nov 2012 01:34:00 +0000 (17:34 -0800)]
accommodate git's diff.suppress-blank-empty=true setting

Summary:
accommodate git's diff.suppress-blank-empty=true setting
Without this change, if you were to set diff.suppress-blank-empty=true
in your .gitconfig (as I do), then "arc diff" would always fail with the
cryptic diagnostic, "Diff Parse Exception: Found the wrong number of
hunk lines."

Test Plan:
Put this in ~/.gitconfig or .git/config
[diff]
         suppress-blank-empty = true
and run "arc lint".  It should pass.  Without this chnage,
it would fail as described above.

Reviewers: vrana, epriestley

Reviewed By: vrana

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3963

14 years agoIntroduce `arc lint --severity warning`
vrana [Fri, 9 Nov 2012 03:29:40 +0000 (19:29 -0800)]
Introduce `arc lint --severity warning`

Summary: I plan to exclude advices from our saved results.

Test Plan:
  $ arc lint src/lint/engine/PhutilLintEngine.php
  $ arc lint --severity advice src/lint/engine/PhutilLintEngine.php
  $ arc lint --severity error src/lint/engine/PhutilLintEngine.php

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2038

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

14 years agoProvide repository API method for getting changed files
vrana [Fri, 9 Nov 2012 07:26:27 +0000 (23:26 -0800)]
Provide repository API method for getting changed files

Test Plan:
  print_r($api->getChangedFiles('HEAD~36')); // Under Git.

Verified that deleted files are false.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2038

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

14 years agoProvide repository API method for getting all files
vrana [Fri, 9 Nov 2012 07:22:29 +0000 (23:22 -0800)]
Provide repository API method for getting all files

Test Plan:
  print_r(iterator_to_array($api->getAllFiles())); // Under Git.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2038

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

14 years agomake arc patch workflow preserve author commit information
Bob Trahan [Fri, 9 Nov 2012 21:36:15 +0000 (13:36 -0800)]
make arc patch workflow preserve author commit information

Summary: assumes D3917 (or something like it that populates 'author' value from conduit call) exists in production

Test Plan: stubbed out 'author' value and verified checkins as author worked

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T479

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

14 years agoArcanistBundle: fix attribution of $old_phid when building binary changes
Sergio Correia [Thu, 8 Nov 2012 19:33:28 +0000 (11:33 -0800)]
ArcanistBundle: fix attribution of $old_phid when building binary changes

Summary:
The variable $old_phid was not being set in a certain situation in
buildBinaryChange(), and that was causing the following error, during
`arc patch <revision>`:

"the patch applies to <file> (<hash>), which does not match the
current contents."

and hence it was failing to download/apply the patch.

Signed-off-by: Sergio Correia <sergio@correia.cc>
Test Plan:
I spotted the problem in a revision where I was renaming
some images, which are binary.

Reviewers: epriestley, vrana, btrahan

Reviewed By: btrahan

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3925

14 years agoPerformance improvements for linting in an HG repo.
keegancsmith [Wed, 7 Nov 2012 03:30:08 +0000 (19:30 -0800)]
Performance improvements for linting in an HG repo.

Summary:
Run `hg status` as a Future while getting the diff. Add a cache for
getRawDiffText().

Test Plan:
Run `arc lint --trace` on a HG repo and confirm that `diff` is only called once
and `status` is run in the background.

Reviewers: epriestley

Reviewed By: epriestley

CC: yliang, dpepper, aran, Korvin
Maniphest Tasks: T2016

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

14 years agoRemove getLink() from ArcanistLinterTestCase
vrana [Sat, 3 Nov 2012 01:09:38 +0000 (18:09 -0700)]
Remove getLink() from ArcanistLinterTestCase

Summary:
Installations extend this.

Another solution would be to extend `ArcanistLinterTestCase` from `ArcanistArcanistLinterTestCase` and return null in `getLink()` to avoid code duplication but I prefer clean class hierarchy.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3878

14 years agoDeclare abstract method in repository API
vrana [Wed, 7 Nov 2012 08:50:17 +0000 (00:50 -0800)]
Declare abstract method in repository API

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3911

14 years agoUnignore changes in .arc/
vrana [Tue, 6 Nov 2012 07:47:14 +0000 (23:47 -0800)]
Unignore changes in .arc/

Summary:
It's inside `.git/` for some time.
It also ignored changes in `test.arc/`.

Test Plan: None.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3900

14 years agoFix an issue where `arc diff` would loop indefinitely for a property change
epriestley [Wed, 7 Nov 2012 01:46:55 +0000 (17:46 -0800)]
Fix an issue where `arc diff` would loop indefinitely for a property change

Summary:
When we hit a diff which is missing file context, we try to pull it synthetically later. This works for moves and copies, but currently fails for property changes. Since it failed, we didn't have context, so we'd try to pull it again...

The general problem this creates is that when you mark a file "+x" without changing it, we can't show you the content in Differential. Not a huge deal. In some future diff, I'll build the content synthetically.

Adds commits to cover this behavior:

  commit 1830a13adf764b55743f7edc6066451898d8ffa4
  Author: epriestley <git@epriestley.com>
  Date:   Tue Nov 6 17:11:18 2012 -0800

      Mark koan2 +x and edit it.

  commit 8ecc728bcc9b482a9a91527ea471b04fc1a025cf
  Author: epriestley <git@epriestley.com>
  Date:   Tue Nov 6 17:08:44 2012 -0800

      Move 'text' to 'executable' and mark it +x.

  commit 39c8e7dd3914edff087a6214f0cd996ad08e5b3d
  Author: epriestley <git@epriestley.com>
  Date:   Tue Nov 6 16:36:59 2012 -0800

      Mark koan as +x.

Test Plan: Ran unit tests. Previously, they looped indefinitely. Now, they pass.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran
Differential Revision: https://secure.phabricator.com/D3909

14 years agoIgnore duplicate PEP8 lint errors in comprehensive engine
vrana [Sat, 3 Nov 2012 21:47:38 +0000 (14:47 -0700)]
Ignore duplicate PEP8 lint errors in comprehensive engine

Test Plan:
  $ arc lint a.py # with too long line

Reviewers: zeeg, epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3882

14 years agoMove conversion to dictionary inside lint message
vrana [Tue, 6 Nov 2012 04:23:38 +0000 (20:23 -0800)]
Move conversion to dictionary inside lint message

Summary: Maybe I will need it on other places.

Test Plan:
  $ arc lint --output json # on file with lint error

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3898

14 years agoTrigger bad charset lint warning only once per line
vrana [Mon, 5 Nov 2012 23:52:19 +0000 (15:52 -0800)]
Trigger bad charset lint warning only once per line

Summary:
Makes lots of noise:
{F22758}

Test Plan:
Linted file with several bad characters per line.
Linted file with one bad character per line.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3896

14 years agoFix ArcanistLinterTestCase
vrana [Mon, 5 Nov 2012 23:58:24 +0000 (15:58 -0800)]
Fix ArcanistLinterTestCase

Summary: We could also inject the value from the test case config but this is simpler.

Test Plan:
  $ arc unit src/lint/linter/ArcanistLicenseLinter.php

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2035

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

14 years agoChange severity of PEP8 errors to warnings
vrana [Sun, 4 Nov 2012 04:52:30 +0000 (21:52 -0700)]
Change severity of PEP8 errors to warnings

Summary: None of these are that serious that I would like to be informed about them on unmodified lines.

Test Plan: Linted Python file with lots of PEP8 errors, now warnings.

Reviewers: zeeg, epriestley

Reviewed By: zeeg

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3884

14 years agoDelete license headers from files
vrana [Sat, 3 Nov 2012 07:53:27 +0000 (00:53 -0700)]
Delete license headers from files

Summary:
This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory).

We are removing the headers for these reasons:

- It wastes space in editors, less code is visible in editor upon opening a file.
- It brings noise to diff of the first change of any file every year.
- It confuses Git file copy detection when creating small files.
- We don't have an explicit license header in other files (JS, CSS, images, documentation).
- Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new.

This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook).

Test Plan: Verified that the license survived only in unit tests and LICENSE file.

Reviewers: epriestley, btrahan, edward

Reviewed By: epriestley

CC: aran, Korvin, davidrecordon
Maniphest Tasks: T2035

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

14 years agoAsk for explanation for skipping lint and unit
vrana [Fri, 2 Nov 2012 05:41:00 +0000 (22:41 -0700)]
Ask for explanation for skipping lint and unit

Summary: Fixes T2023.

Test Plan:
  $ arc diff --nounit # Abort
  $ arc diff --nounit
  $ arc diff --nounit --excuse 'Move fast and break things.'

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2023

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

14 years agoSpecify config for text editors
vrana [Thu, 1 Nov 2012 18:33:58 +0000 (11:33 -0700)]
Specify config for text editors

Summary: This is sort of documentation.

Test Plan:
Used the plugin for Notepad++ with default indent of 4 spaces.
Opened file from `src/`, verified that it indents 2 spaces.
Opened file from `externals/`, verified that it indents 4 spaces.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3865

14 years agoDeclare undeclared variable in lint engine
vrana [Fri, 2 Nov 2012 19:35:09 +0000 (12:35 -0700)]
Declare undeclared variable in lint engine

Test Plan:
  $ arc lint

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3876

14 years agomodify arc diff workflow to only do amend optimization if git repository
Bob Trahan [Thu, 1 Nov 2012 23:47:08 +0000 (16:47 -0700)]
modify arc diff workflow to only do amend optimization if git repository

Summary: fix for T2011, first option in list of possible fixes

Test Plan: ...do I really have to setup mercurial with mq? :D

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2011

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

14 years agoFix copy/paste error in comment
vrana [Thu, 1 Nov 2012 23:21:12 +0000 (16:21 -0700)]
Fix copy/paste error in comment

14 years agoAdvice user to set up stripping trailing white space in editor
vrana [Thu, 1 Nov 2012 18:09:11 +0000 (11:09 -0700)]
Advice user to set up stripping trailing white space in editor

Test Plan: Triggered it.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2022

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

14 years agoFix `arc diff --raw`
epriestley [Wed, 31 Oct 2012 18:50:43 +0000 (11:50 -0700)]
Fix `arc diff --raw`

Summary: I broke this in D3750. Calling `getRepositoryAPI()` triggers a check for workflow requirement of the repository API. Instead, we should just check if we alreayd have one.

Test Plan: Ran `cat x | arc diff --raw`.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T1998

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

14 years agoRequire defining getWorkflowName()
vrana [Fri, 19 Oct 2012 18:02:46 +0000 (11:02 -0700)]
Require defining getWorkflowName()

Test Plan:
  $ arc help

Reviewers: epriestley, edward

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3742

14 years agoescape files properly in arc commit
Bob Trahan [Wed, 31 Oct 2012 01:26:58 +0000 (18:26 -0700)]
escape files properly in arc commit

Summary: turns out retina has files like image.png and image@2x.png. The latter breaks since '@' is a special command telling svn to "look for image at revision 2x.png" -- nonsensical garbage. If we add it to the end every time this error goes way.

Test Plan: touch 2@2.png; svn add '2@2@'; arc diff; <fill out form, accept commit>; arc commit -- observe commit working

Reviewers: epriestley

Reviewed By: epriestley

CC: mbishopim3, aran, Korvin
Maniphest Tasks: T1999

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

14 years agoDon't try to run didAbortWorkflow() if the user never provided a command
epriestley [Tue, 30 Oct 2012 17:44:49 +0000 (10:44 -0700)]
Don't try to run didAbortWorkflow() if the user never provided a command

Summary:
If you type `arc`, you currently get a fatal since $config isn't defined. Don't try to run the hook if we never built a config.

(We could build the config earlier and then run the hook anyway, but $workflow and $command would not be defined. It seems unlikely that executing the hook here is useful, since it affects only the case that the user types `arc` on its own.)

Test Plan: Typed `arc`. Typed `arc diff`, etc.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D3841

14 years agoPartially revert D3748
epriestley [Tue, 30 Oct 2012 14:06:05 +0000 (07:06 -0700)]
Partially revert D3748

Summary:
D3748 attempted to improve the behavior of `arc diff` when dealing with files merged from another branch, but had the side effect of marking all normal edits and deletes as adds. Revert this side effect, at least. This likely degrades the merging case, but it's comparatively rare, and editing/deleting files is very common.

I'll make an effort to fix this properly (and back it with DirectoryFixture tests) when I deal with T1947.

Test Plan: Ran `arc diff --preview` for a change that edits or removes files.

Reviewers: btrahan, vrana, svemir

Reviewed By: svemir

CC: aran
Differential Revision: https://secure.phabricator.com/D3836

14 years agoIn `arc diff`, always check that you own a revision before trying to do anything...
epriestley [Thu, 25 Oct 2012 23:27:57 +0000 (16:27 -0700)]
In `arc diff`, always check that you own a revision before trying to do anything with it

Summary:
Some users assume they can update anything, not just revisions they own (see https://github.com/facebook/arcanist/issues/54).

Currently, if you `arc patch` or `arc amend` and get a commit message, then `arc diff` for a revision you don't own, we:

  - Fail early with a very confusing message ("You can not review a revision you own!") if you are on the "Reviewers" line, until D3820.
  - Or fail very very late with a good error message, but after lint, unit and update messages.

Instead, check that you own the revision as early as we can.

Test Plan: Tried to update revisions I didn't own, got good error messages early on (with D3820).

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran
Differential Revision: https://secure.phabricator.com/D3821

14 years agoSplit paths on "diff --git" lines correctly in more cases
epriestley [Thu, 25 Oct 2012 21:46:44 +0000 (14:46 -0700)]
Split paths on "diff --git" lines correctly in more cases

Summary:
See T1973. In T1675, we addressed parsing of diffs with `--no-prefix` or custom `--src-prefix` and `--dst-prefix` flags. However, this inadvetently broke diffing of files with spaces in their names, which Git does not quote. They look like this normally:

  diff --git a/old file b/new file

Prior to D3744, we accidentally got this right by looking for the `a/` and `b/`. However, we no longer do, and instead produce nonsense results.

This problem is difficult because for files with spaces, `git diff --no-prefix` may generate an ambiguous line like:

  diff --git a b c d e f g

From this line, we have no way to deterine if this moves "a" to "b c d e f g", or "a b c d" to "e f g", or anything in between. In some diffs we have more information later on, but in some cases we do not, e.g. for binary diffs without `--binary`.

Try to get this right in as many cases as possible:

  - If there are quotes, we can unambiguously get it right. This only happens for filenames with quotes or unicode characters, however.
  - If there is exactly one space, we can unambiguously get it right.
  - Interpret the common case of `a/<anything> b/<anything>` in the most-likely-correct way again.
  - Interpret the rare case of `<anything> <that same thing>` in the most-likely-correct way.
  - Complain about any `a b c d e f g` garbage.

Test Plan: Ran unit tests. Created a diff of a file called "File With Spaces".

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran, ReturnZero
Maniphest Tasks: T1973

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

14 years agoMinor, fix obvious method name typo.
epriestley [Thu, 25 Oct 2012 20:37:56 +0000 (13:37 -0700)]
Minor, fix obvious method name typo.

Test Plan: Ran `arc export --git`.

Auditors: btrahan

14 years agoFix didAbortWorkflow() without workflow
vrana [Wed, 24 Oct 2012 19:42:18 +0000 (12:42 -0700)]
Fix didAbortWorkflow() without workflow

Summary: This is a BC break but it was introduced recently.

Test Plan:
  $ arc unit x

No more:

> Fatal error: Argument 2 passed to ArcanistConfiguration::didAbortWorkflow() must be an instance of ArcanistBaseWorkflow, null given

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3812

14 years agoDisallow using DD1 as revision ID
vrana [Wed, 24 Oct 2012 18:23:10 +0000 (11:23 -0700)]
Disallow using DD1 as revision ID

Test Plan:
  $ arc inlines --revision 1
  $ arc inlines --revision D1
  $ arc inlines --revision DD1

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3811

14 years agoRun unit on background also in waiting for confirmation with `arc diff --excuse`
vrana [Tue, 23 Oct 2012 22:21:01 +0000 (15:21 -0700)]
Run unit on background also in waiting for confirmation with `arc diff --excuse`

Test Plan: Made lint error, slept in test, verified that tests are finished when I confirm `arc diff --excuse`.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3803

14 years agoAsk for lint and unit excuses asynchronously
vrana [Mon, 22 Oct 2012 21:46:31 +0000 (14:46 -0700)]
Ask for lint and unit excuses asynchronously

Summary: This diff obsoletes D3385.

Test Plan: Made lint error, explained it, verified that unit already finished before I finished explaining (by adding `sleep(3)` to test).

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3786

14 years agoProvide a hook for aborted workflow
vrana [Tue, 16 Oct 2012 17:21:56 +0000 (10:21 -0700)]
Provide a hook for aborted workflow

Summary:
We start Sandcastle push when `arc diff` starts.
If `arc diff` throws then HHVM waits for finishing the futures.
We need to kill them sooner.

Test Plan: Will implement the hook.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3713

14 years agoFix comprehensive lint engine
vrana [Mon, 22 Oct 2012 19:47:27 +0000 (12:47 -0700)]
Fix comprehensive lint engine

14 years agoUse PhutilAggregateException to aggregate unit test exceptions
epriestley [Mon, 22 Oct 2012 18:41:33 +0000 (11:41 -0700)]
Use PhutilAggregateException to aggregate unit test exceptions

Summary: Currently, a shutdown exception ("script exited with open transactions!") overwhelms the actual test failure exception, which is the one that needs to be fixed.

Test Plan: Ran a fixture test which opens a transaction and then throws. Got diagnostically useful output after this patch.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D3780

14 years agoFix some regexp issues for parsing SVN diffs with \r\n newlines
epriestley [Mon, 22 Oct 2012 18:15:36 +0000 (11:15 -0700)]
Fix some regexp issues for parsing SVN diffs with \r\n newlines

Summary: We need to tweak a few patterns to accommodate the possibility that lines end in "\r\n".

Test Plan: Added failing unit test and made it pass.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran, mbishopim3
Maniphest Tasks: T1944

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

14 years agoAdd a large number of move/copy diff/patch tests
epriestley [Sat, 20 Oct 2012 15:43:31 +0000 (08:43 -0700)]
Add a large number of move/copy diff/patch tests

Summary: The way we represent some move/copy stuff is a bit messed up, but it mostly works, so add coverage before I mess with it.

Test Plan: Ran unit tests.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T866

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

14 years agoImprove test coverage of diff/patch generation
epriestley [Sat, 20 Oct 2012 15:43:13 +0000 (08:43 -0700)]
Improve test coverage of diff/patch generation

Summary:
We have coverage for generating patches, applying them, and making sure they reproduce the original repository state. However:

  - The code uses simplified patch generation which omits some flags like `-M` and `-C`, and generally produces less rich patches than we really produce. Instead, produce patches the same way `arc diff` does.
  - We don't test the intermediate change representation. In theory it's not too important because if we get it wrong the output should be wrong, but in practice it makes it easier to nail down issues. We can also generate less-rich patches which still apply correctly, but would prefer not to.
  - Similarly, we don't test the intermediate patch representation. This is almost entirely redundant with simply applying the patch, but easier to visualize.

Add coverage for all that stuff and fix some bugs with `-M` / `-C` patch generation that weren't caught under the simpler patch generation.

Test Plan: Ran unit tests.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T866

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

14 years agoMake ArcanistDiffParser automatically load synthetic changes if the working copy...
epriestley [Sat, 20 Oct 2012 15:42:16 +0000 (08:42 -0700)]
Make ArcanistDiffParser automatically load synthetic changes if the working copy is available

Summary: Make this harder to get wrong. Instead of requiring a separate call for synthetic data, automatically load it if we can.

Test Plan: Unit tests; `arc diff`.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T866

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

14 years agoPass key to aggregate exception
vrana [Sat, 20 Oct 2012 14:11:02 +0000 (07:11 -0700)]
Pass key to aggregate exception

Summary: This information may be quite useful.

Test Plan: Threw exception from license linter.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3764

14 years agoSet all lint paths at once
vrana [Sat, 20 Oct 2012 12:45:22 +0000 (05:45 -0700)]
Set all lint paths at once

Summary:
This code is much more readable to me.
It should also be faster as building the array at once should be faster than one by one.

Test Plan: Made license and XHPAST errors in PHP file, made spelling error in JS file.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3758

14 years agoFix lint tests after D3756
vrana [Sat, 20 Oct 2012 13:16:19 +0000 (06:16 -0700)]
Fix lint tests after D3756

Test Plan:
Threw normal exception, saw failed test.
Threw usage exception, saw skipped test.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3761

14 years agoFix two arc issues
epriestley [Sat, 20 Oct 2012 13:13:12 +0000 (06:13 -0700)]
Fix two arc issues

Summary:
  - I caused $parser to be reused in D3732 which I belived was safe, but actually isn't. We end up writing to the same changes. We should make it safe but there's some mess in Phabricator that needs to be cleaned up first.
  - One minor error code thing, variable is undefined.

Test Plan: Ran `arc export --git` on a moved file, got a better result. Ran some command which made me hit the other case and didn't get a fatal anymore.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran
Differential Revision: https://secure.phabricator.com/D3749

14 years agoFix ArcanistSingleLintEngine for deleted paths
epriestley [Sat, 20 Oct 2012 13:12:24 +0000 (06:12 -0700)]
Fix ArcanistSingleLintEngine for deleted paths

Summary:
Currently, ArcanisSingleLintEngine lints deleted paths and directories. These are sometimes appropriate, but SingleLintEngine is a less-sophisticated linter and should have more safe defaults.

Also fix an error where JSHint reported useless messages on failure.

Test Plan:
Reproduced the problem:

  $ git show
  commit d71efe2b13770c8861bcd3415c15503fc377339f
  Author: epriestley <git@epriestley.com>
  Date:   Fri Oct 19 12:22:50 2012 -0700

      WIP

  diff --git a/test.js b/test.js
  deleted file mode 100644
  index 8bd6648..0000000
  --- a/test.js
  +++ /dev/null
  @@ -1 +0,0 @@
  -asdf
  $ arc set-config --local lint.engine.single.linter ArcanistJSHintLinter
  Set key 'lint.engine.single.linter' = "ArcanistJSHintLinter" in local config (was null).
  $ arc lint --engine ArcanistSingleLintEngine --rev HEAD^
  Usage Exception: JSHint returned output we can't parse. Check that your JSHint installation.
  Output:

Applied the error message fix:

  $ arc lint --engine ArcanistSingleLintEngine --rev HEAD^
  Usage Exception: JSHint returned unparseable output.
  stdout:

  stderr:

  node.js:181
          throw e; // process.nextTick error, or 'error' event on first tick
          ^
  Error: ENOENT, No such file or directory '/INSECURE/repos/git-working-copy/test.js'
      at Object.statSync (fs.js:400:18)
      at _collect (/usr/lib/node_modules/jshint/lib/hint.js:77:12)
      at /usr/lib/node_modules/jshint/lib/hint.js:93:13
      at Array.forEach (native)
      at Object.hint (/usr/lib/node_modules/jshint/lib/hint.js:92:17)
      at Object.interpret (/usr/lib/node_modules/jshint/lib/cli.js:137:21)
      at Object.<anonymous> (/usr/lib/node_modules/jshint/bin/hint:2:25)
      at Module._compile (module.js:420:26)
      at Object..js (module.js:426:10)
      at Module.load (module.js:336:31)

Applied the remove paths fix:

  $ arc lint --engine ArcanistSingleLintEngine --rev HEAD^
  Usage Exception: No paths are lintable.

Reviewers: magazovski, btrahan, vrana

Reviewed By: btrahan

CC: aran, Korvin, vissi
Differential Revision: https://secure.phabricator.com/D3735

14 years agoPrint lint results before throwing
vrana [Sat, 20 Oct 2012 11:42:53 +0000 (04:42 -0700)]
Print lint results before throwing

Summary:
When some linter throws then we don't print any result.
This is bad in case when the linter threw e.g. because of syntax error in some file which some other linter will tell us about.

Test Plan: Threw from a linter, made lint error in a file, saw error then exception.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3756

14 years agoTreat a file merged from another svn branch as an addition
Svemir Brkic [Fri, 19 Oct 2012 22:55:02 +0000 (15:55 -0700)]
Treat a file merged from another svn branch as an addition

Summary:
After a reintegration merge, "Copied From URL" will be different and current approach will result in a wrong path. If the path does not match, just mark it as a new file.

moved the comment before if so lines stay at 80 chars

Test Plan: in trunk, svn merge --reintegrate ^/branches/foo and arc diff - without this change it will say "Copied from es/foo/..."

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3748

14 years agoMake parser more flexible in the face of Git diff prefix flags
epriestley [Fri, 19 Oct 2012 21:07:34 +0000 (14:07 -0700)]
Make parser more flexible in the face of Git diff prefix flags

Summary: See T1675 for discussion. We currently strip `[abicwo12]/` from Git patches, but the user can provide arbitrary prefixes with `--src-prefix` and `--dst-prefix`, or strip prefixes entirely with `--no-prefix`. In these cases, trust they know what they're doing rather than rejecting the diff.

Test Plan: Added a bunch of tests. We have existing tests for `diff.mnemonicprefix` and normal prefixes.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T1675

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

14 years agoDon't unset linted paths from subdirectory and in commit hook mode
vrana [Fri, 19 Oct 2012 19:50:38 +0000 (12:50 -0700)]
Don't unset linted paths from subdirectory and in commit hook mode

Summary: D3737#6

Test Plan:
  phabricator/src/ $ arc lint __phutil_library_init__.php

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3746

14 years agoSupport --nobranch when not currently on a branch
Edward Speyer [Fri, 19 Oct 2012 19:12:57 +0000 (12:12 -0700)]
Support --nobranch when not currently on a branch

Summary:
This is horrible and git specific, but fixes a case where people are using "arc
patch --nobranch ..." when they're not currently on a branch.

The old code assumed you were on a branch and used getBranchName() to record
this, in order to return to that branch later and cherry-pick the patch.

When not on a branch, and using arc patch --nobranch, this was trying to return
to the branch '(no branch)'.

Now, I detect that we're not on a branch and just record what HEAD is instead.

Test Plan:
Checkout the SHA of master (so I'm on master, but not on a branch) then try to
patch it with a feature diff:

  € git checkout e7a3ec68159d6847372cab5ad913f2f15aa7c249
  Warning: you are leaving 1 commit behind, not connected to
  any of your branches:

    ac1ad39 Updating a-file

  If you want to keep them by creating a new branch, this may be a good time
  to do so with:

   git branch new_branch_name ac1ad392350a51edd10343f12b9713f5e5b3707c

  HEAD is now at e7a3ec6... Fix arcconfig

  € arc patch --nobranch D7
  Created and checked out branch arcpatch-D7.
   OKAY  Successfully committed patch.

  € git branch
  * (no branch)
    feature
    haddock
    master

  € git log --oneline | head -2
  38c0235 Updating a-file
  e7a3ec6 Fix arcconfig

Reviewers: vrana, epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3743

14 years agoDon't lint file content of directories
vrana [Thu, 18 Oct 2012 21:17:29 +0000 (14:17 -0700)]
Don't lint file content of directories

Summary: This also changes how we treat `@generated` and `@nolint` - after this diff, we will still lint their path.

Test Plan:
Created directory `a.php` and symlink `b.php` pointing to directory.
`arc lint` previously printed:

> Requested path `/data/users/jakubv/devtools/arcanist/_.php' is not a file.

Now it prints:

> No lint warnings.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3737

14 years agoTemporarily unrequire defining getWorkflowName()
vrana [Fri, 19 Oct 2012 17:38:34 +0000 (10:38 -0700)]
Temporarily unrequire defining getWorkflowName()

Summary:
We need to run new Arcanist over old code in Perflab.
We also need to run new Arcanist over new code (with already deleted custom `buildAllWorkflows()`).

This will work because old code overwrites `buildAllWorkflows()`.

Test Plan:
  $ arc help
  $ arc help # after deleting getWorkflowName() from one workflow

Reviewers: edward, epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3741

14 years agoRequire defining workflows' synopses and help
vrana [Fri, 19 Oct 2012 16:50:56 +0000 (09:50 -0700)]
Require defining workflows' synopses and help

Test Plan: Deleted `getCommandSynopses()` from workflow, ran `arc help`.

Reviewers: epriestley, edward

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3739

14 years agoImprove `arc` handling of various binary file operations in Git
epriestley [Fri, 19 Oct 2012 17:10:25 +0000 (10:10 -0700)]
Improve `arc` handling of various binary file operations in Git

Summary:
See T866, D3521. Additional things this fixes:

  - `arc export` now exports binary data correctly.
  - `ArcanistBundle` unit tests now load and apply binary data correctly.
  - `arc patch` no longer relies on `base` configuration.
  - Adds tests to the tarball:

  commit df340e88d8aba12e8f2b8827f01f0cd9f35eb758
  Author: epriestley <git@epriestley.com>
  Date:   Wed Oct 17 15:46:11 2012 -0700

      Remove binary image.

  commit 3f5c6d735e64c25a04f83be48ef184b25b5282f0
  Author: epriestley <git@epriestley.com>
  Date:   Wed Oct 17 15:45:58 2012 -0700

      Copy binary image.

  commit b454edb3bb29890ee5b3af5ef66ce6a24d15d882
  Author: epriestley <git@epriestley.com>
  Date:   Wed Oct 17 15:45:35 2012 -0700

      Move binary image.

  commit 5de5f3dfda1b7db2eb054e57699f05aaf1f4483e
  Author: epriestley <git@epriestley.com>
  Date:   Wed Oct 17 15:45:09 2012 -0700

      Add a binary image.

Test Plan: Ran unit tests, `arc patch`, `arc export`, `arc diff`, `arc upgrade`.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T866

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

14 years agoMake Arcanist workflow names explicit
epriestley [Wed, 17 Oct 2012 15:35:03 +0000 (08:35 -0700)]
Make Arcanist workflow names explicit

Summary:
Currently, adding a new workflow requires you to override ArcanistConfiguration, which is messy. Instead, just load everything that extends ArcanistBaseWorkflow.

Remove all the rules tying workflow names to class names through arcane incantations.

This has a very small performance cost in that we need to load every Workflow class every time now, but we don't hit __init__ and such anymore and it was pretty negligible on my machine (98ms vs 104ms or something).

Test Plan: Ran "arc help", "arc which", "arc diff", etc.

Reviewers: edward, vrana, btrahan

Reviewed By: edward

CC: aran, zeeg
Differential Revision: https://secure.phabricator.com/D3691

14 years agoUse git-cherry-pick for arc patch
Edward Speyer [Tue, 16 Oct 2012 23:46:21 +0000 (16:46 -0700)]
Use git-cherry-pick for arc patch

Summary:
This changes what --nobranch does, though not what it means.  In git, the patch
is applied to the git commit it is based off where it will commit cleanly, and
if you specify --nobranch then arc-patch will then switch back to your original
branch and try to cherry-pick the commit there.

If this fails, you end up with merge-conflict markers in the file which can be
handy.

Test Plan: https://secure.phabricator.com/P572

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3712

14 years agoDon't pull message twice from Conduit in `arc diff`
vrana [Tue, 16 Oct 2012 18:51:15 +0000 (11:51 -0700)]
Don't pull message twice from Conduit in `arc diff`

Summary:
We currently pull message from Conduit twice in `arc diff` update.
Once in `buildCommitMessage()` and once in `buildRevisionFromCommitMessage()`.
Remeber that we already pulled it (and so it is authoritative) to save this call.

Even faster solution would be to not pull and update the message at all in common (non-`--edit`, non-`--verbatim` and such) update workflows but it's more involved.

Test Plan:
  $ arc diff --trace

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3716

14 years agoFix typo in comment
vrana [Tue, 16 Oct 2012 17:01:35 +0000 (10:01 -0700)]
Fix typo in comment

14 years agoFix parsing of PHPUnit JSON log format for PHPUnit 3.7.7
Stanislav Vorobyev [Mon, 15 Oct 2012 10:47:01 +0000 (14:47 +0400)]
Fix parsing of PHPUnit JSON log format for PHPUnit 3.7.7

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

Reviewed by: epriestley

14 years agoProvide getter for test results properties in `arc diff`
vrana [Fri, 12 Oct 2012 22:21:00 +0000 (15:21 -0700)]
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

14 years agoResolve diff property updates in parallel
vrana [Fri, 12 Oct 2012 22:01:19 +0000 (15:01 -0700)]
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

14 years ago(T1889) arc cover supports Mercurial too
Dereckson [Fri, 12 Oct 2012 14:41:20 +0000 (07:41 -0700)]
(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

14 years agoAllow to push revisions to review by himself to Differential (bug T1879, change 2...
Dereckson [Fri, 12 Oct 2012 14:40:53 +0000 (07:40 -0700)]
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

14 years agoAdded check for no tasks returned by 'arc tasks'
David Reuss [Thu, 11 Oct 2012 19:39:35 +0000 (12:39 -0700)]
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

14 years agoAdd missing newline in arc export
vrana [Wed, 10 Oct 2012 00:11:41 +0000 (17:11 -0700)]
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

14 years agoFix typo in comment
vrana [Tue, 9 Oct 2012 23:39:48 +0000 (16:39 -0700)]
Fix typo in comment

14 years agoWrite to STDERR instead of php://stderr
vrana [Mon, 8 Oct 2012 23:23:49 +0000 (16:23 -0700)]
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

14 years agoDecrease severity of preg_quote() warning
vrana [Fri, 5 Oct 2012 23:32:06 +0000 (16:32 -0700)]
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

14 years agoRetain newline style when generating diffs
epriestley [Wed, 3 Oct 2012 22:32:03 +0000 (15:32 -0700)]
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

14 years agomake arc commit work on windows with multiline messages
Bob Trahan [Wed, 3 Oct 2012 21:54:43 +0000 (14:54 -0700)]
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

14 years agoCorrectly mark patched text in lint console renderer
vrana [Wed, 3 Oct 2012 19:27:33 +0000 (12:27 -0700)]
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

14 years agoImprove handling of `--background` with `--base`
epriestley [Tue, 2 Oct 2012 18:01:49 +0000 (11:01 -0700)]
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

14 years agoAmend commit after editing the message in diff
vrana [Fri, 28 Sep 2012 18:49:04 +0000 (11:49 -0700)]
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

14 years agoMake `arc tasks` print output in a unicode-aware and console-width-aware way
epriestley [Mon, 1 Oct 2012 02:40:54 +0000 (19:40 -0700)]
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

14 years agoSearch for more test locations in PHPUnitTestEngine
epriestley [Sun, 30 Sep 2012 01:03:43 +0000 (18:03 -0700)]
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

14 years agoSearch for SVN commit in Git SVN repository
vrana [Fri, 21 Sep 2012 21:02:27 +0000 (14:02 -0700)]
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

14 years agoDelete flushing moved to libphutil
vrana [Fri, 28 Sep 2012 16:45:11 +0000 (09:45 -0700)]
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

14 years agoPatch 'unix:filemode' property as 'svn:executable' in SVN
vrana [Wed, 26 Sep 2012 17:24:10 +0000 (10:24 -0700)]
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

14 years agoDon't run background process with raw diff source
vrana [Wed, 26 Sep 2012 00:57:01 +0000 (17:57 -0700)]
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

14 years agoUnuse $argv in `arc diff --background`
vrana [Mon, 24 Sep 2012 18:32:38 +0000 (11:32 -0700)]
Unuse $argv in `arc diff --background`

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

CC: zeeg, aran, Korvin
Differential Revision: https://secure.phabricator.com/D3550

14 years agoStep towards working `arc diff --background 1` on Windows
vrana [Fri, 21 Sep 2012 23:29:12 +0000 (16:29 -0700)]
Step towards working `arc diff --background 1` on Windows

Summary:
Running `a.php` from command line doesn't work on Windows, we need to run `php a.php`.
This shouldn't break other OSes.

Test Plan:
  $ arc diff --background 1

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3544

14 years agoFlush output before printing lint and unit results in diff
vrana [Fri, 21 Sep 2012 22:27:36 +0000 (15:27 -0700)]
Flush output before printing lint and unit results in diff

Summary:
Under HPHP, output buffer size is ignored.
Flush any buffered output before printing anything from `arc diff` to reduce user's confusion.

Test Plan:
  $ arc diff --preview --background 1
  $ arc diff --preview --background 0

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3543

14 years agoMake `arc diff --background 1` default and disable it on Windows
vrana [Tue, 18 Sep 2012 21:14:12 +0000 (14:14 -0700)]
Make `arc diff --background 1` default and disable it on Windows

Summary:
I am using it for about a month.
It works even in Facebook www.

Test Plan:
  $ arc diff --background 1 # hundreds of times

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3495

14 years agofix a bug in ArcanistXHPLinter
Bob Trahan [Fri, 21 Sep 2012 21:59:04 +0000 (14:59 -0700)]
fix a bug in ArcanistXHPLinter

Summary: $param is null here. it should be $node.

Test Plan: arc lint no longer barfed on me!

Reviewers: vrana, epriestley

Reviewed By: vrana

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3540

14 years agoReformat lint severities for readability
epriestley [Fri, 21 Sep 2012 19:27:32 +0000 (12:27 -0700)]
Reformat lint severities for readability

Summary: See D3482.

Test Plan: `arc lint`

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D3501

14 years agoAdd git-repo-based bundle tests
epriestley [Fri, 21 Sep 2012 19:27:21 +0000 (12:27 -0700)]
Add git-repo-based bundle tests

Summary:
Adds a test which goes through a git repository commit by commit and applies them (in effect) via "arc patch", verifying that the results match the actual commit.

See D3439 for the fixture stuff.

The git repo archive has a couple of trivial commits in it:

  $ ../libphutil/scripts/utils/directory_fixture.php src/parser/__tests__/bundle.git.tgz
  Spawning an interactive shell. Exit when complete.

  sh-3.2$ git log
  commit f19fb9fa1385c01b53bdb6d8842dd154e47151ec
  Author: epriestley <git@epriestley.com>
  Date:   Wed Sep 5 14:30:28 2012 -0700

      Edit a text file.

  commit 228d7be4840313ed805c25c15bba0f7b188af3e6
  Author: epriestley <git@epriestley.com>
  Date:   Wed Sep 5 14:30:11 2012 -0700

      Add a text file.

Test Plan: Ran tests.

Reviewers: edward

Reviewed By: edward

CC: aran
Maniphest Tasks: T866

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

14 years agoHandle empty file add in Git export
vrana [Fri, 21 Sep 2012 17:23:04 +0000 (10:23 -0700)]
Handle empty file add in Git export

Summary: Fixes T1555.

Test Plan: Added empty file, diffed it, exported and patched. Also manually created diff in Differential.

Reviewers: btrahan, epriestley

Reviewed By: btrahan

CC: aran, Korvin
Maniphest Tasks: T1555

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

14 years agoProperly handle file moves in `arc patch` under SVN
vrana [Wed, 19 Sep 2012 22:59:39 +0000 (15:59 -0700)]
Properly handle file moves in `arc patch` under SVN

Summary:
If the file has no changes (probably because it has been moved or copied) then we fail.

Fixes T1708, fixes T1559.

Test Plan:
  $ svn mv a b
  $ arc diff --only
  $ svn revert a b
  $ arc patch --diff # of created diff

Reviewers: epriestley, btrahan

Reviewed By: btrahan

CC: aran, Korvin
Maniphest Tasks: T1559, T1708

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

14 years agoBuild correct corpus in copied or moved files
vrana [Wed, 19 Sep 2012 21:36:38 +0000 (14:36 -0700)]
Build correct corpus in copied or moved files

Summary:
This problem shows very far away.
One of the symptomps is that the contents of a moved file is displayed as added in Differential but it is not a big deal.

The real trouble happens when you try to `arc patch` this diff.
It tries to both copy the file and to add a new contents (which fails).

Fixes T1709.

Test Plan:
  $ git mv a b
  $ git commit -m.
  $ arc diff --only
  $ git reset --hard HEAD^
  $ arc patch --diff # of the created diff

  $ arc unit src/parser/__tests__

Reviewers: epriestley, btrahan

Reviewed By: btrahan

CC: aran, Korvin, boris, mroch, slawekbiel
Maniphest Tasks: T1709

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

14 years agoMark moved binary file as image
vrana [Tue, 18 Sep 2012 22:07:01 +0000 (15:07 -0700)]
Mark moved binary file as image

Test Plan: Moved image, verified that the source file is marked as image: https://secure.phabricator.com/differential/diff/6924/

Reviewers: epriestley, btrahan

Reviewed By: btrahan

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3520

14 years agoHandle binary file moves in `arc patch` under Git
vrana [Tue, 18 Sep 2012 23:03:32 +0000 (16:03 -0700)]
Handle binary file moves in `arc patch` under Git

Summary: We don't store old file PHID for binary file moves here.

Test Plan: `arc patch` on revision with binary file moves which was failing earlier.

Reviewers: epriestley, btrahan

Reviewed By: btrahan

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3521

14 years agoRequire PHP 5.3.0 on Windows
vrana [Mon, 17 Sep 2012 20:53:04 +0000 (13:53 -0700)]
Require PHP 5.3.0 on Windows

Test Plan:
  $ arc diff

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3506