]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
13 years agoupdate __phutil_library_map__
Lajos Veres [Tue, 9 Jul 2013 11:48:07 +0000 (12:48 +0100)]
update __phutil_library_map__

13 years agoadd css lint
Lajos Veres [Tue, 9 Jul 2013 11:46:59 +0000 (12:46 +0100)]
add css lint

13 years agoUpdate spelling replacement rule for 'algorithmical'
epriestley [Mon, 8 Jul 2013 16:46:24 +0000 (09:46 -0700)]
Update spelling replacement rule for 'algorithmical'

Summary:
I suspect that when people use 'algorithmical', they mean it as an adjective and not an adverb.

'algorithmic' = adjective
'algorithmically' = adverb

Test Plan: Add the word 'algorithmical' to a file. Run `arc lint` on the file. See suggestion to correct it to 'algorithmic'.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoStop using deprecated Conduit methods in `arc`
epriestley [Tue, 2 Jul 2013 12:47:52 +0000 (05:47 -0700)]
Stop using deprecated Conduit methods in `arc`

Summary:
  - Replace `maniphest.find` with `maniphest.query`. These calls are nearly identical, it was just a rename for consistency.
  - Replace `differential.find` with `differential.query`.

Test Plan:
  - Ran `arc tasks`.
  - Ran `arc close-revision` on valid, nonexistent, and existent-but-invalid revisions.

Reviewers: btrahan

Reviewed By: btrahan

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

13 years agoDon't instantiate abstract classes in ArcanistConfiguration::buildAllWorkflows
Miorel-Lucian Palii [Sat, 29 Jun 2013 01:24:30 +0000 (18:24 -0700)]
Don't instantiate abstract classes in ArcanistConfiguration::buildAllWorkflows

Summary:
I wanted to write a couple of workflows that shared some code in an abstract superclass, but ##arc## would fail trying to instantiate the abstract class.

As it turns out, we can modernize the ##buildAllWorkflows## function a bit, and it will only load concrete objects.

Test Plan:
1. Define an abstract subclass of ##ArcanistBaseWorkflow##.
2. ##arc liberate## the source directory that contains it.
3. Try any ##arc## operation without this diff, and see it fail.
4. Patch this diff and see that ##arc## operations work now.

Reviewers: epriestley, vrana

Reviewed By: epriestley

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

13 years agoUpdate some output based on flag being set
Gareth Evans [Tue, 25 Jun 2013 22:26:14 +0000 (15:26 -0700)]
Update some output based on flag being set

Summary: Makes sense now

Test Plan: Get someone else to test it

Reviewers: epriestley

CC: aran, Korvin
Maniphest Tasks: T3342

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

13 years agoAllow passing library name with flag
Gareth Evans [Tue, 25 Jun 2013 22:19:23 +0000 (15:19 -0700)]
Allow passing library name with flag

Summary: Enables the process to pass the user input for library name. Fixes T3342

Test Plan: Little help... `arc liberate` doesn't run on windows. Though I saw the flag :)

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T3342

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

13 years agoAdd Delete Flag to Paths ignore mask
Gareth Evans [Thu, 20 Jun 2013 14:35:18 +0000 (07:35 -0700)]
Add Delete Flag to Paths ignore mask

Summary:
When `arc diff` runs unit tests it uses all of the affected files as the base array of paths. These files may have been deleted. If the deleted file fits the test criteria `unit` will try and run the test and in some cases fail.

An example of this fataling is with PHPUnit;

> Fatal error: Uncaught exception 'Exception' with message 'JSON report file is em
pty, it probably means that phpunit failed to run tests. Try running arc unit wi
th --trace option and then run generated phpunit command yourself, you might get
 the answer.' in C:\Websites\facebook\arcanist\src\unit\engine\PhpunitResultPars
er.php on line 156

Test Plan: Re-ran the tests that were causing issues with `arc unit --rev HEAD^ --trace`

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDon't prepopulate update message in hg amend diff workflow
durham [Mon, 17 Jun 2013 18:40:58 +0000 (11:40 -0700)]
Don't prepopulate update message in hg amend diff workflow

Summary:
Previously, updating a commit via arc diff in mercurial would
prepopulate the update message with part of the commit message.  In an
amend workflow this doesn't make sense, so I disabled it. Git already
does this, so now mercurial matches git in this scenario.

We had users complain that new users would often submit diffs with the
default update message, and it wasn't useful since they were using a
amend flow.

Test Plan:
arc diff on a commit that already had a diff
Verified the editor did not have a update message
arc diff on a stack of commits where the bottom one had a diff
Verified the editor provided a default update message

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoWhen a file upload fails during "arc diff", show why
epriestley [Wed, 12 Jun 2013 12:50:08 +0000 (05:50 -0700)]
When a file upload fails during "arc diff", show why

Summary: We currently swallow the exception message, but this isn't useful. Fixes T3354.

Test Plan:
  $ arc diff HEAD^ --conduit-uri=http://local.aphront.com:8080/ --only
  Uploading 1 files...
  Failed to upload new binary 'large.png'.

  [HTTP/500] Internal Server Error
  As received by the server, this request had a nonzero content length but no POST data.

  Normally, this indicates that it exceeds the 'post_max_size' setting in the PHP configuration on the server. Increase the 'post_max_size' setting or reduce the size of the request.

  Request size according to 'Content-Length' was '2093052', 'post_max_size' is set to '100K'.

      Continue? [Y/n]

Reviewers: jamesr, chad

Reviewed By: chad

CC: aran
Maniphest Tasks: T3354

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

13 years agoFix a `catch` class name
epriestley [Tue, 11 Jun 2013 13:26:42 +0000 (06:26 -0700)]
Fix a `catch` class name

Summary: Now that we examine these in lint, this came up. There is no `ConduitException`; the class is `ConduitClientException`.

Test Plan: Lint.

Reviewers: vrana, chad

Reviewed By: chad

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

13 years agoSupport for lint messages which are always shown
Omer Strulovich [Sun, 9 Jun 2013 15:37:40 +0000 (08:37 -0700)]
Support for lint messages which are always shown

Summary: If one wishes to implement a linter which finds unused resources or variables the current scheme does not work as the lint engine filters all changes from lines which were not introduced in a diff. To solve that, I've added an "always show" configuration for a lint message allowing creation of such linters.

Test Plan:
1. Created a custom linter for finding unused Android resources in a project
2. Ran arc lint with linter added and received warnings as expected

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFind needed classes in catch, instanceof and newv()
Jakub Vrana [Thu, 6 Jun 2013 01:08:20 +0000 (18:08 -0700)]
Find needed classes in catch, instanceof and newv()

