]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
12 years agoImprove "arc land" error message to mention SVN alternatives
epriestley [Mon, 25 Aug 2014 02:29:40 +0000 (19:29 -0700)]
Improve "arc land" error message to mention SVN alternatives

Summary: Fixes T3813. This error message isn't very helpful in SVN; be more helpful.

Test Plan: Ran `arc land` in a Subversion repository, got a reasonable error message.

Reviewers: btrahan, asherkin

Reviewed By: asherkin

Subscribers: aran

Maniphest Tasks: T3813

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

12 years agoArcanist - potentially fix some Windows badness
Bob Trahan [Thu, 21 Aug 2014 23:07:00 +0000 (16:07 -0700)]
Arcanist - potentially fix some Windows badness

Summary: Fixes T5914, maybs.

Test Plan: will ask users in T5914

Reviewers: chad, epriestley

Reviewed By: chad, epriestley

Subscribers: chad, bluehawk, epriestley, Korvin

Maniphest Tasks: T5914

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

12 years agoSchedule repository updates from `arc commit`, not just `arc land`
epriestley [Thu, 21 Aug 2014 18:25:27 +0000 (11:25 -0700)]
Schedule repository updates from `arc commit`, not just `arc land`

Summary: Ref T5926. We only pass Phabricator an update hint from `arc land`, not from `arc commit`.

Test Plan:
  - Ran `arc land` and `arc commit` with `--trace`, saw hints go over the wire.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5926

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

12 years agoDon't parse separator tabs as part of the filename in Git diffs which affect files...
epriestley [Thu, 14 Aug 2014 19:13:02 +0000 (12:13 -0700)]
Don't parse separator tabs as part of the filename in Git diffs which affect files with spaces

Summary:
Fixes T5870. When a filename contains spaces, Git will add a "\t" at the end of the "---" and "+++" lines. We currently consume this and think we're reading a file called "blah blah\t".

Instead, parse it out as not part of the filename.

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

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5870

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

12 years ago[lint] Add HLint-based Haskell linter
Austin Seipp [Wed, 13 Aug 2014 02:49:02 +0000 (19:49 -0700)]
[lint] Add HLint-based Haskell linter

Summary:
This adds a lint engine for `hlint`, which is the standard and most general Haskell lint tool around these days.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Test Plan: Install `hlint`, and run `arc unit`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Projects: #arcanist

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

12 years agoMake arcanist lint tests flexible about testcase formatting
epriestley [Wed, 13 Aug 2014 02:32:15 +0000 (19:32 -0700)]
Make arcanist lint tests flexible about testcase formatting

Summary:
We currently require an exact number of "~" characters, but this is needless and error-prone.

Instead, allow any number larger than 3.

Test Plan:
  - Added meta test-case.
  - Ran `arc unit --everything`.

Reviewers: btrahan, thoughtpolice

Reviewed By: thoughtpolice

Subscribers: epriestley

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

12 years agoRemove --background flag to prevent `arc` from hanging
epriestley [Fri, 8 Aug 2014 23:09:11 +0000 (16:09 -0700)]
Remove --background flag to prevent `arc` from hanging

Summary:
Ref T4281. A long time ago, we added a `--background` flag to let `arc lint` and `arc unit` run while you're typing a commit message, in some situations.

This code is only moderately beneficial and is way too complicated. Particularly, it has a long history of causing hangs (T4281, T2463), doesn't work on Windows, and is impossible to debug.

It's also running into a serious PHP bug with EAGAIN/EPIPE being indistinguishable that I haven't been able to find a reasonable workaround for in ~3-4 hours of trying.

All the pathways forward that I can see make this already-complex system more complex.

The major reason that this stuff is so complex is that the subprocess may need to prompt the user (notably, to apply patches from lint).

Instead, I'm going to simplify how `arc diff` interacts with `arc lint` and `arc unit`, so we can just fire-and-forget a background process, let it do as much work as it can without needing user input, and then pick up wherever it left off. This will be slightly less cool/magical, but it won't hang bizarrely and I will be able to debug it.

For now, simply remove the `--background` flag and behavior so `arc` works for everyone.

Test Plan: Ran `arc diff` to create this diff.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4281

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

12 years agoDon't interpret `arc browse .` as a commit
epriestley [Fri, 8 Aug 2014 18:21:43 +0000 (11:21 -0700)]
Don't interpret `arc browse .` as a commit

Summary: Ref T5781. `git show .` works like HEAD, but that isn't what `arc browse .` means.

Test Plan: Ran `arc browse .` with a repository at a published commit.

Reviewers: chad, btrahan, avive, avivey

Reviewed By: avivey

Subscribers: epriestley, avivey

Maniphest Tasks: T5781

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

12 years agoRename a test class
Joshua Spence [Tue, 5 Aug 2014 21:44:55 +0000 (07:44 +1000)]
Rename a test class

Summary: Rename `ArcanistPHPCSLinterTestCase` to `ArcanistPhpcsLinterTestCase` for consistency with the class being tested.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoAdd a linter rule for parentheses being used with PHP language constructs
Joshua Spence [Tue, 5 Aug 2014 12:35:34 +0000 (22:35 +1000)]
Add a linter rule for parentheses being used with PHP language constructs

Summary: Fixes T5648.

Test Plan: Added some test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5648

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

12 years agoAllow "arc browse <symbol>" to resolve symbolic commits
epriestley [Mon, 4 Aug 2014 19:03:22 +0000 (12:03 -0700)]
Allow "arc browse <symbol>" to resolve symbolic commits

Summary: Ref T5781. This makes things like `arc browse master` work (but they open the commit, not a revision).

Test Plan: Ran `arc browse master`.

Reviewers: csilvers, btrahan

Reviewed By: btrahan

Subscribers: epriestley, spicyj

Maniphest Tasks: T5781

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

12 years agoAdd a --browse flag to `arc todo`
epriestley [Mon, 4 Aug 2014 19:03:12 +0000 (12:03 -0700)]
Add a --browse flag to `arc todo`

Summary: Ref T5781. Like D10141, but for `arc todo`. Fixes T5787.

Test Plan: See T5787.

Reviewers: btrahan, csilvers

Reviewed By: csilvers

Subscribers: epriestley, spicyj

Maniphest Tasks: T5781, T5787

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

