]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
13 years agoSpeedup implicit fallthrough lint rule by 99.5 %
vrana [Fri, 22 Feb 2013 21:49:16 +0000 (13:49 -0800)]
Speedup implicit fallthrough lint rule by 99.5 %

Summary: At least on my sample file.

Test Plan: Saw time 0.073 s instead of 12.606 s.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix arc diff --verbatim
vrana [Fri, 22 Feb 2013 20:33:31 +0000 (12:33 -0800)]
Fix arc diff --verbatim

13 years agoDeclare that amend and land are supported by Mercurial
vrana [Fri, 22 Feb 2013 18:14:44 +0000 (10:14 -0800)]
Declare that amend and land are supported by Mercurial

Test Plan: Read it.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoCreate a new diff if the user says so
vrana [Fri, 22 Feb 2013 17:48:33 +0000 (09:48 -0800)]
Create a new diff if the user says so

Summary: If I have //Differential Revision// in my commit message then `arc diff --create` updates that revision instead of creating a new one.

Test Plan:
  $ arc diff --create # on top of commit message with Differential Revision

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoLog two times per linter instead of N
vrana [Fri, 22 Feb 2013 17:21:07 +0000 (09:21 -0800)]
Log two times per linter instead of N

Summary: This number seems more interesting and it includes time for resolving futures which is the main part of some linters.

Test Plan:
  $ arc --trace lint

Reviewers: fdeliege, epriestley

Reviewed By: epriestley

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

13 years agoAdd hgsprintf() and jsprintf() to dynamic string lint warning
epriestley [Fri, 22 Feb 2013 00:44:34 +0000 (16:44 -0800)]
Add hgsprintf() and jsprintf() to dynamic string lint warning

Summary: Soon all functions will accept only static parameters! glorious!

Test Plan: Added a couple tests.

Reviewers: vrana

Reviewed By: vrana

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

13 years agoRemove hgsprintf() from arcanist
epriestley [Fri, 22 Feb 2013 00:44:19 +0000 (16:44 -0800)]
Remove hgsprintf() from arcanist

Summary: Moving to libphutil.

Test Plan: unit

Reviewers: vrana

Reviewed By: vrana

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

13 years agoMake ArcanistLintWorkflow final
vrana [Thu, 21 Feb 2013 20:35:43 +0000 (12:35 -0800)]
Make ArcanistLintWorkflow final

Summary: FB doesn't extend it.

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoCall willLintPath() in future linter
vrana [Thu, 21 Feb 2013 09:22:25 +0000 (01:22 -0800)]
Call willLintPath() in future linter

Summary: Also simplify creating futures.

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, s.o.butler
Differential Revision: https://secure.phabricator.com/D5042

13 years agoUse Damerau-Levenshtein to improve british spellings
epriestley [Thu, 21 Feb 2013 18:16:02 +0000 (10:16 -0800)]
Use Damerau-Levenshtein to improve british spellings

Summary: Price transpositions very cheaply. We might need to edit these weights a bit, but this covers the two previous cases ("test", "alnd") and gets them right.

Test Plan: Unit tests, various `arc x` tests.

Reviewers: vrana

Reviewed By: vrana

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

13 years agoFix filter/sort order of operations for british spellings
epriestley [Thu, 21 Feb 2013 18:15:20 +0000 (10:15 -0800)]
Fix filter/sort order of operations for british spellings

Summary: Currently, if we match "alnd" to "land" and "amend" equally (distance 2), we drop "land" with the other part of the rule. Stop doing that.

Test Plan:
Unit tests. Also:

```
$ arc alnd
Usage Exception: Unknown command 'alnd'. Try 'arc help'.

Did you mean:
    amend
    land
```

Reviewers: vrana

Reviewed By: vrana

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

13 years agoUse full message if XHPAST fails to parse the file
vrana [Thu, 21 Feb 2013 09:44:48 +0000 (01:44 -0800)]
Use full message if XHPAST fails to parse the file

Summary:
The message is too defensive.

Test Plan: Tested in the fork.

Reviewers: epriestley, nh

Reviewed By: epriestley

CC: aran, Korvin, s.o.butler
Differential Revision: https://secure.phabricator.com/D5043

13 years agoResolve XHPAST linter futures on background
vrana [Tue, 19 Feb 2013 21:42:09 +0000 (13:42 -0800)]
Resolve XHPAST linter futures on background

Summary: This is a little bit tricky - if both XHPAST and PhutilXHPAST linters lint the same path then they get the same future wrapped in two different Future iterators.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDelete newLintAtLine()
vrana [Fri, 8 Feb 2013 22:30:25 +0000 (14:30 -0800)]
Delete newLintAtLine()

Summary: Nobody needs it because `raiseLintAtLine()` returns the message.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agofix 'arc feature' not creating bookmarks on mercurial
durham [Thu, 21 Feb 2013 04:06:16 +0000 (20:06 -0800)]
fix 'arc feature' not creating bookmarks on mercurial

Summary:
The arc feature command wasn't actually creating bookmarks
on mercurial. It needs to call 'hg bookmark' instead of 'hg update'

Also removed an unnecessary hgsprintf since there were no arguments.

Test Plan:
Ran 'arc feature foo' and 'arc feature bar tip^'.
The former created a bookmark at my current location.
The latter created a bookmark at tip^ and moved me to that revision.

Reviewers: vrana, epriestley

Reviewed By: epriestley

CC: sid0, bos, dschleimer, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5023

13 years agoRemove dead class from library map.
epriestley [Wed, 20 Feb 2013 23:10:34 +0000 (15:10 -0800)]
Remove dead class from library map.

13 years agoUndumb other generic text linters
epriestley [Wed, 20 Feb 2013 22:36:53 +0000 (14:36 -0800)]
Undumb other generic text linters

Summary:
Make all the broad-spectrum text linters use the new binary check.

I didn't touch `ComprehensiveLintEngine` because it's a nest of vipers and no one has complained; see T2039.

Test Plan: Ran `arc lint` on text files and binaries in a libphutil project (arcanist).

Reviewers: lisp

Reviewed By: lisp

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

13 years agoAdd linting for syntax brought in by unresolved merge conflicts.
Robert Smith [Wed, 20 Feb 2013 22:19:55 +0000 (14:19 -0800)]
Add linting for syntax brought in by unresolved merge conflicts.