Test Plan:
  try {} catch (X $ex) {}
  $a instanceof X;
  newv('X');

Linted Phabricator.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFind classes used in call_user_func()
Jakub Vrana [Wed, 5 Jun 2013 21:38:15 +0000 (14:38 -0700)]
Find classes used in call_user_func()

Summary:
Also fix false positive for call_user_func('C::f').
Also fix false positive for call_user_func("$f").
Also centralize handling of magic classes.

Test Plan:
  call_user_func("$f");
  call_user_func('C::f');
  call_user_func(array('C', 'f'));
  call_user_func(array(1 => 'f', 0 => 'C'));

Linted Phabricator.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoVerify classes used in typehints
Jakub Vrana [Wed, 5 Jun 2013 18:41:39 +0000 (11:41 -0700)]
Verify classes used in typehints

Summary: Also support `SomeInterface::CONSTANT`.

Test Plan:
  interface I {
    const A = 1;
  }
  I::A;

  function f(stdClass $a, array $b, Iterator $c) {
  }

Linted Phabricator.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix some Arcanist lint warnings
epriestley [Tue, 4 Jun 2013 22:29:39 +0000 (15:29 -0700)]
Fix some Arcanist lint warnings

Summary: Lint. See https://github.com/facebook/phabricator/pull/332

Test Plan: Lint.

Reviewers: chad

Reviewed By: chad

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

13 years agoUse a temporary file to execute `arc patch`
epriestley [Fri, 31 May 2013 04:03:21 +0000 (21:03 -0700)]
Use a temporary file to execute `arc patch`

Summary:
Piping data around on Windows doesn't work well when it contains zany characters like "null" and "newline". Fixes T3266.

Instead of piping data into `git apply`, write to a temporary file.

Test Plan:
Ran `arc patch`, got good results.

  >>> [17] <exec> $ git apply --index --reject -- '/private/var/folders/8k/c3vkmjy5335gcxdzxkhwq82w0000gn/T/7z9iea6srikoo0sc/4266-ZEyvz9'

Reviewers: btrahan, hach-que

Reviewed By: hach-que

CC: aran
Maniphest Tasks: T3266

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

13 years agoFixing the star on unit tests for Windows consoles
James Rhodes [Fri, 31 May 2013 03:56:16 +0000 (20:56 -0700)]
Fixing the star on unit tests for Windows consoles

Summary: On Windows consoles, the star on the unit tests (I'm assuming it's a Unicode character of some kind), doesn't render correctly and you just get garbage.  This fixes it so that on Windows, it falls back to just using an ASCII asterisk.

Test Plan: On Windows run some unit tests, the star should now be a plain asterisk.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoPrint --conduit-uri in install-certificate instructions
Jakub Vrana [Sat, 25 May 2013 03:20:20 +0000 (20:20 -0700)]
Print --conduit-uri in install-certificate instructions

Test Plan:
  $ arc diff # without certificate
  $ arc --conduit-uri=http://phabricator.local/ diff # without certificate

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoCompute UTF8 string differences correctly, accounting for combining characters
epriestley [Thu, 23 May 2013 21:38:09 +0000 (14:38 -0700)]
Compute UTF8 string differences correctly, accounting for combining characters

Summary:
@Afaque_Hussain has done a bunch of utf8 work here; combined with PhutilEditDistanceMatrix we can now do utf8 diffs correctly, in a general way, without a significant performance impact.

Use PhutilEditDistanceMatrix and `phutil_utf8v_combined()` to compute accurate diffs for all (or, at least, most) UTF8 text.

The only thing this doesn't handle completely correctly is lines beginning with combining characters. This is messy/expensive to handle and will probably never actually happen, so I'm punting for now. Nothing should actually break.

The utf8 stuff will be slow, but we only pay for it when we need it.

Test Plan:
Ran unit tests. I changed a few unit tests to use a non-combining character (snowman) for clarity, and some results are different now (since we get combining characters right).

{F44064}

Reviewers: btrahan, Afaque_Hussain

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T2379

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

13 years agoUse PhutilEditDistanceMatrix in ArcanistDiffUtils
epriestley [Thu, 23 May 2013 21:36:42 +0000 (14:36 -0700)]
Use PhutilEditDistanceMatrix in ArcanistDiffUtils

Summary: Replace this old hard-coded implementation with the new vector-based, unicode-capable one.

Test Plan: Ran unit tests. Looked at revisions in Differential, using whitespace modes to bypass cache.

Reviewers: btrahan, Afaque_Hussain

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T2379

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

13 years agoAllow an unassigned flag to be passed to `arc tasks`
Gareth Evans [Thu, 23 May 2013 17:32:41 +0000 (10:32 -0700)]
Allow an unassigned flag to be passed to `arc tasks`

Summary: Returns unassigned tasks

Test Plan: Run `arc tasks`, `arc tasks --unassigned`, make sure I get the correct results

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T3201

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

13 years agoUpdate PHP compat info
Jakub Vrana [Wed, 22 May 2013 18:36:41 +0000 (11:36 -0700)]
Update PHP compat info

Summary: Also warn against functions not available on Windows at all.

Test Plan: Compared old and new file.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoImplementing prefix and suffix diffing for multi-byte unicode characters.
Afaque Hussain [Tue, 21 May 2013 20:06:14 +0000 (13:06 -0700)]
Implementing prefix and suffix diffing for multi-byte unicode characters.

Summary: Prefix and suffix diffing for multi-byte unicode characters.

Test Plan:
Test diff:
------------------------------------------------------------
diff --git a/test b/test
index 252ad2f..a5bad3b 100644
--- a/test
+++ b/test
@@ -1 +1 @@
-This file contains this and this stuff.
+This file contains žžžž and this stuff.
--------------------------------------------------------------

{F43738}
--------------------------------------------------------------

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, AnhNhan
Maniphest Tasks: T2379

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

13 years agoLint for PHP 5.3 on Windows
Jakub Vrana [Sun, 19 May 2013 18:00:08 +0000 (11:00 -0700)]
Lint for PHP 5.3 on Windows

Test Plan: Linted `FileFinder`.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoArcanist changes related to T2784
Bob Trahan [Tue, 14 May 2013 22:24:20 +0000 (15:24 -0700)]
Arcanist changes related to T2784

Summary: These were in my sandbox, but I forgot about them. Without this things break post D5896. Ref T2784