12 years agoAdd a --browse flag to `arc diff`, to open objects in a browser after creating them
epriestley [Mon, 4 Aug 2014 19:03:03 +0000 (12:03 -0700)]
Add a --browse flag to `arc diff`, to open objects in a browser after creating them

Summary: Ref T5781. Add a flag to optionally open a web browser after creating a diff or revision.

Test Plan: Created //this revision// with `arc diff --browse` // !!! //

Reviewers: csilvers, btrahan

Reviewed By: btrahan

Subscribers: epriestley, spicyj

Maniphest Tasks: T5781

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

12 years agoAllow "arc browse" to browse objects
epriestley [Mon, 4 Aug 2014 19:02:54 +0000 (12:02 -0700)]
Allow "arc browse" to browse objects

Summary: Ref T5781. This implements `arc browse T234`, for any monogrammed object.

Test Plan:
  - Ran `arc browse T234` outside of a working copy (does not require repository API).
  - Ran `arc browse T234` in a working copy, got task.
  - Ran `arc browse PATH` in a working copy.
  - Ran `arc browse nonpath` with and without `--force`.

Reviewers: csilvers, btrahan

Reviewed By: btrahan

Subscribers: epriestley, spicyj

Maniphest Tasks: T5781

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

12 years agoUse GIT tracked branches for arc land targets when reasonable
Joseph Battelle [Mon, 28 Jul 2014 23:22:04 +0000 (16:22 -0700)]
Use GIT tracked branches for arc land targets when reasonable

Summary:
See T5690.
-arc land now respects tracked branch when choosing 'onto'; '--onto' option remains as an override.
-arc land now respects tracked branch when choosing a remote; the remote is taken from 'onto's upstream unless the '--remote' option is present; when 'onto' branch has no upstream the '--remote' option must be provided as before.

Since 'arc feature' branches are (already) created as tracking branches, 'arc.land.onto.default' if present, is only used as the default when a non-tracking branch created by some other means is landed with out explicit '--onto'.  This may be surprising but is probably the correct go-forward behavior and is inline with the description in T5690.

Test Plan:
-checked having no arc.land.onto.default still assumes 'master'
-checked 'arc.land.onto.default' still overrides 'master'
-checked upstream branch (of feature branch) overrides 'master' and 'arc.land.onto.default'
-checked '--onto' overrides all
-checked origin is default for non-tracking branches
-checked the land onto branch's upstream remote is used instead of 'origin'
-checked '--remote' overrides 'origin' and the tracked upstream
-tested several crazy branch names including 'something/like/this' for both the upstream and tracking branches
-tested on linux and OS X
-rinse and repeat on Windows

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5690

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

12 years agoRename `ArcanistLintRenderer` subclasses
Joshua Spence [Thu, 24 Jul 2014 22:16:29 +0000 (08:16 +1000)]
Rename `ArcanistLintRenderer` subclasses

Summary: Ref T5655.