Summary:
Add linting capability for detecting files which contain
syntax introduced by unresolved merge conflicts. The detection is
file-type-agnostic (the only requirement is that the file is a text
file).

Test Plan:
Tested in three ways.

The first way is to add all three forms of syntax to a file to
indicate a merge conflict. HPHP will pick this up as a syntax error
before this linter reaches it.

The second way is to add the syntax in a comment. In that case, this
linter will show three warnings. For example:

    $ arc lint ArcanistMergeConflictLinter.php
    >>> Lint for arcanist/src/lint/linter/ArcanistMergeConflictLinter.php:

       Warning  (MERGECONFLICT1) Unresolved merge conflict
        This syntax indicates there is still an unresolved merge conflict.

                  20
                  21     foreach ($lines as $lineno => $line) {
                  22 /*
        >>>       23 >>>>>>>
                  24
                  25 =======

       Warning  (MERGECONFLICT1) Unresolved merge conflict
        This syntax indicates there is still an unresolved merge conflict.

                  22 /*
                  23 >>>>>>>
                  24
        >>>       25 =======
                  26
                  27 <<<<<<<

       Warning  (MERGECONFLICT1) Unresolved merge conflict
        This syntax indicates there is still an unresolved merge conflict.

                  24
                  25 =======
                  26
        >>>       27 <<<<<<<
                  28
                  29 */

The last test was to test on various different file types, including
JavaScript, PHP, an animated GIF, a PNG, and a Bash file to make sure
the file type detection worked. Each of the aforementioned tests
passed.

Reviewers: vrana, epriestley

Reviewed By: epriestley

CC: aran, epriestley, Korvin
Maniphest Tasks: T2547

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

13 years agoFix issue with SVN property changes under Windows
epriestley [Wed, 20 Feb 2013 21:24:14 +0000 (13:24 -0800)]
Fix issue with SVN property changes under Windows

Summary: We were incorrectly matching `$` in the regexp against a possible `\r\n`. I missed this earlier when trying to catch all of these.

Test Plan:
  - Added unit test and made it pass.
  - Did another search for `getLine()` to see if I could spot any more of these, but failed to identify any via inspection.

Reviewers: vrana, mbishopim3

Reviewed By: mbishopim3

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

13 years agoSimplify (?) arc upload code and make it more future-oriented
epriestley [Wed, 20 Feb 2013 20:24:32 +0000 (12:24 -0800)]
Simplify (?) arc upload code and make it more future-oriented

Summary: See discussion in D4968. This makes us run `file.uploadhash` calls in parallel, to slightly improve performance.

Test Plan:
Created a binary change in a commit:

  $ head -c65535 /dev/urandom > a_random_file
  $ git add .
  $ git commit -m .
  [master 32e4c0a] .
   1 files changed, 0 insertions(+), 0 deletions(-)
   create mode 100644 a_random_file

Verified `arc diff` called `conduit.query`, then `file.uploadhash` (which we expect to fail; the file is new), then `file.upload`:

  $ arc diff HEAD^ --only --trace
  ...
  Uploading 1 files...
  >>> [15] <conduit> conduit.query() <bytes = 157>
  >>> [16] <http> http://local.aphront.com/api/conduit.query
  <<< [16] <http> 111,500 us
  <<< [15] <conduit> 112,169 us
  >>> [17] <conduit> file.uploadhash() <bytes = 254>
  >>> [18] <http> http://local.aphront.com/api/file.uploadhash
  <<< [18] <http> 85,386 us
  <<< [17] <conduit> 85,798 us
  >>> [19] <conduit> file.upload() <bytes = 97009>
  >>> [20] <http> http://local.aphront.com/api/file.upload
  <<< [20] <http> 144,098 us
  <<< [19] <conduit> 144,550 us
  Uploaded 'a_random_file' (new).
  Upload complete.
  ...
  Created a new Differential diff:
          Diff URI: http://local.aphront.com:8080/differential/diff/202/

  Included changes:
    A (bin) a_random_file

Created the same diff again, verified that we skip the data transfer this time:

  $ arc diff HEAD^ --only --trace
  ...
  Uploading 1 files...
  >>> [15] <conduit> conduit.query() <bytes = 157>
  >>> [16] <http> http://local.aphront.com/api/conduit.query
  <<< [16] <http> 112,717 us
  <<< [15] <conduit> 113,374 us
  >>> [17] <conduit> file.uploadhash() <bytes = 254>
  >>> [18] <http> http://local.aphront.com/api/file.uploadhash
  <<< [18] <http> 95,545 us
  <<< [17] <conduit> 95,921 us
  Uploaded 'a_random_file' (new).
  Upload complete.
  ...
  Created a new Differential diff:
          Diff URI: http://local.aphront.com:8080/differential/diff/203/

  Included changes:
    A (bin) a_random_file

Created a new commit which adds a new file and updates the exiting file:

  $ head -c65535 /dev/urandom > another_file
  $ head -c65535 /dev/urandom >> a_random_file
  $ git add .
  $ git commit -m .
  [master 28f4fbd] .
   2 files changed, 0 insertions(+), 0 deletions(-)
   create mode 100644 another_file

Verified `arc diff` transfers one file by hash (old version of the first file) and two by data (new first file, new second file):

  $ arc diff HEAD^ --only --trace
  ...
  Uploading 3 files...
  >>> [19] <conduit> conduit.query() <bytes = 157>
  >>> [20] <http> http://local.aphront.com/api/conduit.query
  <<< [20] <http> 114,825 us
  <<< [19] <conduit> 115,517 us
  >>> [21] <conduit> file.uploadhash() <bytes = 254>
  >>> [22] <http> http://local.aphront.com/api/file.uploadhash
  >>> [23] <conduit> file.uploadhash() <bytes = 254>
  >>> [24] <http> http://local.aphront.com/api/file.uploadhash
  >>> [25] <conduit> file.uploadhash() <bytes = 253>
  >>> [26] <http> http://local.aphront.com/api/file.uploadhash
  <<< [24] <http> 104,310 us
  <<< [26] <http> 105,211 us
  <<< [25] <conduit> 105,587 us
  <<< [22] <http> 112,631 us
  <<< [25] <conduit> 111,437 us
  Uploaded 'a_random_file' (old).
  <<< [25] <conduit> 111,678 us
  >>> [27] <conduit> file.upload() <bytes = 193912>
  >>> [28] <http> http://local.aphront.com/api/file.upload
  >>> [29] <conduit> file.upload() <bytes = 97379>
  >>> [30] <http> http://local.aphront.com/api/file.upload
  <<< [28] <http> 153,126 us
  <<< [29] <conduit> 161,180 us
  Uploaded 'a_random_file' (new).
  <<< [30] <http> 678,739 us
  <<< [29] <conduit> 679,121 us
  Uploaded 'another_file' (new).
  Upload complete.
  ...
  Created a new Differential diff:
          Diff URI: http://local.aphront.com:8080/differential/diff/204/

  Included changes:
    M (bin) a_random_file
    A (bin) another_file

Ran the same command again, verified three uploads by hash:

  $ arc diff HEAD^ --only --trace
  ...
  Uploading 3 files...
  >>> [19] <conduit> conduit.query() <bytes = 157>
  >>> [20] <http> http://local.aphront.com/api/conduit.query
  <<< [20] <http> 117,058 us
  <<< [19] <conduit> 117,792 us
  >>> [21] <conduit> file.uploadhash() <bytes = 254>
  >>> [22] <http> http://local.aphront.com/api/file.uploadhash
  >>> [23] <conduit> file.uploadhash() <bytes = 254>
  >>> [24] <http> http://local.aphront.com/api/file.uploadhash
  >>> [25] <conduit> file.uploadhash() <bytes = 253>
  >>> [26] <http> http://local.aphront.com/api/file.uploadhash
  <<< [22] <http> 103,373 us
  <<< [24] <http> 105,418 us
  <<< [26] <http> 105,251 us
  <<< [25] <conduit> 105,604 us
  Uploaded 'a_random_file' (old).
  <<< [25] <conduit> 105,844 us
  Uploaded 'a_random_file' (new).
  <<< [25] <conduit> 106,053 us
  Uploaded 'another_file' (new).
  Upload complete.
  ...
  Created a new Differential diff:
          Diff URI: http://local.aphront.com:8080/differential/diff/205/

  Included changes:
    M (bin) a_random_file
    A (bin) another_file
  $

Reviewers: kwadwon

Reviewed By: kwadwon

CC: aran
Maniphest Tasks: T2456

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

13 years agoLog slow linters using service call
François Deliège [Tue, 5 Feb 2013 01:25:37 +0000 (17:25 -0800)]
Log slow linters using service call

Summary:
Following @epriestley suggestion to use PhutilServiceProfiler to log lint as a service call

Test Plan: arc lint

Reviewers: vrana

CC: phunt, aran, epriestley
Differential Revision: https://secure.phabricator.com/D4820

13 years agoApply new whitespace lint rules to arcanist/
epriestley [Tue, 19 Feb 2013 22:09:20 +0000 (14:09 -0800)]
Apply new whitespace lint rules to arcanist/

Summary: Automated changes from `arc lint`.

Test Plan: Looked them over.

Reviewers: vrana

Reviewed By: vrana

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

13 years agoAdd a lint rule for spaces before the closing paren of a function/method call
epriestley [Tue, 19 Feb 2013 21:50:13 +0000 (13:50 -0800)]
Add a lint rule for spaces before the closing paren of a function/method call

Summary: This is technically documented, but not currently enforced and we aren't consistent about it in the codebase.

Test Plan: See D5002.

Reviewers: chad, vrana

Reviewed By: chad

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

13 years agoImprove mercurial 'arc land' perf by avoiding updates
durham [Tue, 19 Feb 2013 21:36:02 +0000 (13:36 -0800)]
Improve mercurial 'arc land' perf by avoiding updates

Summary:
Mercurial 'arc land --hold' was taking 90+ seconds on our large
repository.  Since most of arc land doesn't require any particular working
directory, I've changed the mercurial logic to avoid all updates except for
two: the one prior to finding the revision (only applies if the user specified
--branch), and the one at the end to leave the user in a good state.

Also got rid of a 'hg outgoing' call when phases are supported. Also changed
the hg-subversion detection to just look for .hg/svn instead of running 'hg
svn info', which was taking 4 seconds.

Now arc land takes about 50 seconds. Still much worse than git's 25 seconds.
One big hot spot is in the two 'hg rebase' calls, which account for 25 seconds
(versus 11 seconds of git).

Test Plan:
Tested arc land with mercurial and git. Tested with and without the --branch
options.

Reviewers: epriestley, bos, sid0, dschleimer

Reviewed By: epriestley

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

13 years agoFix visibility of future linter methods
vrana [Tue, 19 Feb 2013 21:09:34 +0000 (13:09 -0800)]
Fix visibility of future linter methods

13 years agoRun PEP8 linter on background
vrana [Fri, 15 Feb 2013 00:16:08 +0000 (16:16 -0800)]
Run PEP8 linter on background

Test Plan:
  $ arc lint pep8.py --cache 0 --engine ComprehensiveLintEngine --trace

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoParse property change diffs generated with old SVN (prior to 1.5)
epriestley [Tue, 19 Feb 2013 15:32:57 +0000 (07:32 -0800)]
Parse property change diffs generated with old SVN (prior to 1.5)

Summary:
Fixes T2565. SVN from before June 2008 generates different looking property changes.

See http://subversion.tigris.org/issues/show_bug.cgi?id=3019 for the change.

Test Plan: Added a unit test derived from the report in T2565, made it pass.

Reviewers: chad, vrana

Reviewed By: chad

CC: aran
Maniphest Tasks: T2565

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

13 years agoFix another SVN issue with "@" files
epriestley [Mon, 18 Feb 2013 16:24:47 +0000 (08:24 -0800)]
Fix another SVN issue with "@" files

Summary: This chunk of code is kind of iffy and not really correct, but make it not fail, at least.

Test Plan:
  - Added a file named `swamp@2x.jpg` to a working copy.
  - Used `svn propedit svn:mime-type swamp@2x.jpg@` to incorrectly set its mime type to `text/plain`.
  - Ran `arc diff`.
  - Saw `arc diff` "correctly" change its mime-type to a binary mime type. This isn't really correct, but doing it successfully is better than throwing an exception.

Reviewers: mbishopim3, chad

Reviewed By: mbishopim3

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

13 years agoArc diff tries to upload files it knows about using a content hash rather than transf...
kwadwo [Sun, 17 Feb 2013 22:30:43 +0000 (14:30 -0800)]
Arc diff tries to upload files it knows about using a content hash rather than transfering data.

Summary:
Arc diff will hash file data and try to upload the file using upload by hash rather than transferring data. If it is unable, it defaults to its normal behavior

Attempts to upload file by hash, use regular upload method otherwise

Test Plan: Figure out how to arc diff to my local install and look at the behavior

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix "none" in SVN XML summary
epriestley [Fri, 15 Feb 2013 22:53:31 +0000 (14:53 -0800)]
Fix "none" in SVN XML summary

Summary: The `svn diff --xml --summarize` command reports a bunch of item statuses, which may include "none" if you make property changes to a directory (this is fairly rare).

Test Plan: Created property changes, saw "none" status.

Reviewers: chad, mbishopim3

Reviewed By: chad

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

13 years agoFix various SVN escaping issues in arc patch
epriestley [Fri, 15 Feb 2013 22:53:25 +0000 (14:53 -0800)]
Fix various SVN escaping issues in arc patch

Summary: Followup to D4703. When we give paths to `svn`, we need to escape them if they contain an `@`.

Test Plan:
Created a patch full of modifications to files with `@` in their names, and applied it:

  $ arc patch --diff 192
  A         A@2xcopy2
  A         A@2xcopy
  D         A@2x
   OKAY  Successfully applied patch to the working copy.

Reviewers: chad, mbishopim3

Reviewed By: chad

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

13 years agoDon't run disabled lint rules in other linters.
vrana [Thu, 14 Feb 2013 23:49:22 +0000 (15:49 -0800)]
Don't run disabled lint rules in other linters.

Summary: D4963 for other linters.

Test Plan: Saw time 0.001 instead of 0.113 in spellcheck linter.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDon't run disabled lint rules
vrana [Thu, 14 Feb 2013 23:18:39 +0000 (15:18 -0800)]
Don't run disabled lint rules

Summary:
We always generate all messages and then filter them out based on minimum severity.
It's lots of useless work, especially in commit hook mode where we are interested only in errors.

Test Plan:
  $ arc lint --cache 0 --severity error ArcanistXHPASTLinter.php
  0.406 s before, 0.074 after

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix "arc:this" and "arc:amended" base rules after D4838
epriestley [Thu, 14 Feb 2013 21:57:34 +0000 (13:57 -0800)]
Fix "arc:this" and "arc:amended" base rules after D4838

Summary:
After D4383, we escape the base commit when constructing a command like this:

  hg log --rev (base::. - base)

However, if the base commit is a revset like ".^", we now escape it and Mercurial looks for a commit named ".^" (a valid mercurial branch name) instead.

Fix this by returning nodes for these rules instead of revsets. The "arc:this" rule is automatically used in some operations, like "arc amend", so users can hit this during normal workflows, not just with weird `--base` rules.

Test Plan: Ran "arc amend" in a Mercurial repository, didn't fatal out.

Reviewers: DurhamGoode, sid0

Reviewed By: DurhamGoode

CC: tido, aran
Differential Revision: https://secure.phabricator.com/D4949

13 years agoDecide whether to commit or amend with arc diff -a
Jakub Vrana [Thu, 14 Feb 2013 18:32:30 +0000 (10:32 -0800)]
Decide whether to commit or amend with arc diff -a

Test Plan:
  $ arc diff -a
  $ arc diff -a # saw amend instead of a new commit

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoRespect granularity in reading cached lint messages
vrana [Wed, 6 Feb 2013 23:27:31 +0000 (15:27 -0800)]
Respect granularity in reading cached lint messages

Summary:
We save repository version to lint cache but ignore it when reading the cache.
Fix it.

Test Plan: Made an error for linter with repo granularity, deleted the error from the cache. Relinted, didn't see the error. Changed another file and relinted, saw the error.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix hg 'arc land' when the mq extension is not enabled
durham [Thu, 14 Feb 2013 19:37:49 +0000 (11:37 -0800)]
Fix hg 'arc land' when the mq extension is not enabled

Summary:
Mercurial 'arc land' uses the 'hg strip' command to clean up after
itself, but this command isn't available unless the mq extension is enabled.
The fix is to enable it for that particular command only.

Test Plan: Ran 'arc land' with the mq extension disabled.  It worked.

Reviewers: epriestley, bos, sid0, dschleimer

Reviewed By: epriestley

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

13 years agoSupport `arc bookmark` in Mercurial
vrana [Thu, 31 Jan 2013 01:33:32 +0000 (17:33 -0800)]
Support `arc bookmark` in Mercurial

Summary:
Branch in Mercurial means something else.
Hopefully users wouldn't be too confused.

Test Plan:
  $ arc help
  $ arc help branch
  $ arc help feature
  $ arc feature
  $ arc bookmark
  $ arc branch
  # In hg repo:
  $ arc feature
  $ arc feature new
  $ arc feature new

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2332

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

13 years agoHandle safe HTML in intraline renderer
vrana [Wed, 13 Feb 2013 08:33:14 +0000 (00:33 -0800)]
Handle safe HTML in intraline renderer

Test Plan: Used it in Phabricator.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2432

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

13 years agoAdd lint warning for $o->m()[0], not just f()[0]
epriestley [Tue, 12 Feb 2013 15:07:35 +0000 (07:07 -0800)]
Add lint warning for $o->m()[0], not just f()[0]

Summary: We only caught half of this.

Test Plan: Unit test.

Reviewers: edward

Reviewed By: edward

CC: aran
Maniphest Tasks: T1261

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

13 years agoMerge PHT into dynamic string linter
vrana [Tue, 12 Feb 2013 02:46:02 +0000 (18:46 -0800)]
Merge PHT into dynamic string linter

Test Plan: Existing unit test.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoApply rtrim() to arc:upstream
epriestley [Mon, 11 Feb 2013 23:58:47 +0000 (15:58 -0800)]
Apply rtrim() to arc:upstream

Summary: Git spits these out with \n at the end.

Test Plan:
```
>>> orbital ~/devtools/arcanist $ git branch --set-upstream trim master
Branch trim set up to track local branch master.
>>> orbital ~/devtools/arcanist $ arc which --base arc:upstream
RELATIVE COMMIT
If you run 'arc diff', changes between the commit:

    acf7600e6e728395  Temporarily restore apache/license linters

...and the current working copy state will be sent to Differential, because
it is the merge-base of the upstream of the current branch and HEAD, and
matched the rule 'arc:upstream' in your args 'base' configuration.

You can see the exact changes that will be sent by running this command:

    $ git diff acf7600e6e728395..HEAD

These commits will be included in the diff:

    3580555e4b30598f  WIP

MATCHING REVISIONS
These Differential revisions match the changes in this working copy:

    (No revisions match.)

Since there are no revisions in Differential which match this working copy, a
new revision will be created if you run 'arc diff'.
```

Reviewers: brennantaylor

Reviewed By: brennantaylor

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

13 years agoTemporarily restore apache/license linters
epriestley [Mon, 11 Feb 2013 22:12:10 +0000 (14:12 -0800)]
Temporarily restore apache/license linters

Summary:
Restores linters only, without unit tests or entry in ComprehensiveLinter. Marks them deprecated.

If use at Facebook isn't widespread I'd prefer to simply delete them.

Test Plan: none

Reviewers: vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T2274

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

13 years agoSupport short version of arc diff --add-all
vrana [Mon, 11 Feb 2013 18:51:17 +0000 (10:51 -0800)]
Support short version of arc diff --add-all

Summary: Like `git commit -a`.

Test Plan:
  $ arc diff -a

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoSupport short version of arc diff --add-all
vrana [Mon, 11 Feb 2013 18:47:31 +0000 (10:47 -0800)]
Support short version of arc diff --add-all

Summary: Like `git commit -a`.

Test Plan:
  $ arc diff -a

Reviewers: epriestley

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

13 years agoAllow configuring PhutilXHPAST linter
vrana [Sun, 10 Feb 2013 14:35:25 +0000 (06:35 -0800)]
Allow configuring PhutilXHPAST linter

Summary: Also move Phabricator stuff outside.

Test Plan: Updated unit test.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDelete license linters.
Bryan Cuccioli [Mon, 11 Feb 2013 17:04:19 +0000 (09:04 -0800)]
Delete license linters.

Summary: Remove all references to ArcanistLicenseLinter and ArcanistApacheLicenseLinter.

Test Plan: Rerun the linter and ensure nothing is broken.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMinor, fix an exception variable.
epriestley [Mon, 11 Feb 2013 12:54:20 +0000 (04:54 -0800)]
Minor, fix an exception variable.

Auditors: DurhamGoode

13 years agoDeprecate phutil_escape_html()
vrana [Sat, 9 Feb 2013 23:04:20 +0000 (15:04 -0800)]
Deprecate phutil_escape_html()

Summary:
My original idea was to return safe HTML from this function.
But we are down to 20 occurrences in Phabricator and you shouldn't need this function in safe HTML world at all.

Test Plan:
  $ arc lint src/applications/audit/controller/PhabricatorAuditListController.php

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoSupport arc diff --edit under hg
Nick Pellegrino [Sat, 9 Feb 2013 19:24:54 +0000 (11:24 -0800)]
Support arc diff --edit under hg

Summary: T1571

Test Plan: epriestley says it works

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdd lint warnings about use of phutil_render_tag and javelin_render_tag
epriestley [Sat, 9 Feb 2013 01:38:56 +0000 (17:38 -0800)]
Add lint warnings about use of phutil_render_tag and javelin_render_tag

Summary: Raise deprecation warnings for these methods. I won't commit this until the phutil_tag branch merges.

Test Plan: Unit tests.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T2432

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

13 years agoDisplay other locations of Reused lint errors
vrana [Fri, 8 Feb 2013 23:04:32 +0000 (15:04 -0800)]
Display other locations of Reused lint errors

Summary: It's not trivial to find them inside 700+ lines long functions.

Test Plan:
Linted `reused-iterators.lint-test` renamed to `_.php`, saw other locations.
Repeated for `reused-local.lint-test`.
Repeated for `duplicate-key-in-array.lint-test`.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMake 'arc diff X' in mercurial match git by using the GCA of X as the base
durham [Fri, 8 Feb 2013 15:09:30 +0000 (07:09 -0800)]
Make 'arc diff X' in mercurial match git by using the GCA of X as the base

Summary:
Previously 'arc diff X' with mercurial meant to use X as the base
to diff against.  Now it means use gca(X,working directory) as the base to
diff against.  This matches the git behavior.

Test Plan:
Ran 'arc diff master' on a repo where master was ahead of the feature branch.
Verified that the diff result included only the diffs in the feature branch.

Reviewers: epriestley, sid0, bos, dschleimer

Reviewed By: epriestley

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

13 years agoImprove performance of mercurial arc diff
durham [Fri, 8 Feb 2013 13:54:32 +0000 (05:54 -0800)]
Improve performance of mercurial arc diff

Summary:
arc diff on large mercurial repos was taking 14 seconds just to get
to the commit message prompt.  With these optimizations it takes 4.

- "ancestor(.) - ancestor(XYZ)" is expensive because it has to build the
entire 400000+ revision history for both.  "XYZ::. - XYZ" is much cheaper
because it only looks at the revisions between XYZ and the working directory.

- "hg outgoing" has to talk to the server, which is slow.  "hg log -r draft()"
gives us the same information and is much cheaper.  We fall back to 'outgoing'
on older versions of mercurial.

Of the remaining 4 seconds, 2.5 are spent in 'hg status', which is a bit harder
improve.

Test Plan: Ran arc diff on our hg repo. Verified it ran faster and the diff was created.

Reviewers: epriestley, sid0, bos, dschleimer

Reviewed By: epriestley

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

13 years agoUpload binary files diffs in parallel
vrana [Thu, 7 Feb 2013 04:24:31 +0000 (20:24 -0800)]
Upload binary files diffs in parallel

Summary: Makes sense after D2471.

Test Plan:
Swapped two binary files, ran `arc diff --only`.
Saw time 3.797 s instead of 4.361 s.

Changed `file.upload` to `file.uploa`, saw proper error.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoRestore kept branch after landing
vrana [Thu, 7 Feb 2013 02:44:55 +0000 (18:44 -0800)]
Restore kept branch after landing

Test Plan: Ran it separately.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoImprove error message for phutil missing symbols
epriestley [Thu, 7 Feb 2013 03:11:06 +0000 (19:11 -0800)]
Improve error message for phutil missing symbols

Summary: This is fairly confusing. Make the error message suggest the common remedy (update libphutil).

Test Plan: Eyeballed it.

Reviewers: Afaque_Hussain, btrahan, vrana

Reviewed By: Afaque_Hussain

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

13 years agoMake "arc patch" read `authorName` and `authorEmail`
epriestley [Wed, 6 Feb 2013 04:11:39 +0000 (20:11 -0800)]
Make "arc patch" read `authorName` and `authorEmail`

Summary: If provided, have `arc patch` use `authorName` / `authorEmail`. This simplifies handling and makes patches more portable between version control systems (previously, information was generated in the diff's VCS, regardless of which VCS it was being applied to).

Test Plan: Created a diff with author `derp <derp@derp.com>`, ran `arc patch --diff x`, got a local commit with that author.

Reviewers: btrahan, edward, vrana

Reviewed By: btrahan

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

13 years agoRecord commit email information from `arc`
epriestley [Wed, 6 Feb 2013 04:11:20 +0000 (20:11 -0800)]
Record commit email information from `arc`

Summary:
Record author email information in `arc diff`, so we can recreate it in `arc patch` and elsewhere without creating any kind of email exposure issues.

In Mercurial, we currently store the whole string ("username <email@domain.com>"). Make this consistent with Git.

Test Plan: Created git and hg diffs, saw authorEmail populated.

Reviewers: btrahan, edward, vrana

Reviewed By: btrahan

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

13 years agoImplement hook for checking switch lint
vrana [Tue, 5 Feb 2013 19:00:07 +0000 (11:00 -0800)]
Implement hook for checking switch lint

Summary:
We want to use it for `yield` and `invariant_violation()` which throws.
Having node instead of token would be better but this would be enough.

Test Plan: Implemented a hook in FB repo and added a test case there.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAllow `arc diff` and similar to run on systems with no `git`
epriestley [Mon, 4 Feb 2013 19:34:53 +0000 (11:34 -0800)]
Allow `arc diff` and similar to run on systems with no `git`

Summary:
We assume `git` is available now, but should not. Specifically, if a user runs a working copy operation like `arc list` in an SVN working copy without `git` available, they get this error: P707

We interpret git errors very narrowly; be more liberal in how we interpret them. This assumes users working with `git` will have a functional `git`, but this seems like a reasonable assumption and lets us remove some error text matching code.

Test Plan: Changed `git` to `girt`, ran `arc list`, saw a reasonable exception. Changed back to `git`, saw git detected.

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: svemir, aran
Differential Revision: https://secure.phabricator.com/D4804

13 years agoFix dynamic string usage as safe input
vrana [Mon, 4 Feb 2013 19:27:16 +0000 (11:27 -0800)]
Fix dynamic string usage as safe input

Test Plan: Copied the code in a script, changed `phutil_passthru()` to `echo csprintf()` and ran it.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

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

13 years agoFix dynamic string usage as safe input
vrana [Sun, 3 Feb 2013 23:00:23 +0000 (15:00 -0800)]
Fix dynamic string usage as safe input

Summary: I somehow missed it.

Test Plan: Sent this diff by different copy of Arcanist.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix dynamic string usage as safe input
vrana [Sat, 2 Feb 2013 21:07:39 +0000 (13:07 -0800)]
Fix dynamic string usage as safe input

Summary: This fixes some real issues.

Test Plan:
  $ arc lint

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoLint dynamic string usage in parameters treated as safe
vrana [Sat, 2 Feb 2013 20:33:22 +0000 (12:33 -0800)]
Lint dynamic string usage in parameters treated as safe

Summary:
This disallows code like this:

  $cmd = 'ls';
  execx($cmd);

But I guess it's not that big deal?

Test Plan: Linted whole Arcanist and Phabricator codebases, most parts looks fixable.

Reviewers: epriestley

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

13 years agoDispatch event after collecting changes in diff
vrana [Fri, 1 Feb 2013 22:59:09 +0000 (14:59 -0800)]
Dispatch event after collecting changes in diff

Summary:
FB currently starts Sandcastle push before starting the diff workflow.
If `arc diff` commits something then we need to restart the push.
I want to avoid this by starting the push after commit.

Test Plan: Will test after implementing the listener.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdd typehint to setting workflow configuration
vrana [Fri, 1 Feb 2013 19:47:39 +0000 (11:47 -0800)]
Add typehint to setting workflow configuration

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoHandle $var::method() in XHPAST linter
vrana [Fri, 1 Feb 2013 19:17:46 +0000 (11:17 -0800)]
Handle $var::method() in XHPAST linter

Test Plan: Didn't see a fatal in new test case.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMake British spelling stricter
vrana [Fri, 1 Feb 2013 00:28:51 +0000 (16:28 -0800)]
Make British spelling stricter

Summary: This is pretty lame but I didn't have a better idea.

Test Plan:
  $ arc test # previously translated as list
  $ arc lst
  $ arc brnach

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix getting changed files in SVN
vrana [Thu, 31 Jan 2013 20:21:26 +0000 (12:21 -0800)]
Fix getting changed files in SVN

Summary:
This is pretty awkward but I don't have anything better.

Also don't compute cache key if caching is disabled.

Test Plan:
  $ svn diff --xml --summarize '' -r 701319:HEAD
  $ svn diff --xml --summarize svn+ssh://tubbs/svnroot/projects/lolbunny -r 701319:HEAD

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDisable pull stat in arc land
vrana [Thu, 31 Jan 2013 01:57:06 +0000 (17:57 -0800)]
Disable pull stat in arc land

Test Plan:
  $ git pull --no-stat

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdd --skip-arcconfig option
Nick Harper [Thu, 31 Jan 2013 00:26:41 +0000 (16:26 -0800)]
Add --skip-arcconfig option

Summary:
Continuation of D4732 - when we don't care about loading an arcconfig,
allow that to be specified.

Test Plan: chmod -r .arcconfig; bin/arc help --skip-arcconfig

Reviewers: epriestley, vrana

Reviewed By: epriestley

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

13 years agoMove `isConstantString()` to base class
vrana [Wed, 30 Jan 2013 20:24:41 +0000 (12:24 -0800)]
Move `isConstantString()` to base class

Summary: This can be useful by itself, we want to use it in FB linter.

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoSplit php-tags-bad.lint-test to two tests
vrana [Wed, 30 Jan 2013 20:44:06 +0000 (12:44 -0800)]
Split php-tags-bad.lint-test to two tests

Summary: D1818 effectivelly disabled this test case.

Test Plan: This diff.

Reviewers: epriestley, nh

Reviewed By: epriestley

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

13 years agoExpose `--coverage` and `--no-coverage` flags from `arc diff`
epriestley [Wed, 30 Jan 2013 20:35:30 +0000 (12:35 -0800)]
Expose `--coverage` and `--no-coverage` flags from `arc diff`

Summary: Currently, we don't expose these at top level, so you can't disable coverage if your coverage is explosively broken. Expose them as passthrough arguments.

Test Plan:

  - Touched a file in `arc` which triggered unit tests.
  - Without `xdebug` installed:
    - Ran `arc diff --preview`, `arc diff --preview --no-coverage` (both fine).
    - Ran `arc diff --preview --coverage`, got exception about coverage not being available.
  - Installed `xdebug`.
    - Ran `arc diff --preview`, got coverage.
    - Ran `arc diff --preview --coverage`, got coverage.
    - Ran `arc diff --preview --no-coverage`, no coverage.

Reviewers: indiefan, btrahan, vrana

Reviewed By: vrana

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

13 years agoUse all changed files since base revision in repository cache key
vrana [Tue, 29 Jan 2013 23:57:42 +0000 (15:57 -0800)]
Use all changed files since base revision in repository cache key

Test Plan: Added debug output for repository version, linted, committed, linted again, saw the same version, changed file, saw different version.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoRestore directory after executing ArcanistBundleTestCase
epriestley [Wed, 30 Jan 2013 19:24:41 +0000 (11:24 -0800)]
Restore directory after executing ArcanistBundleTestCase

Summary:
This test currently chdir()'s into a directory which is later removed. If another test tries to run a shell script while the CWD is invalid, the shell may emit this to stderr:

  shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

Among other things, this can cause the XHPAST test to fail, because it detects syntax errors by examining stderr.

Instead, retore the directory.

Test Plan: Ran "arc unit --everything", which could previously fail if XHPAST ran after Bundle.

Reviewers: btrahan, vrana

Reviewed By: vrana

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

13 years agoReset master after unsuccessful push
vrana [Tue, 29 Jan 2013 01:05:09 +0000 (17:05 -0800)]
Reset master after unsuccessful push

Test Plan: None.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoSeparate Phutil specific lint rules from XHPAST
vrana [Tue, 29 Jan 2013 06:03:03 +0000 (22:03 -0800)]
Separate Phutil specific lint rules from XHPAST

Summary: Also provides an example how to build custom linter using XHPAST.

Test Plan: Added debug output to `willLintPaths()`, verified that each path is parsed only once.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAllow running `arc land` after `git svn rebase`
vrana [Mon, 28 Jan 2013 23:54:37 +0000 (15:54 -0800)]
Allow running `arc land` after `git svn rebase`

Summary: `git pull` may fail in git-svn after rebasing (which is a side effect of dcommit).

Test Plan:
  $ git svn rebase
  $ git log trunk..master
  $ git pull --ff-only; echo $?

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoCorrect a bunch of mercurial revset construction
epriestley [Tue, 29 Jan 2013 00:28:14 +0000 (16:28 -0800)]
Correct a bunch of mercurial revset construction

Summary: Possibly improves T2387 state of the world?

Test Plan: not yet

Reviewers: bos, DurhamGoode

Reviewed By: DurhamGoode

CC: aran
Maniphest Tasks: T2387

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

13 years agoProvide hgsprintf() for building hg revsets
epriestley [Tue, 29 Jan 2013 00:27:47 +0000 (16:27 -0800)]
Provide hgsprintf() for building hg revsets

Summary: I guess this is correct? See T2387 for discussion.

Test Plan: Unit tests.

Reviewers: bos, DurhamGoode

Reviewed By: DurhamGoode

CC: aran
Maniphest Tasks: T2387

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

13 years agoIgnore untracked files in lint repository cache key
vrana [Mon, 28 Jan 2013 23:18:12 +0000 (15:18 -0800)]
Ignore untracked files in lint repository cache key

Summary: Some people have 2GB+ untracked files in repo which significantly slows down this or even crashes it.

Test Plan: Added a debug output here and linted repo with untracked path.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agolint_untracked
vrana [Mon, 28 Jan 2013 23:15:18 +0000 (15:15 -0800)]
lint_untracked

13 years agoFix an escaping issue with "svn commit"
epriestley [Mon, 28 Jan 2013 22:11:31 +0000 (14:11 -0800)]
Fix an escaping issue with "svn commit"

Summary: Fixes T2438. We currently escape everything with '@', but SVN rejects that for '.'

Test Plan:
Unit tests. Performed this commit:

  $ svn st
   M      .
  A       x@123
  $ arc commit --conduit-uri=http://local.aphront.com:8080/ --revision 53

      Revision 'D53: asdf' has not been accepted. Commit this revision anyway?
      [y/N] y

  Committing 'D53: asdf'...
  Sending        .
  Adding         x@123
  Transmitting file data .
  Committed revision 37.
  Done.

I grepped for more '@' adding but couldn't find any. It's a bit tricky to grep for though, so it's possible I missed some.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran, mbishopim3
Maniphest Tasks: T2438

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

13 years agoAdded base test result parser class. Implemented Go test result parser based on Go...
indiefan [Mon, 28 Jan 2013 01:16:50 +0000 (17:16 -0800)]
Added base test result parser class. Implemented Go test result parser based on Go's built in test utility output.

Test Plan: Ran PhpunitTestEngine unit test and used both test result parsers to generate test results.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdded paths to search for python linters
Jesse Mullan [Sat, 26 Jan 2013 13:31:25 +0000 (05:31 -0800)]
Added paths to search for python linters

Summary: Added paths to search for python linters

Test Plan: Linted in ubuntu

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2414

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

13 years agoSupport PHPUnit 3.7 message changes
Aurelijus [Sat, 26 Jan 2013 01:19:25 +0000 (17:19 -0800)]
Support PHPUnit 3.7 message changes

Summary: PHPUnit 3.7 now includes user message as well.

Test Plan: Ran phpunit tests

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoRaise a lint warning on array_combine(x, x)
epriestley [Sat, 26 Jan 2013 01:06:49 +0000 (17:06 -0800)]
Raise a lint warning on array_combine(x, x)

Summary: Suggest array_fuse().

Test Plan:
Unit tests, and:

  $ arc lint --lintall src/unit/engine/phutil/ArcanistPhutilTestCase.php
  >>> Lint for src/unit/engine/phutil/ArcanistPhutilTestCase.php:

     Warning  (XHP37) array_combine() Unreliable
      Prior to PHP 5.4, array_combine() fails when given empty arrays. Prefer
      to write array_combine(x, x) as array_fuse(x).

               252     $callable,
               253     $exception_class = 'Exception') {
               254     return $this->tryTestCases(
      >>>      255       array_combine(array_keys($map), array_keys($map)),
               256       array_values($map),
               257       $callable,
               258       $exception_class);

Reviewers: btrahan, vrana, chad

Reviewed By: btrahan

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

13 years agoDecoupling phpunit test parsing from running and gathering. Should enable third party...
indiefan [Sat, 26 Jan 2013 01:06:20 +0000 (17:06 -0800)]
Decoupling phpunit test parsing from running and gathering. Should enable third party test engines to reuse common business logic around phpunit without requiring common logic for the typically application-specific running and gathering.

Test Plan: Ran PhpunitTestEngine unit test. Also used refactored PhpunitTestEngine to run phpunit tests.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix hg arc land on hg-svn repos
durham [Fri, 25 Jan 2013 19:52:14 +0000 (11:52 -0800)]
Fix hg arc land on hg-svn repos

Summary:
arc land on a hg-svn repository would fail because arc land
uses 'hg push -r' to specify which revs to push which is not supported
by hg-svn. Now we just use 'hg push' which, when used against svn, only
pushes the current branch (which happens to be the branch we're trying to land).

We can't use standard 'hg push' for non-svn repos though because when used
against a vanilla hg repo 'hg push' pushes all branches.

Also remove --new-branch from 'hg push' because it's extremely
unlikely that a person wants to create a new branch on the server via
arc land.

Test Plan:
Ran arc land on a normal hg repo, verified it used 'hg push -r'.
Ran arc land on a hg-svn repo, verified it used 'hg push' and it pushed the
correct changes.

Reviewers: epriestley, sid0, dschleimer

Reviewed By: epriestley

CC: bos, aran, Korvin
Maniphest Tasks: T2403

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

13 years agoRevert "Delete useless code in ArcanistBaseWorkflow"
vrana [Fri, 25 Jan 2013 00:32:15 +0000 (16:32 -0800)]
Revert "Delete useless code in ArcanistBaseWorkflow"

This reverts commit rARC501e2b7.
We call this method from FB workflow.
I'll commit it again in two weeks.

13 years agoCache results of repository linters
vrana [Wed, 23 Jan 2013 21:06:45 +0000 (13:06 -0800)]
Cache results of repository linters

Summary:
The cache key is repository base revision and hash of all modified files.
It isn't perfect in SVN where every file might have a different revision.
It's also suboptimal as just committing or amending changes the cache key even if the files contents weren't modified.
We can improve it later, perhaps by using previous revision and files modified since it.

Test Plan:
Changed granularity of XHPAST linter to repository.
Linted the same repo twice, verified that it was read from cache the second file.
Changed a single file, verified that all files were re-linted.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDon't bail on no effect exception
vrana [Thu, 24 Jan 2013 22:45:21 +0000 (14:45 -0800)]
Don't bail on no effect exception

Summary: The main reason for this is to not exit with 1 when no paths are lintable (which is more success than failure).

Test Plan:
Returned empty array from `buildLinters()`, then:

  $ arc lint
  $ echo $? # 0

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix `arc diff --no-ansi`
epriestley [Thu, 24 Jan 2013 22:28:28 +0000 (14:28 -0800)]
Fix `arc diff --no-ansi`

Summary: Currently, we get an exception on empty %Ls for `arc diff --no-ansi` or similar (see P698).

Test Plan: Ran `arc diff --no-ansi`.

Reviewers: vrana, btrahan

Reviewed By: btrahan

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

13 years agoMark deleted paths as removed in committing
vrana [Wed, 23 Jan 2013 21:53:30 +0000 (13:53 -0800)]
Mark deleted paths as removed in committing

Test Plan: Deleted file in Git, ran `arc diff`, confirmed the question, saw the file as deleted.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDelete useless code in ArcanistBaseWorkflow
vrana [Wed, 23 Jan 2013 21:08:58 +0000 (13:08 -0800)]
Delete useless code in ArcanistBaseWorkflow

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdded support for hg diffs generated in git mode
Asher Baker [Wed, 23 Jan 2013 02:13:53 +0000 (18:13 -0800)]
Added support for hg diffs generated in git mode

Summary: Fixes T2112. These are fairly common now, and are used as the storage format for `hg export` and mq in most installs.

Test Plan: Ran unit tests, used `arc patch --patch`, uploaded some diffs manually.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2112

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

13 years agoDon't use xhpast binary to compute xhpastlinter cache version if the binary doesn...
epriestley [Wed, 23 Jan 2013 01:16:37 +0000 (17:16 -0800)]
Don't use xhpast binary to compute xhpastlinter cache version if the binary doesn't exist

Summary: The binary may not be built, in which case this raises a warning.

Test Plan: Will make @zeeg test.

Reviewers: zeeg, vrana

Reviewed By: vrana

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

13 years agoAllow hg arc land when no rebase is necessary
durham [Tue, 22 Jan 2013 22:29:00 +0000 (14:29 -0800)]
Allow hg arc land when no rebase is necessary

Summary:
Previously, trying to arc land in a mercurial repo would
fail if the local branch was already at the tip of the onto branch
(since hg rebase exited with code 1).  This change makes it check
if a rebase is needed before executing the rebase.

Test Plan:
hg init foo
cd foo
hg bookmark master
touch a && hg add a && hg commit -ma
// setup your .arcconfig
cd ..
hg clone foo foo2
cd foo2
hg bookmark mybook
touch b && hg add b && hg commit -mb
arc land --onto master --revision <your rev number>

Arc land should succeed.  I also tried landing when a rebase was
necessary and it still worked.

Reviewers: epriestley, dschleimer, bos

Reviewed By: epriestley

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