Test Plan: my sandbox works and soon so shall others

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2784

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

13 years agoRemove "--allow-empty-message"
epriestley [Tue, 14 May 2013 20:35:42 +0000 (13:35 -0700)]
Remove "--allow-empty-message"

Summary: @alex has git 1.7.0.4 which doesn't have this flag. We don't actually need it: we always provide a commit message when calling this method. Remove the flag for compatibility, leaving a note in case we bump into this in the future.

Test Plan: N/A

Reviewers: btrahan, vrana, alex

Reviewed By: alex

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

13 years agoAdding arc revert command[]
Howard Chan [Tue, 14 May 2013 18:00:56 +0000 (11:00 -0700)]
Adding arc revert command[]

Summary:
Arc Revert does the following:
1. Git revert
2. Go to the differential of the rev you are reverting and either repoen it or set it to a reverted state
3. File a hipri task to orig author

[Preview] Creating Arc Revert workflow

Porting arc revert from FB4A to phabricator for general usage. This is my first stab,
so totally appreciate feedback and assistance. I'm currently focused
on making this work for git. However, I built out the functions through the GitAPI so this
could be easily extendable to Mercurial later on.

Stuck on the following (help):
1. Creating a task for FB internal. I tried building on top of existing arc listeners
but getting errors on failures to load the TaskCreator (and other) tasks.

2. I'm using a hacky way to grab the diff revision id from the newly created
revert diff. (see line 204) I'm looking for a way to just fetch the diff ID
from arc after the diff is created; is this possible?

Test Plan:
 -

1. Ran arc revert on a www and fbcode diff
2. Confirmed that revert was run on the diffs and a proper diff filed
 -

Reviewers: royw, sdwilsh, nh, epriestley

Reviewed By: epriestley

CC: aran, epriestley, Korvin, pti, keir
Maniphest Tasks: T1751

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

13 years agomore reusable nosetest engine
Aviv Eyal [Tue, 14 May 2013 13:38:22 +0000 (06:38 -0700)]
more reusable nosetest engine

Summary:
The NoseTestEngine class has some usefull code for parsing nosetest, but it assumes a very specific code/test
layout. I've pulled this logic abit apart, which lets me reuse the nose-related parts with my existing
project layout, by having my custom engine just call runTests() with the relevant paths.

Test Plan: Run on a customized project with coverage, see coverage results.

Reviewers: epriestley, roman.barzyczak

Reviewed By: epriestley

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

13 years agoAdded missing space between words in messages.
Martin Kralik [Fri, 3 May 2013 23:12:16 +0000 (16:12 -0700)]
Added missing space between words in messages.

Summary:
During my attept to `arc land master` on `master` branch
I have discovered that error message is missing few spaces between words.

I have added them and used this ugly readonly command:

  pcregrep --include="\.php$" -M -r '(?<!\\n| )("|'"'"')\.\n\s*\1(?!\\n| )' ~/arc/arcanist/src

to detect other instances of this serious bug.

Two more were found.
This time they were probably introduced in order to abide
to the draconian lint rule about number of columns.

Since I want to be a good citizen,
I have added this missing space to the begining of the next line in both cases.
It is an ugly hack, but I think user should not suffer due to missing spaces.

Another solution could be preserving no leading spaces and splitting long lines.
Or just providing excuse to lint.

Test Plan: Ran `arc land master` on `master` branch.

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T3008

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

13 years agoMake the behavior of "--load-phutil-library" more explicit
epriestley [Mon, 29 Apr 2013 19:19:15 +0000 (12:19 -0700)]
Make the behavior of "--load-phutil-library" more explicit

Summary:
This flag disables normal libraries to make it easier to test library changes. Print that out explicitly.

Also update `.arcconfig` to use the modern configuration format.

Test Plan: Ran `arc list --trace`, `arc list --load-phutil-library=src --trace`.

Reviewers: zeeg, btrahan, vrana

Reviewed By: btrahan

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

13 years agoDon't use cache in svn-hook-pre-commit
Nick Harper [Wed, 24 Apr 2013 22:10:27 +0000 (15:10 -0700)]
Don't use cache in svn-hook-pre-commit

Test Plan: arc lint

Reviewers: epriestley, wez

Reviewed By: epriestley

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

13 years agoDisable lint cache by default
epriestley [Tue, 23 Apr 2013 18:26:28 +0000 (11:26 -0700)]
Disable lint cache by default

Summary:
Fixes T2266. Motivation:

  - The lint cache does not always invalidate correctly. Because of the nature of the cache, this is a hard problem (right after "naming things").
    - We already have a fair amount of complexity in trying to invalidate it, and are still discovering new places where it doesn't work (e.g., Windows with "/" vs "\" paths).
    - One invalidation failure is when linter code changes, which seems unresolvable in the general case (e.g., changes to external linters).
  - It's not obvious what's happening when the lint cache causes some kind of issue.
    - Particularly while developing or debugging linters, your changes often won't be reflected in the lint output. Some of this is theoretically tractable but the external linter case probably isn't.
  - When someone reports a problem with the lint cache in IRC or elsewhere, there is essentially never a way for me to fix it. The lint cache can't be debugged effectively without access to a working copy where the problem reproduces.
  - The cache provides limited benefit outside of Facebook's install.

To remedy these issues:

  - Introduce configuration which controls cache usage.
  - Default it off.
  - Print a message when the cache is in use.

(I'd tentatively support removing the cache entirely, but I don't know how @vrana and Facebook feel about that.)

Test Plan: Ran `arc set-config --show`, `arc lint --cache 0`, `arc lint --cache 1`.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran, mbishopim3, nh, edward, wez
Maniphest Tasks: T2266

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

13 years agoAdding `--` to the end of git log so can `arc land` when the branch is
san [Mon, 22 Apr 2013 03:54:51 +0000 (20:54 -0700)]
Adding `--` to the end of git log so can `arc land` when the branch is
named the same as a file path.

Summary: (In fbcode and www at least, the only places I tried) if a
branch happens to be named the same as a file path (from root) (like if
a branch is called `spec` and there is a directory in `www` called
`spec`) then `arc land` will fail with git complaining that the argument
(to `git log ...`) is ambiguous as it could refer to both a path and a
revision; so this diff adds a `--` to the end so that git knows that
both are revisions and not paths.

Test Plan: Try and land something from www (I did, see D752219) where
the branch is named `spec`.

Reviewed by: epriestley