Test Plan: `arc lint` and `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5655

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

12 years agoRestore the old "history.immutable" default behavior
epriestley [Wed, 23 Jul 2014 13:46:42 +0000 (06:46 -0700)]
Restore the old "history.immutable" default behavior

Summary: See rARC104219dd. Per the explanatory text, this should default to `true` in Mercurial and `false` in Git.

Test Plan: Ran `arc get-config` in Mercurial repo.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

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

12 years agoDon't explicitly name abstract base classes
Joshua Spence [Mon, 21 Jul 2014 21:49:15 +0000 (07:49 +1000)]
Don't explicitly name abstract base classes

Summary:
Ref T5655. It is superfluous to include "base" in the name of an abstract base class. Furthermore, it is not done consistently within the code base.

In order to retain compatibility with external code, I have kept the `ArcanistBaseWorkflow` class (which trivially extends from `ArcanistWorkflow`), but it is now deprecated and should output a warning message. Similarly for `ArcanistBaseUnitTestEngine`.

Test Plan: Created a workflow which extends from `ArcanistBaseWorkflow`. Executed the workflow and saw a deprecation warning.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, aurelijus

Maniphest Tasks: T5655

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

12 years agoUse have/need data in ArcanistPhutilLibraryLinter
epriestley [Thu, 17 Jul 2014 21:34:59 +0000 (14:34 -0700)]
Use have/need data in ArcanistPhutilLibraryLinter

Summary: Ref T5640. In D9864, the data this linter pulls out of the map was changed, breaking "use of undeclared function" warnings.

Test Plan:
```
>>> Lint for src/future/FutureProxy.php:

   Error  (PHL1) Unknown Symbol
    Use of unknown function 'qqqqqq'. 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.

              15       $this->setProxiedFuture($proxied);
              16     }
              17
    >>>       18     qqqqqq();
              19   }
              20
              21   public function setProxiedFuture(Future $proxied) {
```

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T5640

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

12 years agoRemove "Stopped" logic from Phrequent workflows
James Rhodes [Thu, 17 Jul 2014 03:26:00 +0000 (13:26 +1000)]
Remove "Stopped" logic from Phrequent workflows

Summary: We can remove this "Stopped" code as per feedback on D7327.  I think having the full text of "In Progress" and "Suspended" is much clearer than just a '*' though, so I've only removed the ongoing check.

Test Plan: Ran a combination of `arc start`, `arc stop` and `arc time` and it all worked.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd Phrequent workflows to Arcanist
James Rhodes [Thu, 17 Jul 2014 01:58:22 +0000 (11:58 +1000)]
Add Phrequent workflows to Arcanist

Summary:
Depends on D9906.

This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.

Test Plan: Tested this against a local install.

Reviewers: skyronic, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: maxhodak, hach-que, aran, epriestley, Korvin

Maniphest Tasks: T3569, T3969

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

12 years agoRemove duplicate newline
Joshua Spence [Wed, 16 Jul 2014 12:31:33 +0000 (22:31 +1000)]
Remove duplicate newline

Summary: Remove a duplicate newline from end-of-file.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd a newline to `externals/includes/README`
Joshua Spence [Wed, 16 Jul 2014 12:11:52 +0000 (22:11 +1000)]
Add a newline to `externals/includes/README`

Summary: For consistency, add a trailing newline to `externals/includes/README`. See D9940.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoReformat README as Remarkup
Joshua Spence [Wed, 16 Jul 2014 12:11:10 +0000 (22:11 +1000)]
Reformat README as Remarkup

Summary: We have Remarkup, so why not use it?

Test Plan: See D9946.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoFix double file content in files in new subdirectories in Subversion
Evan Priestley [Tue, 15 Jul 2014 16:43:04 +0000 (09:43 -0700)]
Fix double file content in files in new subdirectories in Subversion

Summary:
Fixes T5555. Normally, when we `svn diff subdir/`, we use `--depth empty` to get only changes for the directory itself (usually, property changes).

However, this flag has no effect if the directory is newly added.

Adjust the diff parser so that if two sets of hunks are specified for a single file in a raw diff, we let the last one win instead of including both. This approach is a broadly more reasonable interpretation of these diffs.

Test Plan:
  - Added a new file in a new subdirectory in Subversion.
  - Ran `arc diff --only`.
  - No double file content in resulting diff.
  - Added unit test.
  - There's fairly comprehensive unit test coverage for this stuff.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5555

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

12 years agoFix various spelling mistakes
Joshua Spence [Sat, 12 Jul 2014 14:45:38 +0000 (00:45 +1000)]
Fix various spelling mistakes

Summary: Minor change, self-explanatory.

Test Plan: Eye-ball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoUse `git diff a b` for ranges, not `git diff a..b`
epriestley [Fri, 11 Jul 2014 17:45:11 +0000 (10:45 -0700)]
Use `git diff a b` for ranges, not `git diff a..b`

Summary:
These are documented as being identical, but `git diff a b` works if `a` is a tree (for example, `4b825d...`, the empty tree hash), but `git diff a..b` does not.

Particularly, with the `a..b` form, `arc diff --base arc:empty` does not work. With the `a b` form, it does.

Test Plan: Ran `arc diff --base arc:empty` in a repository and got a diff.

Reviewers: btrahan, talshiri

Reviewed By: talshiri

Subscribers: epriestley

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

12 years agoRemove Phabricator reference from the linter description of `ArcanistXHPASTLinter`
Joshua Spence [Fri, 11 Jul 2014 15:25:51 +0000 (01:25 +1000)]
Remove Phabricator reference from the linter description of `ArcanistXHPASTLinter`

Summary: The `ArcanistXHPASTLinter` is no longer //too// specific to Phabricator (Phabricator-specific XHPAST lints generally live in `ArcanistPhutilXHPASTLinter`) and //should// be better suited for general purpose usage.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoMinor change to `ArcanistXHPASTLinter`
Joshua Spence [Fri, 11 Jul 2014 15:21:21 +0000 (01:21 +1000)]
Minor change to `ArcanistXHPASTLinter`

Summary: Change `==` to `===`. This is a little bit cleaner because we shouldn't need type coercion here.

Test Plan: Ran `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoParameterize `@{upstream}` in arc to fix Windows
epriestley [Thu, 10 Jul 2014 14:56:35 +0000 (07:56 -0700)]
Parameterize `@{upstream}` in arc to fix Windows

Summary: We manually quote this in a couple of places. That works fine on Lunix, but does not work on Windows. Instead, explicitly parameterize the command so the correct quoting rules are applied for the OS.

Test Plan: See IRC; windows user had issues fixed by this. `arc:upstream` still works locally.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

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

12 years agoAllow the `todo` workflow to add project tags.
Joshua Spence [Thu, 10 Jul 2014 11:48:49 +0000 (21:48 +1000)]
Allow the `todo` workflow to add project tags.

Summary: Fixes T4418. Allows Maniphests created through the `arc todo` workflow to have projects assigned.

Test Plan:
```
> ./bin/arc --trace --conduit-uri='http://phabricator.joshuaspence.com' todo "Test project" --project foo --project bar
libphutil loaded from '/home/joshua/workspace/github.com/phacility/libphutil/src'.
arcanist loaded from '/home/joshua/workspace/github.com/phacility/arcanist/src'.
Config: Reading user configuration file "/home/joshua/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/home/joshua/workspace/github.com/phacility/arcanist/.arcconfig".
Working Copy: Path "/home/joshua/workspace/github.com/phacility/arcanist" is part of `git` working copy "/home/joshua/workspace/github.com/phacility/arcanist".
Working Copy: Project root is at "/home/joshua/workspace/github.com/phacility/arcanist".
Config: Did not find local configuration at "/home/joshua/workspace/github.com/phacility/arcanist/.git/arc/config".
Loading phutil library from '/home/joshua/workspace/github.com/phacility/arcanist/src'...
>>> [0] <conduit> conduit.connect() <bytes = 618>
>>> [1] <http> http://phabricator.joshuaspence.com/api/conduit.connect
<<< [1] <http> 1,050,487 us
<<< [0] <conduit> 1,051,585 us
>>> [2] <conduit> project.query() <bytes = 199>
>>> [3] <http> http://phabricator.joshuaspence.com/api/project.query
<<< [3] <http> 294,584 us
<<< [2] <conduit> 294,986 us
>>> [4] <conduit> maniphest.createtask() <bytes = 313>
>>> [5] <http> http://phabricator.joshuaspence.com/api/maniphest.createtask
<<< [5] <http> 637,693 us
<<< [4] <conduit> 638,098 us
Created task T6: 'Test project' at http://phabricator.joshuaspence.com/T6
```

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T4418

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

12 years agoAllow the `ArcanistPhutilLibraryLinter` to recover from PHP syntax errors
Joshua Spence [Thu, 10 Jul 2014 01:48:45 +0000 (11:48 +1000)]
Allow the `ArcanistPhutilLibraryLinter` to recover from PHP syntax errors

Summary: Fixes T5577. If the `ArcanistPhutilLibraryLinter` lints a PHP file that contains a syntax error, it will die horribly. Instead, force it to continue as if nothing was wrong.

Test Plan: Introduced a PHP syntax error. Ran `arc lint` and made sure the output looked reasonable.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5577

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

12 years agoDon't build unused linters for the `ArcanistConfigurationDrivenLintEngine`
Aviv Eyal [Wed, 9 Jul 2014 22:33:58 +0000 (15:33 -0700)]
Don't build unused linters for the `ArcanistConfigurationDrivenLintEngine`

Summary: Fixes T5124.

Test Plan: `arc lint` on a Phabricator diff that doesn't have JS files doesn't complain on missing JSHint.

Reviewers: #blessed_reviewers, joshuaspence, epriestley

Reviewed By: joshuaspence

Subscribers: epriestley, Korvin

Maniphest Tasks: T5124

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

12 years agoDecrease the priority of the `ArcanistPhutilLibraryLinter`
Joshua Spence [Wed, 9 Jul 2014 22:06:37 +0000 (08:06 +1000)]
Decrease the priority of the `ArcanistPhutilLibraryLinter`

Summary: Ref T5577. Decrease the priority of the `ArcanistPhutilLibraryLinter` such that it is lower than that of the `ArcanistXHPASTLinter`. There isn't any specific reason that we should do this, although it seems to generally be a reasonable idea.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5577

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

12 years agoMinor change to `ArcanistPhutilLibraryLinter`
Joshua Spence [Wed, 9 Jul 2014 21:38:40 +0000 (07:38 +1000)]
Minor change to `ArcanistPhutilLibraryLinter`

Summary: Ref T5577. Modify `ArcanistPhutilLibraryLinter` to use `PhutilLibraryMapBuilder` instead of using an `ExecFuture` to run `phutil_rebuild_map.php`.

Test Plan: Ran `arc lint`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5577

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

12 years agoMinor change to `ArcanistInfrastructureTestCase`
Joshua Spence [Wed, 9 Jul 2014 21:12:40 +0000 (07:12 +1000)]
Minor change to `ArcanistInfrastructureTestCase`

Summary: Update `ArcanistInfrastructureTestCase` after D9860 and D9861.

Test Plan: `arc unit` should do the trick.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoRemove `@group` annotations
Joshua Spence [Tue, 8 Jul 2014 23:12:13 +0000 (09:12 +1000)]
Remove `@group` annotations

Summary: I'm pretty sure that `@group` annotations are useless now... I believe that they were originally used by Diviner?

Test Plan: Eye-balled it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

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

12 years agoRemove deprecated lints from `ArcanistXHPASTLinter`
Joshua Spence [Tue, 8 Jul 2014 00:54:40 +0000 (10:54 +1000)]
Remove deprecated lints from `ArcanistXHPASTLinter`

Summary: After D9576, `LINT_PHP_53_FEATURES` and `LINT_PHP_54_FEATURES` are deprecated. They have been replaced by `LINT_PHP_COMPATIBILITY`.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoMinor change to `ArcanistInfrastructureTestCase::testLibraryMap`
Joshua Spence [Sun, 6 Jul 2014 13:50:30 +0000 (23:50 +1000)]
Minor change to `ArcanistInfrastructureTestCase::testLibraryMap`

Summary: Modify `ArcanistInfrastructureTestCase::testLibraryMap` to use `phutil_get_current_library_name()` instead of hard-coding the library name.

Test Plan: See D9844.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoIn Arcanist, ignore extensions when unit testing the library map
epriestley [Sun, 6 Jul 2014 13:21:55 +0000 (06:21 -0700)]
In Arcanist, ignore extensions when unit testing the library map

Summary: See D9834. Arcanist version.

Test Plan: See D9834.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

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

12 years agoImprove the `ArcanistInfrastructureTestCase` unit tests
Joshua Spence [Sat, 5 Jul 2014 15:50:53 +0000 (01:50 +1000)]
Improve the `ArcanistInfrastructureTestCase` unit tests

Summary:
Improve the `ArcanistInfrastructureTestCase` unit tests such that they will fail if any of the following conditions are satisfied:

- A symbol referenced in the `__phutil_library_map__.php` file no longer exists.
- A symbol exists in the library but is not referenced within the `__phutil_library_map__.php` file.
- A symbol extends from a different parent symbol than that declared in the `__phutil_library_map.php` file.

Test Plan: See D9824

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoRegenerate library map
Joshua Spence [Sat, 5 Jul 2014 15:14:29 +0000 (01:14 +1000)]
Regenerate library map

Summary: Ran `arc liberate` after D9805.

Test Plan: `arc liberate`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoMove `PhutilLibraryMapBuilder` to `libphutil`
Joshua Spence [Sat, 5 Jul 2014 07:01:36 +0000 (17:01 +1000)]
Move `PhutilLibraryMapBuilder` to `libphutil`

Summary: See D9813 for a detailed explanation.

Test Plan:
```
> ./bin/arc liberate
Finding source files...
Found 194 files.
Loading symbol cache...
Found 194 files in cache.
Building library map...
Writing map...
Done.
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoMove `ArcanistSpellingDefaultData` into a configurable JSON file
Joshua Spence [Thu, 3 Jul 2014 22:18:33 +0000 (08:18 +1000)]
Move `ArcanistSpellingDefaultData` into a configurable JSON file

Summary: Currently, the `ArcanistSpellingLinter` loads data from `ArcanistSpellingDefaultData`, with no way to configure the linter from an `.arclint` file. Instead we should define a format for a "dictionary" file, of which the `ArvcanistSpellingLinter` can load and of which the paths are easily configured through `.arclint`.

Test Plan:
Updated the test case and ran `arc unit`.

NOTE: I have removed the `LINT_SPELLING_PICKY` and `LINT_SPELLING_IMPORTANT` constants and replaced them with `LINT_SPELLING_FULL` and `LINT_SPELLING_PARTIAL`. This was done because it simplifies the implementation considerably and makes customization of the `ArcanistSpellingLinter` simpler, but also because these constants were not widely used in the existing implementation.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAlphabetize `.arclint` linters
Joshua Spence [Wed, 2 Jul 2014 20:44:36 +0000 (06:44 +1000)]
Alphabetize `.arclint` linters

Summary: I'm a bit OCD with this, but I find the `.arclint` file easier to read if the keys are in alphabetical order.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoRefactor author handling in the Mercurial API
Richard van Velzen [Wed, 2 Jul 2014 20:59:13 +0000 (13:59 -0700)]
Refactor author handling in the Mercurial API

Summary: There were two callsites which needed some information from the username. Only one worked "correctly", causing `arc diff` to not amend commits anymore because the author could not be parser.

Test Plan: run `arc diff` with changes

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoEnable unit tests for `ArcanistJscsLinterTestCase`
Joshua Spence [Wed, 2 Jul 2014 19:15:09 +0000 (05:15 +1000)]
Enable unit tests for `ArcanistJscsLinterTestCase`

Summary:
https://github.com/mdevils/node-jscs/issues/444 has been resolved in commit [[https://github.com/mdevils/node-jscs/commit/0de667bac2491ba04d930ff94e990965213ba36b | 0de667bac2491ba04d930ff94e990965213ba36b]], which means that `jscs` can be easily run on files with any extension.

NOTE: JSCS version 1.5.7 is required.

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoUpdate spelling data
Joshua Spence [Tue, 1 Jul 2014 12:21:49 +0000 (22:21 +1000)]
Update spelling data

Summary: Update `ArcanistSpellingDefaultData` with data from the [[http://anonscm.debian.org/gitweb/?p=lintian/lintian.git;a=blob_plain;f=data/spelling/corrections;hb=4b3fc40babff01874b54718406b77b7f3052d26a | original source]].

Test Plan: Visual inspection.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoUpdate arcanist NOTICE file
epriestley [Wed, 25 Jun 2014 20:43:07 +0000 (13:43 -0700)]
Update arcanist NOTICE file

Summary: See D9730.

Test Plan: reading

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

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

12 years ago`ArcanistChmodLinter` should not allow certain MIME types to be executable
Joshua Spence [Wed, 25 Jun 2014 19:30:23 +0000 (05:30 +1000)]
`ArcanistChmodLinter` should not allow certain MIME types to be executable

Summary: Fixes T5466. An image is an example of a binary which should //not// be executable. Modify the `ArcanistChmodLinter` to disallow certain blacklisted MIME types from being executable.

Test Plan: Created an executable image file and ran `arc lint` over this file.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: richardvanvelzen, epriestley, Korvin

Maniphest Tasks: T5466

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

12 years agoFix a spelling mistake and tidy up whitespace
Joshua Spence [Tue, 24 Jun 2014 05:09:53 +0000 (15:09 +1000)]
Fix a spelling mistake and tidy up whitespace

Summary: Self-explanatory.

Test Plan: Eye-ball it.

Reviewers: epriestley, chad, #blessed_reviewers

Reviewed By: chad, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoPass the file contents instead of the file path to `phutil_json_decode`.
Joshua Spence [Tue, 24 Jun 2014 01:40:04 +0000 (11:40 +1000)]
Pass the file contents instead of the file path to `phutil_json_decode`.

Summary: See D9681#22.

Test Plan: Created an empty `.git/arc/config` file... no exception was thrown.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoBetter handling of `.arcconfig` files.
Joshua Spence [Mon, 23 Jun 2014 23:24:41 +0000 (09:24 +1000)]
Better handling of `.arcconfig` files.

Summary:
Throw a useful error message when an `.arcconfig` file is not valid JSON.

Depends on D9697.

Test Plan:
Modified an `.arcconfig` file to be invalid JSON.

```
> arc lint
Usage Exception: Your '~/.arcrc' file is not a valid JSON file.

Parse error on line 18 at column 4: Expected: 'STRING' - It appears you have an extra trailing comma
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoImprove the handling of `.arclint` files.
Joshua Spence [Mon, 23 Jun 2014 23:24:30 +0000 (09:24 +1000)]
Improve the handling of `.arclint` files.

Summary: Throw a useful error message when an `.arclint` file is not valid JSON.

Test Plan:
Modified an `.arclint` file to be invalid JSON.

```
> arc lint
Exception
Parse error on line 24 at column 5: Expected one of: 'EOF', '}', ',', ']'
(Run with --trace for a full exception trace.)
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoIf a `PhutilProxyException` is thrown by Arcanist, print all error messages.
Joshua Spence [Mon, 23 Jun 2014 23:24:00 +0000 (09:24 +1000)]
If a `PhutilProxyException` is thrown by Arcanist, print all error messages.

Summary: `PhutilProxyException` provides the capability to nest exceptions. However, if we throw a `PhutilProxyException` then we currently only display the error message from the top-most exception. Instead, we should print all of the nested exception messages.

Test Plan: Faked an error, saw multiple lines of exception messages.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoAdd a URL to support a TODO comment.
Joshua Spence [Mon, 23 Jun 2014 18:49:09 +0000 (04:49 +1000)]
Add a URL to support a TODO comment.

Summary: Provide a link to a "resolved" [[http://bugs.xdebug.org/view.php?id=1041 | Xdebug issue]] to support a TODO comment. Further information can be found at http://derickrethans.nl/dead-code.html.

Test Plan: Read the article.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoSkip the "Too Many Errors" error that is raised by JSHint.
Joshua Spence [Mon, 23 Jun 2014 18:16:15 +0000 (04:16 +1000)]
Skip the "Too Many Errors" error that is raised by JSHint.

Summary: If JSHint encounters //too many// errors (by default, more than 50) errors, then it quits prematurely and raises an additional (rather unhelpful) "Too Many Errors" error. We should just ignore this additional error.

Test Plan: Added a test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoDon't use error context from JSHint in linter messages
Joshua Spence [Mon, 23 Jun 2014 00:33:01 +0000 (10:33 +1000)]
Don't use error context from JSHint in linter messages

Summary:
The error context (a.k.a. "original text") as provided by `jshint` is not very useful and actually causes `arc lint` to display the lint message incorrectly.

{F169277}

The underlying problem here is that the error context from `jshint` contains the entire line from the input file rather than just the offending source code.

Test Plan: Ran `arc lint -- webroot/rsrc/js/core/behavior-hovercard.js` (in rP) and verified that the output looked reasonable.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoOnly lint files in the working copy with `arc lint --everything`.
Joshua Spence [Mon, 23 Jun 2014 00:30:57 +0000 (10:30 +1000)]
Only lint files in the working copy with `arc lint --everything`.

Summary: Fixes T5442. `arc lint --everything` currently uses a `FileFinder` to discover paths for linting. A consequence of this is that files that are ignored or otherwise excluded from version control are linted.

Test Plan: Ran `arc lint --everything` in rPHU and noticed that I wasn't prompted to add a trailing newline to `src/.phutil_module_cache`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5442

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

12 years agoRemove SBTLinter from ComprehensiveEngine
epriestley [Sun, 22 Jun 2014 19:40:36 +0000 (12:40 -0700)]
Remove SBTLinter from ComprehensiveEngine

Summary: D9664 removed this, clean up this remaining callsite.

Test Plan: `grep`

Reviewers: chad, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

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

12 years agoRead extension classes and functions from `php_compat_info.json`.
Joshua Spence [Sun, 22 Jun 2014 18:26:01 +0000 (04:26 +1000)]
Read extension classes and functions from `php_compat_info.json`.

Summary: Consolidate `php_extension_classes.txt` and `php_extension_functions.txt` with `php_compat_info.json`. Given that `php_extension_classes.txt` and `php_extension_functions.txt` are manually generated whereas `php_compat_info.json` is generated automatically, this should make maintenance easier.

Test Plan: Deleted the `src/.phutil_module_cache` file (in each of rARC, rPHU and rP) and ran `arc liberate`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoRemove the `ArcanistScalaSBTLinter`
Joshua Spence [Sun, 22 Jun 2014 18:12:26 +0000 (04:12 +1000)]
Remove the `ArcanistScalaSBTLinter`

Summary: As discussed in D9097, the `ArcanistScalaSBTLinter` isn't //really// a linter. Eventually we should add support for a proper Scala linter, but I think that supporting the `ArcanistScalaSBTLinter` as-is is more effort than it is worth.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd unit tests for `ArcanistPylintLinter`.
Joshua Spence [Sun, 22 Jun 2014 17:32:35 +0000 (03:32 +1000)]
Add unit tests for `ArcanistPylintLinter`.

Summary: Self-explanatory.

Test Plan: Ran the tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoMinor fix for the `ArcanistXHPASTLinter`.
Joshua Spence [Sun, 22 Jun 2014 15:56:57 +0000 (01:56 +1000)]
Minor fix for the `ArcanistXHPASTLinter`.

Summary: This `LINT_PHP_53_FEATURES` should have been replaced with `LINT_PHP_COMPATIBILITY` in D9576.

Test Plan: Ran `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoImprove the handling of the `php_compat_info.json` file.
Joshua Spence [Sun, 22 Jun 2014 15:56:44 +0000 (01:56 +1000)]
Improve the handling of the `php_compat_info.json` file.

Summary: See inline comments on D9576. Also replace `json_decode` with `phutil_json_decode`, for better error handling.

Test Plan: Make sure `arc unit` still works.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoLint JSON files with `ArcanistJSONLinter`.
Joshua Spence [Sun, 22 Jun 2014 15:55:48 +0000 (01:55 +1000)]
Lint JSON files with `ArcanistJSONLinter`.

Summary: After D9628, we can lint JSON files natively.

Test Plan: Linted a few JSON files manually (i.e. `arc lint --trace -- $FILE`).

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd a native JSON linter.
Joshua Spence [Sat, 21 Jun 2014 20:41:22 +0000 (06:41 +1000)]
Add a native JSON linter.

Summary:
Ref T5297. Utilize `PhutilJSONParser` to create a native JSON linter (native in that it is pure PHP with no external dependencies).

Since [[https://github.com/Seldaek/jsonlint | JsonLint]] is literally a PHP port of [[https://github.com/zaach/jsonlint | jsonlint]], I figured that we should also deprecate `ArcanistJSONLintLinter`. `ArcanistJSONLinter` //should// behave identically to `ArcanistJSONLintLinter`.

Depends on D9634.

Test Plan: Ran the `ArcanistJSONLintLinter` unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5297

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

12 years agoDon't throw an exception if no configuration is set for linter tests
Joshua Spence [Fri, 20 Jun 2014 21:15:38 +0000 (07:15 +1000)]
Don't throw an exception if no configuration is set for linter tests

Summary: This was broken in D9641. If `$config` is not set, then a `PhutilJSONParserException` will be thrown. The expected behaviour is that it is okay to not explicitly set any configuration.

Test Plan: Ran `arc unit`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoUpdate callsites of `phutil_json_decode`.
Joshua Spence [Fri, 20 Jun 2014 14:39:20 +0000 (00:39 +1000)]
Update callsites of `phutil_json_decode`.

Summary: Depends on D9634. `phutil_json_decode` now throws an exception on invalid JSON.

Test Plan: Ran the unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoTidying up of linter code.
Joshua Spence [Fri, 20 Jun 2014 08:26:44 +0000 (18:26 +1000)]
Tidying up of linter code.

Summary: Various tidying up of linting code.

Test Plan: `arc lint` and `arc unit` still pass.

Reviewers: chad, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd unit tests for `ArcanistMergeConflictLinter`.
Joshua Spence [Thu, 19 Jun 2014 21:59:12 +0000 (07:59 +1000)]
Add unit tests for `ArcanistMergeConflictLinter`.

Summary: Self explanatory. Also fixed the character offset to start at 1 instead of 0 (because the other linters seem to do this).

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoFix an issue with `arc branch` and very old branches
epriestley [Wed, 18 Jun 2014 15:35:29 +0000 (08:35 -0700)]
Fix an issue with `arc branch` and very old branches

Summary:
In D9595, we stopped parsing short-form "Differential Revision:" fields in commit messages, and only accept URLs.

I have one of the older style commit messages in my local `arcanist/`, so now we go down this parse failure branch in `arc branch`. This has never worked quite correctly, and if the parse fails we end up with a bad branch dictionary that is missing fields.

Test Plan: Ran `arc branch` in a working copy with an old `Differential Revision:` field at the head of a branch. Before patch: explosions; after patch: works great.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

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

12 years agoFix race condition inside `git diff-files`
epriestley [Wed, 18 Jun 2014 12:33:05 +0000 (05:33 -0700)]
Fix race condition inside `git diff-files`

Summary:
There's some sort of race inside `git` here, where the `git diff-files` command exits with different results some of the time when run in parallel with `git ls-files` or `git diff` (running either command was sufficient to trigger the race).

Run it separately to avoid the race.

I poked around the `git` source a little bit but quickly lost interest given that the issue seems fixed and this workaround is essentially reasonable.

Test Plan: Ran test 20x in a row without failures.

Reviewers: hach-que

Reviewed By: hach-que

Subscribers: epriestley

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

12 years agoAdd a newline to the output of `arc help --full`.
Joshua Spence [Tue, 17 Jun 2014 22:07:02 +0000 (08:07 +1000)]
Add a newline to the output of `arc help --full`.

Summary: The output from `arc help --full` is missing a newline character.

Test Plan:
**Before**
```
> arc help --full
      --skip-arcconfig
           Skip the working copy configuration file

      --arcrc-file filename
           Use provided file instead of ~/.arcrc.>
```

**After**
```
> arc help --full
      --skip-arcconfig
           Skip the working copy configuration file

      --arcrc-file filename
           Use provided file instead of ~/.arcrc.
>
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoDon't parse mercurial usernames without email address as an email address
Richard van Velzen [Tue, 17 Jun 2014 18:46:42 +0000 (11:46 -0700)]
Don't parse mercurial usernames without email address as an email address

Summary:
This leads to information being lost when others do `arc patch` because the name is used as the email address.

For example:
  username = Richard van Velzen

Would give:
  'authorName' => null,
  'authorEmail' => 'Richard van Velzen'

Test Plan:
ran it through my head a couple of times, and tested it with the common options which all gave the expected result:
  'rvanvelzen@company.com',
  'Richard van Velzen',
  'Richard van Velzen <rvanvelzen@company.com>',
  'Richard van Velzen rvanvelzen@company.com',

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoConvert `arc list` to use `PhutilConsoleTable`.
Joshua Spence [Tue, 17 Jun 2014 17:42:53 +0000 (03:42 +1000)]
Convert `arc list` to use `PhutilConsoleTable`.

Summary: Similar to D9601 and D9602. Also added pretty colors.

Test Plan: {F167702}

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoConvert `arc feature` to use `PhutilConsoleTable`.
Joshua Spence [Tue, 17 Jun 2014 17:41:21 +0000 (03:41 +1000)]
Convert `arc feature` to use `PhutilConsoleTable`.

Summary: Fixes T5110. `PhutilConsoleTable` handles Unicode characters and can display a decent-looking table.

Test Plan: {F167698}

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5110

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

12 years agoConvert `arc tasks` to use `PhutilConsoleTable`.
Joshua Spence [Tue, 17 Jun 2014 17:01:39 +0000 (03:01 +1000)]
Convert `arc tasks` to use `PhutilConsoleTable`.

Summary: `PhutilConsoleTable` does a better job at aligning columns. We still probably need to do some work to `PhutilConsoleTable` to set a maximum width for a specified column, or elect which columns can be truncated etc but this can probably come later.

Test Plan: {F167687}

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoModernize `.arclint` file.
Joshua Spence [Tue, 17 Jun 2014 16:41:28 +0000 (02:41 +1000)]
Modernize `.arclint` file.

Summary:
Update the `.arclint` file after D9576 and D9590.

Depends on D9576, D9590.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoDrop support for parsing non-URL differential IDs from commit message.
Joshua Spence [Tue, 17 Jun 2014 15:39:28 +0000 (01:39 +1000)]
Drop support for parsing non-URL differential IDs from commit message.

Summary: This has been a `TODO` for a few years now... no-one should be using the old-school (non-URL) syntax anymore.

Test Plan: I'm actually not sure if it's okay to drop support for this... please verify.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAllow PHP version to be customized with `ArcanistXHPASTLinter`
Joshua Spence [Tue, 17 Jun 2014 15:30:15 +0000 (01:30 +1000)]
Allow PHP version to be customized with `ArcanistXHPASTLinter`

Summary: Fixes T5385. Provide a flexible means of setting a minimum PHP version for the `ArcanistXHPASTLinter`, instead of relying on `ArcanistXHPASTLinter::LINT_PHP_53_FEATURES` and `ArcanistXHPASTLinter::LINT_PHP_54_FEATURES`.

Test Plan: Fixed up and ran unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5385

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

12 years agoMove the "ragged classtree edge" linter rule to `ArcanistPhutilXHPASTLinter`.
Joshua Spence [Tue, 17 Jun 2014 15:28:40 +0000 (01:28 +1000)]
Move the "ragged classtree edge" linter rule to `ArcanistPhutilXHPASTLinter`.

Summary: This linter rule is very specific to the Phabricator and it is unlikely that it is being used elsewhere. We should move it to `ArcanistPhutilXHPASTLinter`, where other Phabricator-specific linting code lives.

Test Plan: Moved the corresponding test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoLet `arc liberate` throw on unsupported PHP features
Richard van Velzen [Tue, 17 Jun 2014 12:13:05 +0000 (05:13 -0700)]
Let `arc liberate` throw on unsupported PHP features

Summary: Ref T4725.

Test Plan: add some files that have unsupported constructs all over the place and run `arc liberate`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T4725

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

12 years agoCorrectly recognize "no bookmarks" for Mercurial
Richard van Velzen [Tue, 17 Jun 2014 11:51:55 +0000 (04:51 -0700)]
Correctly recognize "no bookmarks" for Mercurial

Summary: Fixes T5086.

Test Plan: remove all bookmarks and run `arc feature`

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5086

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

12 years agoLet phutil_rebuild_map **really** be quiet
Richard van Velzen [Mon, 16 Jun 2014 22:49:08 +0000 (15:49 -0700)]
Let phutil_rebuild_map **really** be quiet

Summary: Depends on D9586. The progress bar is written to stderr which results in bad stuff happening when you try run `lint` (`PhutilLibraryLinter` calls it)

Test Plan: run `arc lint`, see no more errors

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAllow specifying runtime configuration with --set-config key=value
Tal Shiri [Mon, 16 Jun 2014 22:28:04 +0000 (15:28 -0700)]
Allow specifying runtime configuration with --set-config key=value

Summary:
This is useful for wrapper scripts that want to customize arcanist's behavior without affecting the global configuration.
This can be implemented with arcanist_configuration entry in .arcconfig, however it is currently limited to
per-project settings, and this feature makes writing wrapper scripts a little easier.

Test Plan: arc diff --set-config editor=vim (yeah yeah, crappy test case)

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoLet `phutil_rebuild_map` show a progress bar
Richard van Velzen [Mon, 16 Jun 2014 22:22:48 +0000 (15:22 -0700)]
Let `phutil_rebuild_map` show a progress bar

Summary: .. Instead of dots that are hard to count.

Test Plan: remove `.phutil_module_cache` and do `arc liberate`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd an `ArcanistJscsLinter`.
Joshua Spence [Mon, 16 Jun 2014 20:40:36 +0000 (06:40 +1000)]
Add an `ArcanistJscsLinter`.

Summary: Add a linter which wraps around [[https://github.com/mdevils/node-jscs | JSCS]].

Test Plan: Currently, we can't test this linter with out existing infrastructure. Specifically, `jscs` will only lint `*.js` files. I have done a fair bit of manual testing though.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoRemove the deprecated `ArcanistWorkCopyIdentity::getConfig` method.
Joshua Spence [Mon, 16 Jun 2014 20:39:47 +0000 (06:39 +1000)]
Remove the deprecated `ArcanistWorkCopyIdentity::getConfig` method.

Summary: This method has been deprecated for a while now (see rARC0d212ccf5a7ac5fc75d2d3036cb3a0bee220fd02). It should be safe to remove.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd --no-verify to git commit call for arc patch
Ben Alpert [Mon, 16 Jun 2014 18:39:31 +0000 (11:39 -0700)]
Add --no-verify to git commit call for arc patch

Summary: I can't find an analogous flag for hg.

Test Plan: I don't have any precommit hooks set up on my machine so I can't test this easily, but I think this seems pretty harmless?

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd constants and class methods to `php_compat_info.json`.
Joshua Spence [Mon, 16 Jun 2014 15:00:23 +0000 (01:00 +1000)]
Add constants and class methods to `php_compat_info.json`.

Summary: Allows the `ArcanistXHPASTLinter` to determine whether constants can be used, based on the target PHP version. Also added class methods to the compatibility information, although this isn't used yet (it is small anyway).

Test Plan: Created a test file that contained the `JSON_PRETTY_PRINT` constant. Verified that a linter error was raised.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoUpdate `update_compat_info.php` to use PHP_CompatInfo version 3
Joshua Spence [Mon, 16 Jun 2014 14:30:16 +0000 (00:30 +1000)]
Update `update_compat_info.php` to use PHP_CompatInfo version 3

Summary:
Fixes T5377. The current `scripts/update_compat_info.php` script works for PHP CompatInfo version 2, but doesn't work with the newer version 3.

There are a few breaking changes in version 3 that had to be addressed:

- PHP 5.3 is required. Whilst Arcanist is generally compatible with PHP 5.2, I don't think that having this dependency presents any real issues because it is purely a development tool that is rarely updated.
- [[https://getcomposer.org/ | Composer]] is used for packaging, which makes including the library slightly more complicated. Basically, I had to install `PHP_CompatInfo` globally with Composer (`composer global require "bartlett/php-compatinfo"` and then symlink `~/.composer/vendor` into `externals/includes`.

Test Plan: Compared the `resources/php_compat_info.json` file. There are a bunch of functions/classes that //were// in this file but are no longer, but I think that I've covered the most popular extensions.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5377

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

12 years agoMade some additional methods final.
Joshua Spence [Mon, 16 Jun 2014 14:30:04 +0000 (00:30 +1000)]
Made some additional methods final.

Summary: Just some minor tidying up. I don't think that these methods should ever be overridden in subclasses.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoAdd a unit test to check `src/__phutil_library_map__.php`.
Joshua Spence [Sun, 15 Jun 2014 19:42:43 +0000 (05:42 +1000)]
Add a unit test to check `src/__phutil_library_map__.php`.

Summary: See D9557. Add a unit test to ensure that `src/__phutil_library_map__.php` is up-to-date.

Test Plan: Ran `arc unit`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoRestore PEP8 errors.
Joshua Spence [Sun, 15 Jun 2014 18:50:59 +0000 (04:50 +1000)]
Restore PEP8 errors.

Summary: As per the TODO comment, now that `.arclint` is more mature, we should be able to restore PEP8 errors.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

12 years agoFix `ArcanistLesscLinter::getVersion` function.
Joshua Spence [Sun, 15 Jun 2014 18:50:15 +0000 (04:50 +1000)]
Fix `ArcanistLesscLinter::getVersion` function.

Summary:
This `ArcanistLesscLinter::getCacheVersion` should have been renamed to `getVersion` as of D8971, but wasn't updated.

Also fix the regex to properly capture version information.

Test Plan: It's pretty difficult to test this stuff.... I have an idea that I will submit a separate diff for.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoUpdate `.gitignore`.
Joshua Spence [Sat, 14 Jun 2014 18:44:38 +0000 (11:44 -0700)]
Update `.gitignore`.

Summary: See inline comments for reasoning.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

12 years agoDirty cache of HEAD commit after an amend/range reload
epriestley [Thu, 12 Jun 2014 22:46:15 +0000 (15:46 -0700)]
Dirty cache of HEAD commit after an amend/range reload

Summary:
Introducing `--head` caused us to run `git diff base..head` explicitly.

However, we can now hit this workflow:

  - We resolve `HEAD` as commit `aaaa1`.
  - This is cached.
  - We notice dirty working copy changes and prompt the user to amend them to HEAD.
  - The user accepts the amend.
  - We amend, creating commit `bbbb2`.
  - We dirty the commit range and reload the working copy. This //does not// dirty the cache of HEAD.
  - We run `git diff`, but it uses the old cached HEAD: `git diff base..aaaa1`.
  - This works fine (`aaaa1` still exists, it's just not on any branch) but produces the wrong diff (without amended changes).

To resolve this, implement the "dirty the cache when the range reloads" hook.

Also never try to amend if the user provides `--head`.

Test Plan:
Ran `arc diff --only --trace` in a working copy with a new commit and some uncommitted changes.

  - Prior to this change, saw a `git diff base..aaaa1` command and the wrong diff.
  - After this change, saw a `git diff base..bbbb2` command and the correct diff.

Reviewers: chad, csilvers, talshiri

Reviewed By: talshiri

Subscribers: epriestley, spicyj

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

12 years agoTweak error and status messages for commit ranges
epriestley [Wed, 11 Jun 2014 23:35:50 +0000 (16:35 -0700)]
Tweak error and status messages for commit ranges

Summary: Improve/clarify some error messages a bit, hopefully.

Test Plan: Ran `arc which`, `arc diff`, etc., with various explicit, implicit, and `--head` flags. Read error messages, didn't catch anything too awkward.

Reviewers: talshiri

Reviewed By: talshiri

Subscribers: epriestley

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

12 years ago--range support for git
Tal Shiri [Wed, 11 Jun 2014 21:37:01 +0000 (14:37 -0700)]
--range support for git

Summary:
This adds support for passing range of commits for arc diff. This is useful when you want to submit code reviews for past commits without mucking around with the working copy.

This will probably require changes :)

Test Plan: Tested locally, but totally need to add tests for this

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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