13 years agoChanges to Arcanist for libphutil "extensions/"
epriestley [Mon, 22 Apr 2013 21:38:49 +0000 (14:38 -0700)]
Changes to Arcanist for libphutil "extensions/"

Summary: See D5714. Ref T2971.

Test Plan: Built a library map for libphutil's test library.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T2971

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

13 years agoMove Arcanist machine config location on Windows
Jakub Vrana [Sat, 20 Apr 2013 05:12:02 +0000 (22:12 -0700)]
Move Arcanist machine config location on Windows

Test Plan:
  $ set # on Windows

Reviewers: epriestley, dschleimer

Reviewed By: epriestley

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

13 years agoFix arc lint amend for git to not add untracked files
durham [Fri, 19 Apr 2013 03:03:26 +0000 (20:03 -0700)]
Fix arc lint amend for git to not add untracked files

Summary:
Arc lint for git is currently adding all untracked files when it
amends the commit with lint fixes. This changes the git add -A to be
git add -u. This only adds files that were already tracked. -A was adding
untracked files as well which was not the desired behavior here.

Test Plan:
Create an untracked file.
Commit a lint failure another file.

arc diff and choose to amend the lint patches.

Verify that the untracked file was not added but the tracked file was amended.

Reviewers: epriestley, wez, chad

Reviewed By: chad

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

13 years agoAdd a configuration for python path
Phil Dibowitz [Tue, 16 Apr 2013 22:09:55 +0000 (15:09 -0700)]
Add a configuration for python path

Test Plan: not a clue

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoEnable lint amending commits in mercurial
durham [Tue, 16 Apr 2013 20:32:12 +0000 (13:32 -0700)]
Enable lint amending commits in mercurial

Summary:
arc lint was hardcoded for git for amending commits with lint
patches. This enables the same functionality for mercurial.

Test Plan:
Made some changes that would result in a lint patch.
arc diff

Verify that the patches it produces were amended into the commit.

Verified it still works in git as well.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix hg amend during arc diff
durham [Tue, 16 Apr 2013 17:22:00 +0000 (10:22 -0700)]
Fix hg amend during arc diff

Summary:
When doing an arc diff with pending changes in your working copy
it was creating a new commit with the pending changes instead of amending
the existing one.  The problem was the author comparison was comparing
values like "John Smith <john@foo.com>" with "John Smith". The fix changes
$api->getAuthor() to return "John Smith" instead of the full string. This
matches the behavior (and implementation) found in the git api.

Test Plan:
hg book foo
touch a && hg commit -Ama
touch b && hg add b
arc diff
When prompted, amend the pending changes to the existing commit.

Verified that the changes were amended instead of making a new commit.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoConstruct a diganostic parser in BaseWorkflow::getChange()
epriestley [Mon, 15 Apr 2013 19:30:56 +0000 (12:30 -0700)]
Construct a diganostic parser in BaseWorkflow::getChange()

Summary:
@ender is reporting a parsing issue in SVN, but we don't build a parser with setWriteDiffOnFailure() set in this workflow right now so I can't get the raw file to fix the issue.

Use the onboard mechanism to build a parser with `setWriteDiffOnFailure()` set, so it will write the diff, so I can get a copy so I can fix the problem.

Test Plan: Ran `arc diff --preview` in an SVN repo with a linter.

Reviewers: ender, btrahan

Reviewed By: ender

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

13 years agoLint `TRUE`, `nUlL`, etc., for Phabricator conventions
epriestley [Mon, 15 Apr 2013 17:22:56 +0000 (10:22 -0700)]
Lint `TRUE`, `nUlL`, etc., for Phabricator conventions

Summary: Detect and fix unconventional spellings of `true`, `false`, `null` and `array` (these are the only keywords I've seen spelled unconventionally in the wild).

Test Plan: Unit tests.

Reviewers: DurhamGoode, btrahan, vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T2985

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

13 years agoAdd arc.land.update.default config for setting the default strategy
durham [Sun, 14 Apr 2013 18:48:22 +0000 (11:48 -0700)]
Add arc.land.update.default config for setting the default strategy

Summary:
This adds a arcconfig setting to allow specifying whether to use the merge
or rebase strategy when doing the feature branch update.
arc.land.update.default can be set to either 'rebase' or 'merge'.  The command
line flags will override this setting.

We have had trouble with arc land producing merge commits (introduced
with D4080) in git. They usually appear when arc land fails, and our users
are confused by the presence of a merge commit afterwards. Today it got even
worse since a user managed to get arc land to push the merge commit to the
server. This setting will allow us to turn it off for our uses.

Test Plan:
Verified the following combinations:
update.default not set + arc land (saw git merge in the trace)
update.default = 'rebase' + arc land (saw git rebase)
update.default = 'merge' + arc land (saw git merge)
update.default = 'rebase' + arc land --update-with-merge (saw git merge)
update.default = 'merge' + arc land --update-with-rebase (saw git rebase)

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoChange hg arc diff to detect up to the nearest parent with a diff
durham [Fri, 12 Apr 2013 21:11:51 +0000 (14:11 -0700)]
Change hg arc diff to detect up to the nearest parent with a diff

Summary:
Changes arc diff to choose the base commit as the first ancestor
that has a diff.  So if your tree looks like master->A->B->C->D, if you
have a diff on B (which will include A), when you run arc diff on D it will
only include C and D.

This makes the scenario for stacked diffs nicer.  A user can commit A, commit B,
arc diff, commit C, commit D, arc diff, arc land B, arc land D.

Test Plan:
Commit A on top of master
Commit B on top of A
arc diff
Commit C on top of B
Commit D on top of C
arc diff

Verify the second diff contains the changes in C and D, but not A and B.

hg up B
arc land --preview
Verify that arc land shows A and B

hg up D
arc land --preview
Verify that arc land shows A, B, C, and D
(arc land should be unaffected by this change.
It always tries to land the entire branch)

Reviewers: epriestley

Reviewed By: epriestley

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

13 years ago[svn] Fix removing a binary file without svn:mime-type set
Nick Harper [Wed, 10 Apr 2013 22:22:58 +0000 (15:22 -0700)]
[svn] Fix removing a binary file without svn:mime-type set

Summary:
If we're removing a binary file that didn't have svn:mime-type set properly,
we can't propset it (because the file doesn't exist locally). Instead, just
return a synthetic diff for the removed file.

Test Plan:
run arc diff in an svn working copy where I ran svn rm on a binary file that
doesn't have svn:mime-type set, and the diff correctly gets uploaded to
phabricator instead of erroring when trying to set properties.

Reviewers: epriestley, wez

Reviewed By: epriestley

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

13 years agoAllow 'arc diff .^' for hg repos
durham [Wed, 10 Apr 2013 00:00:34 +0000 (17:00 -0700)]
Allow 'arc diff .^' for hg repos

Summary:
Previously arc diff for hg only allowed bookmark names, rev numbers,
and commit hashes as the input base commit. This was because it escaped all
inputs and treated them as raw identifiers.

This change makes it treat the input as a revset if the escaped version fails.
This allows users to do things like "arc diff .^" when they only want to diff
the top commit.

Test Plan:
Created a stack of commits, master->A->B.
hg up B
arc diff .^
Verified the diff message only showed B as part of the diff.

arc diff .^~
Verified an error occurred ("Commit '.^~' is not a valid Mercurial commit id.")

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2888

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

13 years agoAdd py/pl files to $text_paths (remove l/y files?!)
Shayne Sweeney [Tue, 9 Apr 2013 22:06:55 +0000 (15:06 -0700)]
Add py/pl files to $text_paths (remove l/y files?!)

Summary:
I'm guessing this was refactored somewhere down the line and it meant
that Python and Perl files were no longer considered text files.

I'm imagining the old regex was: p(hp|y|l). Therefore I blame CSS.

Test Plan:
Perform an arc lint on a Python or Perl file that has trailing whitespace
on a line. It should prompt you for an autocorrecting lint.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoInvalidate SVN status cache after adding files
Jakub Vrana [Sat, 6 Apr 2013 16:25:35 +0000 (09:25 -0700)]
Invalidate SVN status cache after adding files

Summary: Cache invalidation is really one of the two hardest computer science problems.

Test Plan:
  lang=sh
  # in Subversion repository
  $ arc diff .arcconfig # untracked

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoHide Git merge stats in arc land
Jakub Vrana [Sat, 6 Apr 2013 16:23:41 +0000 (09:23 -0700)]
Hide Git merge stats in arc land

Test Plan:
  $ arc land # in Git repo

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoEscape ^ on command line (significant on Windows)
Jakub Vrana [Sat, 6 Apr 2013 06:17:40 +0000 (23:17 -0700)]
Escape ^ on command line (significant on Windows)

13 years agoDon't use command output as formatted string in arc land
Jakub Vrana [Sat, 6 Apr 2013 06:09:35 +0000 (23:09 -0700)]
Don't use command output as formatted string in arc land

13 years agoList the openssl functions as extension functions for lint
epriestley [Thu, 4 Apr 2013 23:17:19 +0000 (16:17 -0700)]
List the openssl functions as extension functions for lint

Summary:
sry 2 hear of ur lint trubles

(You may need to `arc liberate --force` or delete all your `src/.phutil_module_cache` after updating, see T1486.)

Test Plan: shrug shrug

Reviewers: btrahan, vrana

Reviewed By: btrahan

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

13 years agoDon't use `emailuser` in Mercurial
epriestley [Tue, 2 Apr 2013 21:06:46 +0000 (14:06 -0700)]
Don't use `emailuser` in Mercurial

Summary:
The `emailuser` template is a relatively recent addition to Mercurial, and a few users have complained about it. It also doesn't actually do what I thought it did, e.g. in an address like this:

  "Abraham Lincoln" <alincoln@whitehouse.gov>
   ^^^^^^^^^^^^^^^   ^^^^^^^^
         (1)            (2)

                     ^^^^^^^^^^^^^^^^^^^^^^^
                              (3)

...I want (1), but `emailuser` means (2). Instead, extract (1) with `getDisplayName()` and (3) with `getAddress()` using PhutilEmailAddress.

The implementation in Mercurial is not particularly sophisticated or magical (it just looks for "@" and "<") so we aren't really missing anything by doing this ourselves, at least today.

Also fix some issues in `arc export`, which literally no one uses, but which is occasionally useful for testing (as here).

Test Plan:
  - Ran `arc diff --only` in an `hg` repo, checked DB to see that name/email were correctly extracted.
  - Ran `arc export --git` in an `hg` repo, didn't get a long series of fatals.

Reviewers: btrahan, DurhamGoode

Reviewed By: DurhamGoode

CC: aran
Maniphest Tasks: T2866, T2858

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

13 years agoAdd hook for runtime config settings.
durham [Mon, 1 Apr 2013 18:26:17 +0000 (11:26 -0700)]
Add hook for runtime config settings.

Summary:
This adds a hook to allow external parties to provide config settings at runtime.
The hook is technically for when a RepositoryAPI is created, but that moment can
be used to set new config settings using the new setRuntimeConfig() api.

For example you could have a external hook that looks for keys like 'git:foo.bar'
or 'hg:foo.bar' and writes the value of 'foo.bar' based on whether the repo is a
git or a hg repo.

Test Plan:
Created a hook that looks for hg/git prefix versions of config keys.
Set hg:arc.feature.start.default to be "master" and set arc.feature.start.default
to be "trunk".
Ran arc feature in the hg repo.  It made a bookmark on master.
Ran arc feature in the git repo.  It made a branch on trunk.

Did it again, but with git:arc.feature... set instead.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMake arc land list the commits being landed.
durham [Fri, 29 Mar 2013 17:08:23 +0000 (10:08 -0700)]
Make arc land list the commits being landed.

Summary:
Arc land is a bit magical and some users have gotten bitten by
the fact that it collapses and lands every commit on the branch. To make
it explicit what is being landed, it now shows a list of the commits
that are being landed.  I also added a --preview flag that will just
print the commits that would be landed, but does nothing else.

Hopefully this make arc land a little less magical for people.

Test Plan:
arc land in the following scenarios:
- Landing one change
- Landing no changes
- Landing a stack of changes

Did it with hg and git.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdd missing image functions to PHP extension functions list
Jakub Vrana [Thu, 28 Mar 2013 05:04:37 +0000 (05:04 +0000)]
Add missing image functions to PHP extension functions list

Summary:
Copied from PHP Manual.

Also fix missing cache key for implicitly linted file.

Test Plan:
  phabricator/ $ arc lint src/applications/files/PhabricatorImageTransformer.php # without GD2

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDon't connect to Conduit in `arc feature name`
Jakub Vrana [Sat, 23 Mar 2013 00:33:07 +0000 (17:33 -0700)]
Don't connect to Conduit in `arc feature name`

Summary: There's no need for having an Internet connection in creating a branch.

Test Plan:
  $ arc feature name # with disabled Internet
  $ arc feature
  [cURL/6] (https://secure.phabricator.com/api/conduit.connect)

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMake arc patch create a bookmark by default in hg
durham [Fri, 22 Mar 2013 00:52:07 +0000 (17:52 -0700)]
Make arc patch create a bookmark by default in hg

Summary:
Previously, arc patch would create a new commit under the existing
current bookmark in mercurial. There have been two discussions about what the
right behavior should be (D3334 and D3658). One side wants no commit at all,
and one side wants a commit under a new bookmark. The current implementation is
the worst of both worlds :(

This change makes it create a new bookmark at the revision's base before commiting,
same as the --bookmark flag used to do (which is now obsolete). That way the
existing bookmark doesn't move (in mercurial >=1.8). This is the same behavior
git has, which is convienent for groups migrating between the two.

Also makes hg's getCanonicalRevision handle svn revisions just like git. This way
arc patch will try to apply the patch to the appropriate revision in the history.

Test Plan:
Ran:
arc patch - Verified it created a new bookmark and commited on top of the
revision's base commit.

arc patch --nobranch - Verified it put the new commit on top of the current
bookmark without a new bookmark.

arc patch --nocommit - Verified it left all the changes in the working copy.

Also verified arc patch still works with git.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdded automatic stash / unstash support for Git in arc diff.
James Rhodes [Thu, 21 Mar 2013 22:51:39 +0000 (15:51 -0700)]
Added automatic stash / unstash support for Git in arc diff.

Summary:
- Added arc.autostash option to have this behaviour off by
default (but configurable on a per-project basis).
- Automatic stashing of changes now informs the user of how
to restore their working directory if Arcanist unexpectedly
terminates.
- Fixed an issue with finalizeWorkingCopy when the workflow
didn't require a clean working copy.

Test Plan:
Test `arc diff` when there are changes in the working
directory; by default it should tell you to stash or commit.
Turn on the arc.autostash option and try again; it should
automatically stash with a message on how to recover, and
it should restore the working directory automatically under
almost any circumstances (other than an unrecoverable error).

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMake arc land for hg more robust to failures
durham [Wed, 20 Mar 2013 22:06:10 +0000 (15:06 -0700)]
Make arc land for hg more robust to failures

Summary:
Adds error handling for several kinds of failure in arc land for
mercurial.  Previously it would often leave the repo in a confusing state
if something failed.

- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.

Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land

In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.

Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.

Reviewers: epriestley, dschleimer, sid0

Reviewed By: epriestley

CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394

13 years agoFix arc patch adding unnecessary files for hg repos
durham [Wed, 20 Mar 2013 21:40:28 +0000 (14:40 -0700)]
Fix arc patch adding unnecessary files for hg repos

Summary:
Arc patch was committing with -A (--addremove) which meant any random
files that were sitting around in the repo (like conflict .orig files) were
added to the commit.  The -A isn't even necessary since the hg import
adds and removes all the appropriate files for you.

Test Plan:
touch foo
arc patch --diff some-diff-id
Verified that foo was not added to the commit

Reviewers: epriestley, nh

Reviewed By: epriestley

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

13 years agoImprove error if python can't run pep8
Nick Harper [Tue, 19 Mar 2013 18:44:49 +0000 (11:44 -0700)]
Improve error if python can't run pep8

Summary:
On systems with an ancient version of python, the pep8 linter won't run.
Instead of blowing up in the user's face, we should display a nice error
message.

Test Plan:
Put /usr/bin (where the ancient version of python is) at the beginning of
my path and tried to lint some python. I got a nice error instead of a
stack trace.

Reviewers: epriestley, wez

Reviewed By: epriestley

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

13 years agoDon't use absolute path in `ArcanistDiffUtils`
Jakub Vrana [Thu, 14 Mar 2013 16:14:50 +0000 (09:14 -0700)]
Don't use absolute path in `ArcanistDiffUtils`

Summary: Improves Windows compatibility.

Test Plan: Ran failing unit test on Windows.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoParsing rcsdiff -u
Afaque Hussain [Thu, 14 Mar 2013 13:15:42 +0000 (06:15 -0700)]
Parsing rcsdiff -u

Summary: Added some sample rcsdiffs for adding and deleting a line from a file. Wrote some test cases to be tested by ArcanistDiffParser.

Test Plan: By making all the test cases pass.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoChange arc feature to use it's own config key for the start default
durham [Thu, 14 Mar 2013 00:01:23 +0000 (17:01 -0700)]
Change arc feature to use it's own config key for the start default

Summary:
Changes arc feature to read 'arc.feature.start.default' instead
of 'arc.land.onto.default'.  In our usage we actually need to fork off
a different branch than we land to, so separating these is useful.

Test Plan:
Set arc.land.onto.default = master
Set arc.feature.start.default = bar
arc feature foo
cat .git/config
Verified the foo branch tracked bar

Reviewers: epriestley, nh

Reviewed By: epriestley

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

13 years agoCompute lint cache key before linting
Jakub Vrana [Mon, 11 Mar 2013 01:49:02 +0000 (18:49 -0700)]
Compute lint cache key before linting

Summary: If user changes the file contents during linting (usually when prompted to apply a patch) then we save the old messages to the new file contents. Fix that by computing the hash before linting (or after applying patch).

Test Plan: Changed the file during linting, verified that the file hash didn't change.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoImprove Windows compatibility
Jakub Vrana [Mon, 11 Mar 2013 01:08:14 +0000 (18:08 -0700)]
Improve Windows compatibility

Test Plan:
  $ arc liberate
  $ arc lint

Reviewers: epriestley

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

13 years agoDispatch an event in arc land right before pushing a revision
Alok Menghrajani [Sat, 9 Mar 2013 02:32:36 +0000 (18:32 -0800)]
Dispatch an event in arc land right before pushing a revision

Summary: I looked at the pros & cons at adding hooks in git/hg vs arc land and I prefer arc land.

Test Plan:
* added an event listener and made sure I could handle the event.
* made sure things get reverted when the event handler throws an exception.

Reviewers: vrana, epriestley, pieter

Reviewed By: epriestley

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

13 years agoInitialize variable in lint patch output
vrana [Fri, 8 Mar 2013 23:25:33 +0000 (15:25 -0800)]
Initialize variable in lint patch output

13 years agoImprove the description of using `arc land --revision`
vrana [Thu, 7 Mar 2013 19:49:34 +0000 (11:49 -0800)]
Improve the description of using `arc land --revision`

Summary: The message suggests that only one revision would land.

Test Plan: Read it.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMinor, fix `arc land` for the case of no dependencies.
epriestley [Fri, 8 Mar 2013 01:21:37 +0000 (17:21 -0800)]
Minor, fix `arc land` for the case of no dependencies.

Auditors: Afaque_Hussain

13 years agoIgnore remote errors in parsing Mercurial log
vrana [Thu, 7 Mar 2013 00:32:38 +0000 (16:32 -0800)]
Ignore remote errors in parsing Mercurial log

Summary:
This probably indicates some none fatal error, e.g.:

> remote: Certificate invalid: name is not a listed principal

The best thing here would be to avoid the error but we shouldn't explode even if it is there.
I tried to mute the error from the output but didn't find a switch or config option to do it.

Test Plan:
  $ hg outgoing --branch default --style default

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoIf a revision depends on another revision which has not yet been closed, warn the...
Afaque Hussain [Thu, 7 Mar 2013 16:55:34 +0000 (08:55 -0800)]
If a revision depends on another revision which has not yet been closed, warn the developer

Summary: Have arc land inspect the revision if it depends on some other revisions which haven't been closed yet. If yes, then warn users.

Test Plan: Will test them locally.

Reviewers: epriestley, AnhNhan

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

13 years agoFix "arc" when `arcanist/` lives in some directory with spaces in the name
epriestley [Wed, 6 Mar 2013 22:43:18 +0000 (14:43 -0800)]
Fix "arc" when `arcanist/` lives in some directory with spaces in the name

Summary: This shell script needs more quotes.

Test Plan: Ran "arc" with `arcanist/` inside a directory called `s p a c e s`.

Reviewers: irinav, vrana

Reviewed By: vrana

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

13 years agoDocument parameters
epriestley [Wed, 6 Mar 2013 21:47:05 +0000 (13:47 -0800)]
Document parameters

Summary: unlike the hooks I copy/pasted, these hooks have parameters

Test Plan: read it

Reviewers: vrana

Reviewed By: vrana

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

13 years agoAdd willRunTestCases / didRunTestCases hooks
epriestley [Wed, 6 Mar 2013 21:40:07 +0000 (13:40 -0800)]
Add willRunTestCases / didRunTestCases hooks

Summary: These hooks allow test cases to build shared resources -- notably, database fixtures.

Test Plan: See next diff.

Reviewers: vrana

Reviewed By: vrana

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

13 years agoFix bug with `arc unit --everything` when coverage is available
epriestley [Wed, 6 Mar 2013 21:39:31 +0000 (13:39 -0800)]
Fix bug with `arc unit --everything` when coverage is available

Summary: We don't set $paths when running --everything.

Test Plan: Ran `arc unit --everything` with coverage.

Reviewers: vrana

Reviewed By: vrana

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

13 years agoAllow `new self` in linter
vrana [Tue, 5 Mar 2013 21:38:49 +0000 (13:38 -0800)]
Allow `new self` in linter

Summary: Also allow `sTaTiC::$x` which is a valid PHP (contrary to `sElF::$x` which is invalid PHP but I allowed that too).

Test Plan:
  new self;

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdd arcconfig setting for default arc feature start
durham [Tue, 5 Mar 2013 20:48:53 +0000 (12:48 -0800)]
Add arcconfig setting for default arc feature start

Summary:
Adds arc.feature.start.default arcconfig setting to specify
a default value for 'start' in 'arc feature name start'. This lets
users always branch from origin/master (or whatever the main branch is).

Also cleaned up the 'feature' help text a little. The stuff about sorting
and closed/abandoned revisions is explained via the options list already.

Test Plan:
Ran arc feature with/without a start and with/without the config
setting set.

Reviewers: epriestley, vrana

Reviewed By: epriestley

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

13 years agoComplain about Reuse of By-ref Iterators
Andrew Chen [Tue, 5 Mar 2013 15:45:02 +0000 (07:45 -0800)]
Complain about Reuse of By-ref Iterators

Summary:
Added a lint rule that warns about reusing iterator reference
variables.

Test Plan:
- Add a file with examples found in with https://secure.phabricator.com/T2536
- Did not make a unit test yet

Reviewers: vrana, bill, epriestley

Reviewed By: epriestley

CC: aran, epriestley, Korvin
Maniphest Tasks: T2536

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

13 years ago`arc feature` set up git tracking branch
Ryan Patterson [Mon, 4 Mar 2013 05:43:59 +0000 (21:43 -0800)]
`arc feature` set up git tracking branch

Summary:
When using arc feature, it should set up the tracking branch to be
master.

Test Plan:
  ./bin/arc feature tracking

Reviewers: vrana, epriestley

Reviewed By: epriestley

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

13 years agoRespect British spelling also in arguments
vrana [Sat, 2 Mar 2013 00:07:16 +0000 (16:07 -0800)]
Respect British spelling also in arguments

Summary: These are the errors I really do.

Test Plan:
  $ arc diff --no-lint
  (Assuming '--no-lint' is the British spelling of '--nolint'.)
  $ arc diff --reviewer a
  (Assuming '--reviewer' is the British spelling of '--reviewers'.)

New unit test.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoUse hg phases to detect outgoing when phases are supported
durham [Fri, 1 Mar 2013 22:10:25 +0000 (14:10 -0800)]
Use hg phases to detect outgoing when phases are supported

Summary:
There was an accidental ! in the phase vs outgoing condition
which caused it to use 'hg outgoing' when it should have used the draft()
phase.  Fixing this shaves 4.5 seconds off 'arc diff' on large repos.

Test Plan:
Ran arc diff --trace.  Noted that the draft() was used and that the diff
contained the correct files and commit.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoUse bookmark terminology if `arc land` on hg bookmark
mconnor [Fri, 1 Mar 2013 22:04:05 +0000 (14:04 -0800)]
Use bookmark terminology if `arc land` on hg bookmark

Summary: Changes message for `arc land` that displays current branch or bookmark (if none is specified) to appropriately use the term 'bookmark' when on a bookmark in an hg repository.

Test Plan:
Ran `arc land` on new git and hg repositories, checking for correct identification of 'branch' or 'bookmark'.

~/test$ mkdir hg-test
~/test$ mkdir git-test
~/test$ cd hg-test
~/test/hg-test$ hg init
~/test/hg-test$ hg branch
default
~/test/hg-test$ hg bookmarks
no bookmarks set
~/test/hg-test$ arc land
Landing current branch 'default'.
Usage Exception: You can not land a branch onto itself -- you are trying to land 'default' onto 'default'. For more information on how to push changes, see 'Pushing and Closing Revisions' in 'Arcanist User Guide: arc diff' in the documentation. You may be able to 'arc amend' instead.
~/test/hg-test$ hg bookmark testmark
~/test/hg-test$ hg bookmarks
 * testmark                  -1:000000000000
~/test/hg-test$ hg branch
default
~/test/hg-test$ arc land
Landing current bookmark 'testmark'.
Usage Exception: Source testmark is a bookmark but destination default is not a bookmark. When landing a bookmark, the destination must also be a bookmark. Use --onto to specify a bookmark, or set arc.land.onto.default in .arcconfig.

Confirm still works on a git branch:

~/test/hg-test$ cd ../git-test/
~/test/git-test$ ls
~/test/git-test$ git init
Initialized empty Git repository in ~/test/git-test/.git/
~/test/git-test$ touch testfile
~/test/git-test$ git commit -am 'Test file'
~/test/git-test$ git branch
* master
~/test/git-test$ arc land
Landing current branch 'master'.
Usage Exception: You can not land a branch onto itself -- you are trying to land 'master' onto 'master'. For more information on how to push changes, see 'Pushing and Closing Revisions' in 'Arcanist User Guide: arc diff' in the documentation. You may be able to 'arc amend' instead.

Reviewers: DurhamGoode, epriestley

Reviewed By: DurhamGoode

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

13 years agoRender unit results progressively
vrana [Wed, 27 Feb 2013 21:59:12 +0000 (13:59 -0800)]
Render unit results progressively

Summary:
Some tests take longer (fixtures usually around 1 second for me) and also FB runs all tests on deploy.
I want to see all results immediately.

Test Plan:
Added `usleep(200000)` to `resultTest()`, then:

  $ arc unit
  Saw results printed one by one.

Also didn't pass `$renderer` to `ArcanistPhutilTestCase` and saw empty output.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoImprove hg arc diff perf when image files are uploaded
durham [Thu, 28 Feb 2013 17:46:42 +0000 (09:46 -0800)]
Improve hg arc diff perf when image files are uploaded

Summary:
arc diff called 'hg cat' twice for every image binary in the diff.
This turns out to take 1 second per call on a large repo because mercurial
has to parse the manifest every time.

Now arc diff batches up all the files and does only two 'hg cat'
commands.  This makes the cost constant relative to the number of
images being uploaded.

Test Plan:
Ran arc diff on a diff with 30 images on both git and hg.
Verified that it was fast and that the images showed up in the web ui.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix arc lint on working copy changes in mercurial repos
durham [Wed, 27 Feb 2013 00:15:29 +0000 (16:15 -0800)]
Fix arc lint on working copy changes in mercurial repos

Summary:
Previously, running arc lint on a set of changes that only
existed in your working copy threw an exception in mercurial repos.
It was trying to use the revset "...." (i.e. the range from . to .),
which didn't parse. Even if I fix that it still doesn't work because
getRawDiffText did not include the working copy changes (which it does
in git).  I removed the check so the function now acts the same as in
git and arc lint works on working copy changes. I've seen this error before
in other places so hopefully this change will also fix any other areas,
that depended on getRawDiffText working the same as git.

The logic I removed was added in D1954 to support diffing against
uncommited changes.  That workflow should be unchanged.  arc diff will
still prompt the user if there are uncommited changes, and the user can
still choose to abort or continue.

Let me know if I missed something important which makes this a bad idea.

Test Plan:
Edited a file in the working directory of a hg repo.
arc lint
Verified lint ran successfully.

Also ran arc diff and land with and without working copy changes to make sure
they still work.  I'd kill for some tests in this area...

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: dschleimer, bos, sid0, aran, Korvin
Maniphest Tasks: T1631

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

13 years agoInclude linter class MD5 in linter version
vrana [Tue, 26 Feb 2013 23:20:13 +0000 (15:20 -0800)]
Include linter class MD5 in linter version

Summary:
People constantly forget to bump the linter version and I don't see a way how to stop it.
This may bump the version even if it wouldn't be required but let's rather undercache than overcache.

Test Plan: `var_dump($version)`.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoCatch exceptions in didRunLinters()
vrana [Tue, 26 Feb 2013 19:35:58 +0000 (11:35 -0800)]
Catch exceptions in didRunLinters()

Test Plan: Threw in `didRunLinters()` of one linter, still saw the result of other linters and "Some linters failed" at the end.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoInitialize used variable in lint console renderer
vrana [Tue, 26 Feb 2013 00:23:27 +0000 (16:23 -0800)]
Initialize used variable in lint console renderer

13 years agoSupport `arc lint --output none`
vrana [Mon, 25 Feb 2013 20:33:51 +0000 (12:33 -0800)]
Support `arc lint --output none`

Summary:
I want to run lint on background and I'm interested only in side effect of caching (and maybe exit status).
This is better than discarding stdout later because we don't do unnecessary work and error conditions are still printed.

Test Plan:
  $ arc lint --output none # with error
  $ echo $?
  $ arc lint --output none # with no lintable paths
  $ arc lint --output none # witout errors

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdd unit tests for implicit fallthrough lint rule
vrana [Sat, 23 Feb 2013 05:12:29 +0000 (21:12 -0800)]
Add unit tests for implicit fallthrough lint rule

Summary:
The perf fix actually catches some real problems.
I didn't find anything in libphutil, Arcanist and Phabricator though.

Also bump version.

Also allow configuring the hook.

Test Plan:
Added a test, saw it fail with the old code.
Repeat for hook.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix intraline lint patch rendering
vrana [Sat, 23 Feb 2013 00:55:22 +0000 (16:55 -0800)]
Fix intraline lint patch rendering

Summary: `,` -> `, ` is currently highlighted wrong.

Test Plan:
Looked at patches of these errors:

- License linter
- `0+0`
- `0,0`

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoChange ArcanistLintRenderer to class
vrana [Sat, 23 Feb 2013 00:12:53 +0000 (16:12 -0800)]
Change ArcanistLintRenderer to class

Summary: Renderers **are** renderers not **can** render.

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDon't amend existing revision with `arc diff --create`
vrana [Fri, 22 Feb 2013 17:52:00 +0000 (09:52 -0800)]
Don't amend existing revision with `arc diff --create`

Summary: If there's other revision in last commit message and I said `--create` then it is clear that I want to create a new commit.

Test Plan:
  $ arc diff --create # in dirty working copy on top of my open revision

Reviewers: epriestley

Reviewed By: epriestley

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

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