]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
14 years agoWarn about strstr() misuse
vrana [Wed, 15 Aug 2012 20:30:40 +0000 (13:30 -0700)]
Warn about strstr() misuse

Summary: See D3296#1.

Test Plan:
New test.
Linted Arcanist, libphutil, Phabricator repositories, found no false positive and one real positive.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoWarn before using `strpos($a, $b) === 0`
vrana [Wed, 15 Aug 2012 19:56:36 +0000 (12:56 -0700)]
Warn before using `strpos($a, $b) === 0`

Summary:
I'm not sure if we are interested in this kind of linters ("Don't use slow function if there is a fast alternative").
I didn't find a case where `strpos() === 0` could be useful except [[ http://www.php.net/manual/en/mbstring.overload.php | mbstring.func_overload ]] craziness.

Test Plan:
New unit test.
Linted Arcanist, libphutil, Phabricator repositories, found no false positive and one real positive.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

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

14 years agoAdd extraData field to test results
Wez Furlong [Wed, 15 Aug 2012 17:34:29 +0000 (10:34 -0700)]
Add extraData field to test results

Summary:
See discussion on T1630.
extraData provides more scope for extensions to piggy-back
more data on the test results and have that pulled up to the UI.

We're using keys like "facebook:complexity" to store additional
data as part of the test results.

Test Plan:
Nothing in the codebase touches extraData at the moment, so
you'll just have to have faith/prove by inspection.

Reviewers: vrana, nh, tuomaspelkonen, epriestley

Reviewed By: epriestley

CC: aran, epriestley
Maniphest Tasks: T1630

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

14 years agoDetect use of f()[0] in lint
epriestley [Wed, 15 Aug 2012 11:36:50 +0000 (04:36 -0700)]
Detect use of f()[0] in lint

Summary: XHPAST doesn't currently parse most PHP 5.4 stuff, but it does parse this. Warn about it.

Test Plan:
Unit tests, and:

   Error  (XHP35) Use Of PHP 5.4 Features
    The f()[...] syntax was not introduced until PHP 5.4, but this codebase
    targets an earlier version of PHP. You can rewrite this expression using
    idx().

             365   public function lintPHP54Features($root) {
             366
             367     if (false) {
    >>>      368       id()[0];
                            ^
             369     }
             370

Reviewers: alanh, vrana

Reviewed By: alanh

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

14 years agoPass lint and unit results to diff created event
vrana [Mon, 13 Aug 2012 19:20:34 +0000 (12:20 -0700)]
Pass lint and unit results to diff created event

Summary:
I need to run some jobs only if the tests hasn't been skipped.
I know that this could end up by passing more and more data to the event but this is all I need so far.

Test Plan: Dumped `unitResult` from the listener.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoImplement base85 in a 32-bit safe way, without bcmath
epriestley [Mon, 13 Aug 2012 02:21:33 +0000 (19:21 -0700)]
Implement base85 in a 32-bit safe way, without bcmath

Summary: See T1635 and the giant inline comment.

Test Plan: Ran unit tests on 32-bit and 64-bit machines.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T1635

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

14 years agoAdd test coverage to the base85 implementation
epriestley [Mon, 13 Aug 2012 02:20:46 +0000 (19:20 -0700)]
Add test coverage to the base85 implementation

Summary: See T1635. I'm going to make an effort to rewrite this in a way that's safe in 32-bit PHP, i.e. without bcmath. Add test coverage to limit the chance I screw it up.

Test Plan: Ran unit tests.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T1635

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

14 years agoSwitch arcanist to phutil_utf8_convert()
epriestley [Sun, 12 Aug 2012 15:50:01 +0000 (08:50 -0700)]
Switch arcanist to phutil_utf8_convert()

Summary: See D3252. Reduces code duplication a little bit. Also remove some dire warnings about impending doom -- this has been in use in the wild for a long time.

Test Plan: Added a file in ISO-8859-1, ran `arc diff --encoding ISO-8859-1` to generate this revision, got an encoding note in output.

Reviewers: davidreuss, vrana, btrahan

Reviewed By: davidreuss

CC: aran
Maniphest Tasks: T452

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

14 years agoRaise exception instead of returning magical number from 'arc anoid'
epriestley [Fri, 10 Aug 2012 22:29:27 +0000 (15:29 -0700)]
Raise exception instead of returning magical number from 'arc anoid'

Summary: how do I python

Test Plan: help

Reviewers: alanh

Reviewed By: alanh

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

14 years agoFix serious problems with 'arc anoid'
epriestley [Fri, 10 Aug 2012 22:16:02 +0000 (15:16 -0700)]
Fix serious problems with 'arc anoid'

Summary: https://github.com/facebook/arcanist/issues/48

Test Plan: hmm

Reviewers: alanh, tuomaspelkonen

Reviewed By: tuomaspelkonen

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

14 years agoAllow arcanist to search for libphutil in externals/includes/
epriestley [Fri, 10 Aug 2012 21:58:19 +0000 (14:58 -0700)]
Allow arcanist to search for libphutil in externals/includes/

Summary:
In some cases (notably, homebrew) an installer may not control where arcanist/ and libphutil/ live and may not be able to control 'include_path'.

Allow libphutil/ to be symlinked into arcanist/externals/includes/ if all else fails.

Test Plan:
  - Moved `libphutil` to `libphutilx`. Ran "arc" and got a failure.
  - Symlinked it into externals/includes/, ran `arc`, got success.
  - Moved it back to `libphutil`, ran `arc`, success.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran, tfmeusburger
Differential Revision: https://secure.phabricator.com/D3243

14 years agoFix doc links
vrana [Fri, 10 Aug 2012 21:15:15 +0000 (14:15 -0700)]
Fix doc links

Summary: I will also commit fixes in other repos.

Test Plan: LinkChecker

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoRemove `beginRedirectOut()` from Arcanist
epriestley [Fri, 10 Aug 2012 19:10:09 +0000 (12:10 -0700)]
Remove `beginRedirectOut()` from Arcanist

Summary: We always do this on --recon now, see D3213.

Test Plan: Ran `arc diff --background 1` to generate this diff.

Reviewers: vrana

Reviewed By: vrana

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

14 years agoMake the "this is technical documentation" message of "Arcanist Overview" more clear
epriestley [Fri, 10 Aug 2012 18:37:30 +0000 (11:37 -0700)]
Make the "this is technical documentation" message of "Arcanist Overview" more clear

Summary:
The only purpose of "Arcanist Overview" is to tell people they shouldn't be here, but we bury the lede.

Make it clear that this is not user documentation.

After T988 we can improve the organization here, but some recent users found this pretty confusing.

Test Plan: Generated and read documentation.

Reviewers: vrana, btrahan

Reviewed By: vrana

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

14 years agoImprove "arc patch" error messages for mismatched local and diff
epriestley [Fri, 10 Aug 2012 01:39:41 +0000 (18:39 -0700)]
Improve "arc patch" error messages for mismatched local and diff

Summary: We emit a confusing error if there's no ".arcconfig" in the local right now.

Test Plan:
  $ arc patch D3185

    This patch is for the 'phabricator' project,  but the working copy
    belongs to the 'phabricatox' project. Still try to apply the patch? [Y/n]

  $ arc patch D3185

    This patch is for the 'phabricator' project, but the working copy does
    not have an '.arcconfig' file to identify which project it belongs to.
    Still try to apply the patch? [Y/n]

Reviewers: vrana, btrahan

Reviewed By: vrana

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

14 years agoAllow specifying root in `arc inlines`
vrana [Fri, 10 Aug 2012 00:37:47 +0000 (17:37 -0700)]
Allow specifying root in `arc inlines`

Summary: Simplifies editor bindings.

Test Plan:
  $ arc inlines --root W:/devtools/phabricator/

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoRedirect output to console in background mode of `arc diff`
vrana [Thu, 9 Aug 2012 02:02:33 +0000 (19:02 -0700)]
Redirect output to console in background mode of `arc diff`

Summary: See D3208.

Test Plan:
  $ arc diff --background 1

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoFix an issue where 'arc alias' reverses parameters
epriestley [Wed, 8 Aug 2012 19:58:27 +0000 (12:58 -0700)]
Fix an issue where 'arc alias' reverses parameters

Summary:
We shove alias parameters onto the front of the arg list so if you make an alias like "qdiff" = "diff x y z" and then run "qdiff a b c", we end up with "diff x y z a b c". However, currently we reverse alias parameters, so you actually get "diff z y x a b c".

This is a problem for `arc alias bdiff -- diff --background 1`, which evaluates to `arc diff 1 --background` and fails.

Test Plan: Created a `bdiff` alias and ran it successfully.

Reviewers: vrana, btrahan

Reviewed By: btrahan

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

14 years agoRun lint and unit before updating revision
vrana [Wed, 8 Aug 2012 19:08:41 +0000 (12:08 -0700)]
Run lint and unit before updating revision

Summary: Depends on D2614.

Test Plan:
Updated a diff with no lint errors.
Updated a diff with lint errors, verified that the previous message is not lost.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoRun lint and unit tests in `arc diff` on background
vrana [Mon, 6 Aug 2012 20:40:20 +0000 (13:40 -0700)]
Run lint and unit tests in `arc diff` on background

Summary:
I usually write commit messages 1-2 minutes.
`arc lint` in our repository usually runs for around 30 seconds, `arc unit` another minute or two.
Even Phabricator unit tests sometimes runs long (because `CREATE DATABASE` and `DROP DATABASE` is slow in our setup for some reason).

Waiting for the results is boring and unnecessary.

This diff presents two different concepts how to run them on background:

# Lint is run with `--output json`, results are parsed and presented back to user. It isn't perfect - there's no context in printed lint errors which is a serious problem.
# Unit tests are run normally and the results are written to a scratch file. It also isn't perfect - colors are lost during the process.

I'll probably choose one approach and use it on both places. Let me know your thoughts about them.

This can be further improved to resolve the futures also after inputting the update message but it can be done in a separate diff.

Test Plan:
- Remove lint engine.
- Remove unit engine.
- Make lint errors.
- Make unit errors.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, beng, tuomaspelkonen, alanh
Differential Revision: https://secure.phabricator.com/D2614

14 years agoDepend on events when attaching Diff ID to postponed unit tests
vrana [Mon, 6 Aug 2012 23:56:11 +0000 (16:56 -0700)]
Depend on events when attaching Diff ID to postponed unit tests

Summary:
According to @epriestley, it's nasty and kind of crazy: D2933#1.
It also stands in my way for D2614.

Test Plan: Rewrote our callsite to event listener and verified that it still works.

Reviewers: tuomaspelkonen, epriestley

Reviewed By: epriestley

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

14 years agoFix an issue where branches at the same commit race to destruction in "arc branch"
epriestley [Wed, 8 Aug 2012 01:21:32 +0000 (18:21 -0700)]
Fix an issue where branches at the same commit race to destruction in "arc branch"

Summary:
If two branches have the same HEAD, they currently race to overwrite each other in $commit_map.

We don't need to return a map indexed by commit since nothing ever reads the keys out of it. Just update $branches in place.

Test Plan: With two branches at the same HEAD, ran "arc branch". Saw both branches in output.

Reviewers: vrana, btrahan

Reviewed By: btrahan

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

14 years agoThrow properly if there are uncommitted changes under Git
epriestley [Mon, 6 Aug 2012 18:56:01 +0000 (11:56 -0700)]
Throw properly if there are uncommitted changes under Git

Summary: This was accidentally disabled with some Mercurial changes that allowed dirty working copies.

Test Plan: Ran `arc diff` with staged changes.

Reviewers: nh

Reviewed By: nh

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

14 years agoUse PhutilConsole in lint and unit
vrana [Sun, 5 Aug 2012 02:23:53 +0000 (19:23 -0700)]
Use PhutilConsole in lint and unit

Test Plan:
`arc lint` with OK result and with patchable error.
`arc unit` with passes and errors.
`arc diff` with patchable lint error.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoAdd an arc flag workflow
Alan Huang [Fri, 3 Aug 2012 19:00:54 +0000 (12:00 -0700)]
Add an arc flag workflow

Summary:
Allow querying and modifying flags from arcanist. Currently
supports only printing and deleting flags for Differential revisions,
but it should be straightforward to add more capabilities (given Conduit
support).

Test Plan:
Run arc flag, passing it various revisions. Flags are
modified appropriately.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1556

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

14 years agoAdd mysql and mysqli functions to the phutil map whitelist
epriestley [Wed, 1 Aug 2012 18:02:20 +0000 (11:02 -0700)]
Add mysql and mysqli functions to the phutil map whitelist

Summary: I originally excluded `mysql` these under the theory that it would be impossible to test anything without it, but `arc` doesn't need it and you could have only one of the mysql-flavored extensions without having the other one. Whitelist all the mysql and mysqli extension functions as far as depenencies are concerned.

Test Plan: @floatinglomas, let me know if this fixes things for you?

Reviewers: btrahan, vrana, floatinglomas

Reviewed By: btrahan

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

14 years agoMerge pull request #47 from aurelijus/master
Evan Priestley [Mon, 30 Jul 2012 11:54:21 +0000 (04:54 -0700)]
Merge pull request #47 from aurelijus/master

JSHint linter issue on windows

14 years agoJSHint linter issue on windows
Aurelijus [Mon, 30 Jul 2012 07:21:03 +0000 (09:21 +0200)]
JSHint linter issue on windows

Summary: On windows there is no 'which', only 'where'

Test Plan: Run JSHint linter on windows and unix-like system.

Reviewers: epriestley

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

14 years agoMake arc patch show the superior error message if you are not authenticated
Bob Trahan [Sun, 29 Jul 2012 18:57:36 +0000 (11:57 -0700)]
Make arc patch show the superior error message if you are not authenticated

Summary: ...by making requireAuthentication return true if conduit is required.

Test Plan: mv ~/.arcrc ~/.arcrcbak; arc patch D12121; <verify error message>

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1522

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

14 years agoInclude extension classes in the builtin list
epriestley [Thu, 26 Jul 2012 21:46:53 +0000 (14:46 -0700)]
Include extension classes in the builtin list

Summary: Just like we ship with a list of extension functions, add a list of extension classes so people stop getting lint errors about DOMDocument just because some linter uses it.

Test Plan: Ran "arc lint".

Reviewers: vrana, btrahan, codeblock

Reviewed By: vrana

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

14 years agoAdded support for 'hg export' diff format
Grigory [Thu, 26 Jul 2012 17:06:16 +0000 (10:06 -0700)]
Added support for 'hg export' diff format

Summary: This diff format is used by de-facto mercurial GUI called "TortoiseHG".
It is available as the only way to copy diff into clipboard (right click commit,
select "export", select "copy patch". I added this format support into arcanist
so revisions in Differential can be created from TortoiseHG via simple copy-
paste. Unit test added, manually tested.

See: https://github.com/facebook/arcanist/pull/46

Reviewed by: epriestley

14 years agoMinor, improve behavior of arc get-config.
epriestley [Thu, 26 Jul 2012 03:14:28 +0000 (20:14 -0700)]
Minor, improve behavior of arc get-config.

14 years agoAllow hyphens in arc library names
Nick Harper [Thu, 26 Jul 2012 01:37:25 +0000 (18:37 -0700)]
Allow hyphens in arc library names

Summary:
We've had these in our library names and they're quite useful as word
separators. Allowing them shouldn't cause any trouble.

Test Plan:
ran arc liberate in an empty directory, and it didn't complain when I gave
it a name with a hyphen.

Reviewers: epriestley, vrana, jungejason

Reviewed By: epriestley

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

14 years agoEnrich arc configuration and add stronger typing
epriestley [Thu, 26 Jul 2012 01:37:09 +0000 (18:37 -0700)]
Enrich arc configuration and add stronger typing

Summary:
See <https://github.com/facebook/arcanist/issues/45>

Currently, when the user types `arc set-config x false`, we set it as the string "false", which is usually not desirable. We have some steps toward typed config already, but expand on what we have and move as much stuff as possible into it, including all the config settings that aren't currently documented (there are still some lint-specific and project-specific settings not present here, but this is most of it).

Also make the `phutil_libraries` key a legacy name for `load`, and `immutable_history` a legacy name for `history.immutable`. Generally the goal here is to make config simpler and bring it more in-line with Git/Mercurial, which use dotted hierarchies.

I'll add some documentation here but I think most of the changes should be fairly straightforward.

Test Plan:
  - `arc set-config history.immutable on` (And similar -- sets to boolean true.)
  - `arc set-config history.immutable off` (And similar -- sets to boolean false.)
  - `arc set-config history.immutable derp` (And similar -- raises exception.)
  - `arc set-config history.immutable ''` (And similar -- removes setting value.)
  - `arc set-config --show`
  - `arc get-config`
  - `arc get-config base`

Reviewers: dschleimer, bos, btrahan, vrana

Reviewed By: dschleimer

CC: aran
Maniphest Tasks: T1546

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

14 years agoFix parsing of "hg diff -r x:y" diffs
epriestley [Wed, 25 Jul 2012 22:55:32 +0000 (15:55 -0700)]
Fix parsing of "hg diff -r x:y" diffs

Summary: When you run `hg diff -r x:y`, we get two "-r" arguments in the diff header. Currently, we parse this incorrectly.

Test Plan: Added unit test which previously failed; test now passes.

Reviewers: dschleimer, btrahan

Reviewed By: dschleimer

CC: aran, cakoose
Maniphest Tasks: T1550

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

14 years agoCreate a mysterious new workflow
Alan Huang [Sat, 21 Jul 2012 09:09:21 +0000 (02:09 -0700)]
Create a mysterious new workflow

Summary:
Phabricator, as we all know, is marketed as a fun adventure game. However, while it is occasionally fun and often an adventure, it's so far been sorely deficient in the game aspect. This patch aims to rectify that oversight. (Presence of the first two qualities is not guaranteed.)

Note: In case there's any doubt, this is not a serious suggestion. I was bored.

Test Plan: Seriously?

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoEnable raising lint warnings for mulitple lines at once
vrana [Sun, 22 Jul 2012 19:52:10 +0000 (12:52 -0700)]
Enable raising lint warnings for mulitple lines at once

Summary:
We have a lint rule checking if some string is too long.
This string can span multiple lines.
If we report a warning at the first line then it is muted if the first line wasn't modified.
We need to say that this whole block is wrong and report it when at least one line from the block was modified.

Test Plan: Changed a lint rule to call `raiseLintAtLines()` and verified that the warning is reported even if the changed line isn't first.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoFix ambiguous argument where a branch has the same name as a file
epriestley [Sun, 22 Jul 2012 20:19:09 +0000 (13:19 -0700)]
Fix ambiguous argument where a branch has the same name as a file

Summary: Currently, if you have a branch named "docs" and a local file named "docs", `git show -s docs` complains because it's ambiguous. Use `--` to unambiguously mark branches as revisions, not files.

Test Plan: Ran `arc branch` in a working copy with a "docs" branch and a "docs" file, got expected results.

Reviewers: vrana, btrahan

Reviewed By: vrana

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

14 years agoShow "Fnnn" number in "arc upload"
epriestley [Sat, 21 Jul 2012 13:44:21 +0000 (06:44 -0700)]
Show "Fnnn" number in "arc upload"

Summary: We don't show the "Fnnn" number, but should.

Test Plan:
```$ arc upload README --conduit-uri=http://local.aphront.com:8080/
Uploading 'README'...
  F121 README: http://local.aphront.com:8080/file/data/fnu76irnwftin4akjpxv/PHID-FILE-yrjeblelwq6rv5a5gjko/README

Done.```

Reviewers: phleet, btrahan, vrana

Reviewed By: btrahan

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

14 years agoMerge pull request #44 from ifraimow/master
Evan Priestley [Thu, 19 Jul 2012 22:19:57 +0000 (15:19 -0700)]
Merge pull request #44 from ifraimow/master

Adding confirmation message to 'arc todo' with information about the task created

14 years agoAdding confirmation message to 'arc todo' with information about the task created
Izzy Fraimow [Thu, 19 Jul 2012 22:12:12 +0000 (15:12 -0700)]
Adding confirmation message to 'arc todo' with information about the task created

Summary: 'arc todo' now logs a message with the task title and URI when run.

Test Plan: Run 'arc todo test' and see that it logs a message with the form 'Created task <task number>: '<task title' at <task URI>

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoAllow running phpunit tests from any directory
vissi [Thu, 19 Jul 2012 22:00:14 +0000 (15:00 -0700)]
Allow running phpunit tests from any directory

Test Plan: Run `arc unit` anywhere.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoMerge pull request #43 from rafikk/master
Evan Priestley [Thu, 19 Jul 2012 17:50:09 +0000 (10:50 -0700)]
Merge pull request #43 from rafikk/master

Specify error severity for some PyFlakes messages

14 years agoSpecify error message for some pyflakes messages
Rafik Salama [Thu, 19 Jul 2012 17:40:31 +0000 (10:40 -0700)]
Specify error message for some pyflakes messages

14 years agoSpeedup `arc branch`
vrana [Wed, 18 Jul 2012 23:50:49 +0000 (16:50 -0700)]
Speedup `arc branch`

Summary:
This reduces time of `arc branch` from 13s to 7s in my repo which is faster than `git branch --verbose` (10s).

The price for this speedup is that we loose the information [ahead 1, behind 21242] but we showed it only in branches with no revision so it's not a big deal.

Test Plan:
  $ arc branch

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoFix arc handling of "\n" files on Windows in SVN
epriestley [Wed, 18 Jul 2012 13:53:07 +0000 (06:53 -0700)]
Fix arc handling of "\n" files on Windows in SVN

Summary:
On Windows, a diff may have "\n" newlines (from the file itself) but "\r\n" blocks (from svn).

NOTE: indents are funky since I edited this with Notepad++, I'll fix before landing.

Test Plan: Diffed an edit to a "\n" newline file on Windows in SVN.

Reviewers: btrahan, vrana

Reviewed By: vrana

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

14 years agoDump problematic parser patches to temp files in "arc diff"
epriestley [Tue, 17 Jul 2012 23:16:18 +0000 (16:16 -0700)]
Dump problematic parser patches to temp files in "arc diff"

Summary: I'm trying to get a repro for a Windows + SVN patch issue. Dump patches which fail to a temp file so there's less bewilderment in getting the right patch handed over for analysis.

Test Plan: Forced a parse failure, ran "arc diff", inspected temp file.

Reviewers: btrahan, vrana

Reviewed By: btrahan

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

14 years agoFix some arc/mercurial issues
epriestley [Tue, 17 Jul 2012 23:16:11 +0000 (16:16 -0700)]
Fix some arc/mercurial issues

Summary:
  - In "arc which", we recommend "--rev x --rev ." to show changes. This is not accurate if there are uncommitted changes in the working copy. Just "--rev x" shows the correct changes (implicitly, the other end of the range is the working copy state).
  - When you diff only working copy changes, we currently incorrectly identify all your open revisions as belonging to the working copy. Instead, correctly identify none of them as belonging to the working copy (in theory, we could go farther than this and do path-based identification like SVN, but with --amend in hg 2.2+ this workflow should be going away in the long run).
  - If you have uncommitted working copy changes, never try to amend.

Test Plan: Ran "arc which .", "arc diff ." in a working copy with dirty changes, got better results than before.

Reviewers: dschleimer, btrahan

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T1507

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

14 years agoImprove Arcanist + Windows + SVN compatibility
epriestley [Tue, 17 Jul 2012 00:28:13 +0000 (17:28 -0700)]
Improve Arcanist + Windows + SVN compatibility

Summary: From "cmd.exe" with, e.g. SilkSVN, there are some issues getting arc to do anything useful. Resolve enough of them so that it's at least usable.

Test Plan: Created a revision from Windows / cmd.exe / arc / SVN.

Reviewers: btrahan, jungejason, vrana

Reviewed By: vrana

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

14 years agoarcanist: add postponed linter support
Andrew Gallagher [Mon, 2 Jul 2012 22:53:22 +0000 (15:53 -0700)]
arcanist: add postponed linter support

Summary:
This uses a similiar approach as with postponed unittests, allowing
the lint workflow/engine to report postponed linter names.  After
the lint engine is run, a separate method is used to collect any
postponed linters and these are reposted to the diff via the
"arc:lint-postponed" property.

Also, a ##diff.wasCreated## was added allowing hooks to be called
immediately after the call ##differential.creatediff## with the
returned diff ID.

Test Plan:
Created diffs with a dummy lint engine which always reports a
postponed linter.

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1332

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

14 years agoFix "arc branch" performance regression
epriestley [Wed, 11 Jul 2012 23:55:29 +0000 (16:55 -0700)]
Fix "arc branch" performance regression

Summary: See discussion in T1467. This `log` logs everything in the repo. The old command was `show -s`, I just unthinkingly converted it and it doesn't matter for non-Facebook-sized repositories.

Test Plan: Ran "arc branch".

Reviewers: btrahan

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T1467

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

14 years agoAdd mb_* functions to the external function list
epriestley [Wed, 11 Jul 2012 23:55:21 +0000 (16:55 -0700)]
Add mb_* functions to the external function list

Summary: The mbstring extension is common but not part of the PHP core, and we have a soft dependency on it but generally guard calls with function_exists(). Add the mbstring functions to the whitelist of known extension functions so lint doesn't raise errors about them if you don't have mbstring installed.

Test Plan: @ffx, can you verify this fixes the lint issue for you? Probably faster than recompiling my PHP without mbstring.

Reviewers: ffx, btrahan

Reviewed By: btrahan

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

14 years agoSupport an 'editor' config in arc
epriestley [Wed, 11 Jul 2012 23:55:11 +0000 (16:55 -0700)]
Support an 'editor' config in arc

Summary: See D2955. Allow "arc set-config editor ..." to override all other editor settings.

Test Plan: Ran "arc set-config editor 'mate -w'", am typing this in textmate.

Reviewers: btrahan, ezfoxie

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T1309

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

14 years agoCreate an arc todo workflow for quickly creating a task.
Alan Huang [Wed, 11 Jul 2012 00:32:36 +0000 (17:32 -0700)]
Create an arc todo workflow for quickly creating a task.

Summary:
Run `arc todo o rly?` to create a Maniphest task
titled 'o rly?'. Pass --cc to add CCs besides yourself.

Test Plan: Ran `arc todo o rly?`. Behaved as expected.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T749, T1325

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

14 years agoSupport invalid commit message in "arc branch"
Jason Ge [Mon, 9 Jul 2012 19:05:35 +0000 (12:05 -0700)]
Support invalid commit message in "arc branch"

Summary:
when a commit message contains error which fails the parsing, we 'arc branch' fails. One sample commit message we saw contains

  Differential Revision: 363812, 367983, 370452

The author manually committed the code without a real revision.

Test Plan: ran on the repo with problem commit and it succeeded.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoSupport "load" key in arc system configuration
epriestley [Fri, 6 Jul 2012 17:05:55 +0000 (10:05 -0700)]
Support "load" key in arc system configuration

Summary: I think @nh needs this at some point?

Test Plan: Added bogus and valid "load" to system config, got warning and load respectively.

Reviewers: nh, dschleimer, btrahan

Reviewed By: dschleimer

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

14 years agoPrint out the locations of libphutil and arcanist when arc is run with --trace
epriestley [Fri, 6 Jul 2012 17:05:49 +0000 (10:05 -0700)]
Print out the locations of libphutil and arcanist when arc is run with --trace

Summary: We currently print //additional// libraries, but not the core libraries, which makes diagnosing include problems more difficult than necessary.

Test Plan: ran `arc derp --trace`, got libphutil/arcanist locations

Reviewers: btrahan

Reviewed By: btrahan

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

14 years agoUse binary safe diff in arc diff
Jason Ge [Tue, 3 Jul 2012 20:25:49 +0000 (13:25 -0700)]
Use binary safe diff in arc diff

Summary: Otherwise svn diff fails when the file is binary but the "svn:mime-type = application/x-shellscript" is missing in it.

Test Plan: arc diff succeeded against deleting a binary file which doesn't have svn:mime-type = application/x-shellscript.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoMake bin/arc less linux-centered, more UNIX-agnostic
Sébastien Santoro [Tue, 3 Jul 2012 13:34:11 +0000 (06:34 -0700)]
Make bin/arc less linux-centered, more UNIX-agnostic

Summary: Using /usr/bin/env in #! to allow the arc script to run as is in every UNIX OSes, like FreeBSD where bash is installed in /usr/local/bin/bash.

Test Plan: Tested on Solaris, Ubuntu, kFreeBSD/Debian and FreeBSD.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Maniphest Tasks: T1440

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

14 years agoMinor, stop arc upgrade from prompting for commit ranges.
epriestley [Tue, 3 Jul 2012 02:50:35 +0000 (19:50 -0700)]
Minor, stop arc upgrade from prompting for commit ranges.

14 years agoMinor, don't explode when mbstring is missing and don't do utf8-to-utf8 conversions.
epriestley [Tue, 3 Jul 2012 02:34:59 +0000 (19:34 -0700)]
Minor, don't explode when mbstring is missing and don't do utf8-to-utf8 conversions.

14 years agoImplement "arc:amended" and fix various problems with ArcanistMercurialAPI
epriestley [Sun, 1 Jul 2012 18:06:05 +0000 (11:06 -0700)]
Implement "arc:amended" and fix various problems with ArcanistMercurialAPI

Summary:
  - Implement "arc:amended", a base commit DSL rule which always selects HEAD (git) or `.` (hg) if it has "differential revision:" in the commit message. This is unambiguously correct in amend workflows, and can cover holes in other rules like "git:branch-unique(*)".
  - Fix a bunch of Mercurial stuff:
    - Our use of '.' is wrong, and based on a misunderstanding on my part of the behavior of `hg diff --rev . --rev .`, which means "ignore the second --rev flag", not ". means working directory state". As far as I know there's no explicit way to say "the working copy plus all its changes".
    - The `--prune` argument to "hg log" does not support symbolic names like ".^". Use revsets instead.
    - Reduce the number of times we need to run `hg branch`.
    - We can safely use "." to mean "the working copy revision", and do not need to do "hg --debug id" or similar.
    - Generally simplify some of the nonsense in the implementation left over from me having no idea how Mercurial works.

Test Plan:
Ran "arc which" in various scenarios in a mercurial working copy. I //think// I exercised all the changes.

Ran "arc which --base arc:amended" in hg and git working copies without "Differential Revision:" in head/. (no match) and with it (matched head/.).

Reviewers: dschleimer

Reviewed By: dschleimer

CC: Makinde, tido, phleet, aran
Maniphest Tasks: T1233

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

14 years ago[Arcanist] collect svn and bookmark info for Mercurial
dschleimer [Sat, 30 Jun 2012 23:00:48 +0000 (16:00 -0700)]
[Arcanist] collect svn and bookmark info for Mercurial

Summary:
This increases the amount of information arc diff collects in
Mercurial repositories.  IN particular, it collects the active
bookmark, if there is one, and svn information in hgsubversion
repositories.

The Phabricator half of this is https://secure.phabricator.com/D2897

Test Plan:
[14:06:59 Sat Jun 30 2012] dschleimer@dev4022.snc6 ~/www-hg
www-hg  2941 $ ~/devtools/arcanist/bin/arc diff --only --conduit-uri http://phabricator.dschleimer.dev4022.facebook.com
HipHop Notice:  Undefined index: 1 in /data/users/dschleimer/devtools/arcanist/src/repository/api/ArcanistMercurialAPI.php on line 708
Created a new Differential diff:
        Diff URI: http://phabricator.dschleimer.dev4022.facebook.com/differential/diff/126/

Included changes:
  A       foo
HipHop Notice:  Undefined index: 1 in /data/users/dschleimer/www-hg/lib/arcanist/arcanist/FacebookArcanistConfiguration.php on line 81
mcproxy on this server is out of date
version: , expected version:
please restart (http://fburl.com/1787362)

[14:07:46 Sat Jun 30 2012] dschleimer@dev4022.snc6 ~/www-hg
www-hg  2941 $ echo '{"diff_id": 126}' | ~/devtools/arcanist/bin/arc call-conduit differential.getdiff --conduit-uri http://phabricator.dschleimer.dev4022.facebook.com | json_pretty | egrep -i 'bookmark|sourcecontrol'
        "bookmark": "bar",
        "sourceControlBaseRevision": "svn+ssh://tubbs/svnroot/tfb/trunk/www@583442",
        "sourceControlPath": "svn+ssh://tubbs/svnroot/tfb/trunk/www",
        "sourceControlSystem": "hg",

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1331

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

14 years agoSupport "D123", not just "123", for "arc export --revision"
epriestley [Thu, 28 Jun 2012 01:33:28 +0000 (18:33 -0700)]
Support "D123", not just "123", for "arc export --revision"

Summary: We currently error if a user types "--revision D123".

Test Plan: `arc export --git --revision D123`, got a diff.

Reviewers: vrana, jungejason

Reviewed By: vrana

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

14 years agoImplement "git:branch-unique(*)" in the base commit DSL
epriestley [Wed, 27 Jun 2012 19:12:39 +0000 (12:12 -0700)]
Implement "git:branch-unique(*)" in the base commit DSL

Summary:
Add a DSL command to select the first commit between HEAD and (the merge-base of some target with HEAD) that's on more than one branch.

This is similar to @csilvers' suggestion in <https://secure.phabricator.com/T1233#comment-8>. A specific problem this address is that, currently, if you use this workflow:

  $ git checkout -b feature
  $ git commit
  $ git checkout -b subfeature
  $ git commit

..i.e., develop dependent features in sub-branches, "arc diff" will try to send up (feature + subfeature). If you use the rule 'git:branch-unique(origin/master)' instead, diffing from 'subfeature' will correctly select only the commit(s) on 'subfeature'.

Test Plan: Constructed feature/subfeature branches, verified that we select the correct base commit.

Reviewers: dschleimer, csilvers, btrahan, jungejason

Reviewed By: dschleimer

CC: aran
Maniphest Tasks: T1233

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

14 years agoAdd newline
vrana [Wed, 27 Jun 2012 18:21:19 +0000 (11:21 -0700)]
Add newline

14 years agoRemove PhutilModuleRequirements
epriestley [Wed, 27 Jun 2012 01:22:36 +0000 (18:22 -0700)]
Remove PhutilModuleRequirements

Summary: Yeah, we can nuke this.

Test Plan: Grepped for callsites.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years ago[Arcanist] add an arc:bookmark base for Mercurial
dschleimer [Tue, 26 Jun 2012 22:04:35 +0000 (15:04 -0700)]
[Arcanist] add an arc:bookmark base for Mercurial

Summary:
This adds a new base option that Does the Right Thing (or as close to
it as I can get) for someone using Mercurial bookmarks as lightweight
branches, and where each branch should be one differential revision.
Specifically, it walks backwards through the ancestors of the working
copy until it finds a revision that is either not outgoing (ie already
in the remote) or that is bookmarked.  This means that bookmarks
effectively act as delimiters, and point at the last revision that
will be included in an arc diff.

Test Plan:
[14:40:54 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1226 $ hg log -r '(first(outgoing())^)::' --template='node: {node}\nbookmark: {bookmarks}\n\n' -G
@  node: c8379ef32b0d0e6cf94fe636751ea4fe1353e157
|  bookmark:
|
| o  node: 14f03139049cbda339190b814e52f4ec8b05c431
| |  bookmark: more
| |
| o  node: 6970e9263ab8c6da428420606d1f15c9980da183
| |  bookmark: something
| |
| o  node: 433a93023f03d5f3eddaa243fa973d32a1566aee
|/   bookmark:
|
o  node: f47ccfe34267592dd2e336174a3a311b8783c024
|  bookmark:
|

[14:41:00 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1226 $ ~/devtools/arcanist/bin/arc which --show-base --base 'arc:bookmark'
f47ccfe34267592dd2e336174a3a311b8783c024

[14:41:05 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1226 $ hg up 14f03139049cbda339190b814e52f4ec8b05c431
3 files updated, 0 files merged, 1 files removed, 0 files unresolved

[14:41:10 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1226 $ ~/devtools/arcanist/bin/arc which --show-base --base 'arc:bookmark'
6970e9263ab8c6da428420606d1f15c9980da183

[14:41:14 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1226 $ hg up 6970e9263ab8c6da428420606d1f15c9980da183
0 files updated, 0 files merged, 1 files removed, 0 files unresolved

[14:41:44 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1227 $ ~/devtools/arcanist/bin/arc which --show-base --base 'arc:bookmark'
f47ccfe34267592dd2e336174a3a311b8783c024

Reviewers: epriestley, bos

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1331

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

14 years agoRequire space after `//`
vrana [Thu, 21 Jun 2012 23:21:04 +0000 (16:21 -0700)]
Require space after `//`

Summary:
I use `//~` for marking places which shouldn't be committed.
It also looks ugly.
Maybe it can be just a warning but we provide a patch so error is OK?

Test Plan: New test.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoMinor, always show the current branch in "arc branch"
epriestley [Tue, 26 Jun 2012 19:45:47 +0000 (12:45 -0700)]
Minor, always show the current branch in "arc branch"

14 years agoRemove all libphutil v1 support
epriestley [Tue, 26 Jun 2012 19:40:42 +0000 (12:40 -0700)]
Remove all libphutil v1 support

Summary:
Delete all code related to v1 libraries in arcanist.

When users liberate a v1 library, prompt them to upgrade.

Test Plan: Reverted phabricator/ to a couple of months ago and liberated it. Got prompted to upgrade. Upgraded.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years agoAdd various flags to the HgProxy daemons
epriestley [Tue, 26 Jun 2012 18:00:26 +0000 (11:00 -0700)]
Add various flags to the HgProxy daemons

Summary:
  - Add flags to exit after an idle time or client count.
  - Add flags to control daemonization.
  - Add flags to control output.
  - Add flags to skip the "hello" frame of the protocol.
  - Make the client launch a server if one does not exist.

The one-time overhead to launch a server and run a command through it looks to be ~130% of the overhead to run the command directly with "hg", so even if we never run a second command we're not paying too much.

The incremental overhead to run subsequent command appears to be less than 3% of the overhead to run the command directly with "hg" (and maybe less than 1%, I'm not sure how long the computation part of a command like 'hg log' "actually" takes).

The overhead to launch a PHP client, connect to an existing server, run a command, and then print it and exit is roughly 50% of the overhead to run the command directly with "hg". So theoretically a user can achieve an amortized 2x performance increase for all 'hg' commands by aliasing 'hg' to the PHP client in their shell.

Test Plan:
  - Ran servers with idle and client count limits, let them idle and/or hit their connection limits, saw them exit.
  - Ran foreground and background servers.
  - Ran a daemon server with redirected stdout/stderr. Verified logs appeared.
  - Ran with --quiet.
  - Ran clients and servers with and without --skip-hello, things work if they agree and break if they disagree. The throughput gain on this is fairly small (maybe 5%?) but it seems simple enough to keep for the moment.
  - Ran serverless clients and verified that servers launched the first time, were available subsequently, and relaunched after 15 seconds idle.

Reviewers: csilvers, vrana, btrahan

Reviewed By: csilvers

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

14 years agoSimplify "arc branch" and make it work in immutable history repositories
epriestley [Tue, 26 Jun 2012 17:50:43 +0000 (10:50 -0700)]
Simplify "arc branch" and make it work in immutable history repositories

Summary:
  - Move "arc branch"-specific code to the branch workflow.
  - Instead of doing "git rev-parse", just do "git branch --verbose --abbrev=40".
  - Use revision owners to identify ownership, not working copy identity. Particularly with the advent of "Commandeer", you might not own commits you made.
  - Do a batch lookup for commits by hash (depends on D2859, but doesn't break without it).
  - Use PhutilConsole for console stuff.
  - Removed color from "arc list" for the moment.
  - The "--by-status" flag has a slightly different output format now.

Test Plan: Ran "arc branch" in various circumstances, verified it identifies branches in immutable history repositories.

Reviewers: btrahan, vrana, jungejason, nh, slawekbiel

Reviewed By: slawekbiel

CC: aran
Maniphest Tasks: T693

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

14 years ago[Arcanist] fix scratch dir for svn >= 1.7
dschleimer [Tue, 26 Jun 2012 00:13:29 +0000 (17:13 -0700)]
[Arcanist] fix scratch dir for svn >= 1.7

Summary:
svn 1.7 got rid of the per-direcotry .svn dirs in favor of a single
.svn directory under the root of the working copy.  Unfortunately, we
relied on ther being a .svn directory at the same level as .arcconfig,
which may or may not be at the root of the working copy.  We now walk
up the directory tree until we find a .svn directory that we can use
for scratch files.

Test Plan:
[16:27:52 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/data/admin/facebook/scripts/db
db  21298 $ ls -la .arcconfig .svn ../../../.svn/arc/config
ls: .svn: No such file or directory
ls: ../../../.svn/arc/config: No such file or directory
-rw-r--r-- 1 dschleimer users 239 Jun 25 16:15 .arcconfig

[16:27:54 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/data/admin/facebook/scripts/db
db  21298 $ ~/devtools/arcanist/bin/arc set-config --local foo bar
Set key 'foo' = 'bar' in local config.

[16:29:40 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/data/admin/facebook/scripts/db
db  21298 $ ls -la .arcconfig .svn ../../../.svn/arc/config
ls: .svn: No such file or directory
-rw-r--r-- 1 dschleimer users 239 Jun 25 16:15 .arcconfig
-rw-r--r-- 1 dschleimer users  20 Jun 25 16:29 ../../../.svn/arc/config

[16:29:43 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/data/admin/facebook/scripts/db
db  21298 $ cat ../../../.svn/arc/config
{
  "foo" : "bar"
}

[16:29:48 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/data/admin/facebook/scripts/db
db  21299 $ ~/devtools/arcanist/bin/arc get-config foo
(global) foo =
(local) foo = bar

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1411

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

14 years ago[arcanist] add system arc config file
dschleimer [Mon, 25 Jun 2012 22:14:11 +0000 (15:14 -0700)]
[arcanist] add system arc config file

Summary:
Adds a system arc config file with precedence below the user config
file, both to ArcanistWorkingCopyIdentity::readConfigFromAnySource()
and to base commit resolution.

Test Plan:
[14:48:45 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist system_config 21245 $ cat /etc/arcconfig
{
    "base": "literal:foobar"
}
[14:52:31 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist system_config 21246 $ ./bin/arc get-config base
(system) base = literal:foobar
(global) base =

[14:52:39 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist system_config 21247 $ ./bin/arc which --show-base --base 'arc:system'
foobar

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1233

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

14 years agoMerge pull request #40 from phleet/patch-2
Evan Priestley [Mon, 25 Jun 2012 20:53:00 +0000 (13:53 -0700)]
Merge pull request #40 from phleet/patch-2

Fix help message for arc tasks --status

14 years agoFix help message for arc tasks --status
Jamie Wong [Mon, 25 Jun 2012 20:46:51 +0000 (17:46 -0300)]
Fix help message for arc tasks --status

14 years agoIntroduce `arc inlines`
vrana [Sat, 23 Jun 2012 06:08:25 +0000 (23:08 -0700)]
Introduce `arc inlines`

Summary: This displays all inline comments attached to a revision in a format consumable by editors.

Test Plan: Ran it, opened the file on the line.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoWarn about PHP 5.3 only functions and parameters
vrana [Fri, 22 Jun 2012 20:47:18 +0000 (13:47 -0700)]
Warn about PHP 5.3 only functions and parameters

Test Plan:
Linted:

  json_decode('{}', true, 1, 1);
  gethostname();

Also linted all Phabricator repositories and found no occurrence.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1158

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

14 years agoSimplify handling errors in PHPCS linter
vrana [Thu, 21 Jun 2012 17:42:17 +0000 (10:42 -0700)]
Simplify handling errors in PHPCS linter

Test Plan:
  libxml_use_internal_errors(true);
  $report_dom = new DOMDocument();
  $report_dom->loadXML('<a</a>');
  $report_dom = new DOMDocument();
  $report_dom->loadXML('<a></a>');
  $report_dom = new DOMDocument();
  $report_dom->loadXML('');
  print_r(libxml_get_errors());

Reviewers: aurelijus

Reviewed By: aurelijus

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

14 years agoMerge pull request #38 from phleet/patch-1
dschleimer-fb [Fri, 22 Jun 2012 19:31:15 +0000 (12:31 -0700)]
Merge pull request #38 from phleet/patch-1

Fix mixing parens on getWorkingCopyIdentity in ArcanistMercurialAPI

14 years agoFix mixing parens on getWorkingCopyIdentity in ArcanistMercurialAPI
Jamie Wong [Fri, 22 Jun 2012 19:25:49 +0000 (16:25 -0300)]
Fix mixing parens on getWorkingCopyIdentity in ArcanistMercurialAPI

14 years agoSave files with path to phutil cache
vrana [Thu, 21 Jun 2012 18:48:23 +0000 (11:48 -0700)]
Save files with path to phutil cache

Test Plan:
  $ arc liberate
  $ mv a.php b.php
  $ arc liberate

Previously, it didn't update the map.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoSupport 'arc:exec(command)' in base-commit DSL
epriestley [Fri, 22 Jun 2012 15:13:06 +0000 (08:13 -0700)]
Support 'arc:exec(command)' in base-commit DSL

Summary: Allow users to run a command to determine the base revision of the commit range.

Test Plan: Ran stuff like `arc which --show-base --base 'arc:exec(ls)'` and got the expected results.

Reviewers: dschleimer, csilvers, btrahan, vrana

Reviewed By: csilvers

CC: aran
Maniphest Tasks: T1233

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

14 years ago[Arcanist] mercurial base commit DSL support
dschleimer [Fri, 22 Jun 2012 01:12:09 +0000 (18:12 -0700)]
[Arcanist] mercurial base commit DSL support

Summary:
This adds Mercurial support to the base commit DSL that's equivalent
to git's, though not identical.  Specifically, Mercurial has
arc:outgoing instead of arc:upstream, and hg:gca(commit) instead of
git:merge-base(commit), though they have similar behaviors.

Test Plan:
  [13:37:13 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20536 $ hg log -G -r master::
  @  changeset:   11:6970e9263ab8
  |  bookmark:    something
  |  tag:         tip
  |  user:        David Schleimer <dschleimer@fb.com>
  |  date:        Thu Jun 21 13:03:46 2012 -0700
  |  summary:     thing
  |
  o  changeset:   10:433a93023f03
  |  parent:      8:f47ccfe34267
  |  user:        David Schleimer <dschleimer@fb.com>
  |  date:        Thu Jun 21 13:03:34 2012 -0700
  |  summary:     some
  |
  | o  changeset:   9:c8379ef32b0d
  |/   bookmark:    other
  |    user:        David Schleimer <dschleimer@fb.com>
  |    date:        Thu Jun 21 13:01:04 2012 -0700
  |    summary:     other
  |
  o  changeset:   8:f47ccfe34267
  |  bookmark:    master
  |  user:        David Schleimer <dschleimer@fb.com>
  |  date:        Mon Jun 04 14:30:47 2012 -0700
  |  summary:     typo-fix
  |

  [13:38:00 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20536 $ ~/devtools/arcanist/bin/arc which --show-base --base hg:.^
  .^

  [13:38:11 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20536 $ ~/devtools/arcanist/bin/arc which --show-base --base 'hg:gca(other)'
  f47ccfe34267592dd2e336174a3a311b8783c024

  [13:38:21 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20536 $ hg id -r f47ccfe34267592dd2e336174a3a311b8783c024
  f47ccfe34267 master

  [13:38:31 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20537 $ ~/devtools/arcanist/bin/arc which --show-base --base 'arc:empty'
  null

  [13:38:44 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20538 $ hg id -r null
  000000000000

  [13:38:48 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20538 $ ~/devtools/arcanist/bin/arc which --show-base --base 'arc:outgoing'
  f47ccfe34267592dd2e336174a3a311b8783c024

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1233

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

14 years agoWarn about pht() with non constant string
vrana [Fri, 22 Jun 2012 00:41:26 +0000 (17:41 -0700)]
Warn about pht() with non constant string

Summary: We will extract them at some point, lint before it's too late.

Test Plan:
New test.
Linted all callsites.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoRemove bogus warning in liberate
vrana [Thu, 21 Jun 2012 18:52:16 +0000 (11:52 -0700)]
Remove bogus warning in liberate

14 years agoAdd example to --ansi
vrana [Thu, 21 Jun 2012 17:32:28 +0000 (10:32 -0700)]
Add example to --ansi

14 years agoMove line to a better place
vrana [Wed, 20 Jun 2012 20:03:03 +0000 (13:03 -0700)]
Move line to a better place

14 years agoAllow the "arc land --onto" default to be read from user config
epriestley [Wed, 20 Jun 2012 19:29:07 +0000 (12:29 -0700)]
Allow the "arc land --onto" default to be read from user config

Summary: Allow the default to be set in global config, not just project config.

Test Plan: `arc set-config arc.land.onto.default derp; arc land`

Reviewers: btrahan, vrana

Reviewed By: btrahan

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

14 years agoDocument --ansi
vrana [Wed, 20 Jun 2012 19:23:45 +0000 (12:23 -0700)]
Document --ansi

14 years agoWrap and simplify diff error excuse
vrana [Wed, 20 Jun 2012 01:14:26 +0000 (18:14 -0700)]
Wrap and simplify diff error excuse

Test Plan: Performed a lint error.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoUse pht() for plural
vrana [Tue, 19 Jun 2012 22:16:52 +0000 (15:16 -0700)]
Use pht() for plural

14 years agoUse new SVN format for all property changes
vrana [Tue, 19 Jun 2012 21:16:18 +0000 (14:16 -0700)]
Use new SVN format for all property changes

Test Plan: `svn diff`

Reviewers: nh

Reviewed By: nh

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

14 years agoDisplay number of assertions in unit test details
vrana [Sun, 17 Jun 2012 15:13:40 +0000 (08:13 -0700)]
Display number of assertions in unit test details

Test Plan: Show Full Unit Results on this diff.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoAdd test for "static::" to the PHP 5.3 linter
epriestley [Sun, 17 Jun 2012 16:01:47 +0000 (09:01 -0700)]
Add test for "static::" to the PHP 5.3 linter

Summary: See https://github.com/facebook/phabricator/issues/133.

Test Plan: Unit tests.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1158

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

14 years agoAdd a DSL for selecting base commits
epriestley [Fri, 15 Jun 2012 21:01:28 +0000 (14:01 -0700)]
Add a DSL for selecting base commits

Summary:
New optional mode. If you set 'base' in local, project or global config or pass '--base' to 'arc diff' or 'arc which', it switches to DSL mode.

In DSL mode, lists of rules from args, local, project and global config are resolved, in that order. Rules can manipulate the rule machine or resolve into actual commits. Provides support for some 'arc' rules (mostly machine manipulation) and 'git' rules (symbolic ref and merge-base).

Test Plan:
Ran unit tests. Also:

```$ arc which --show-base --base 'arc:prompt'

    Against which commit? HEAD
HEAD
$ arc which --show-base --base 'git:HEAD'
HEAD
$ arc which --show-base --base 'git:fake'
Usage Exception: None of the rules in your 'base' configuration matched a valid commit. Adjust rules or specify which commit you want to use explicitly.
$ arc which --show-base --base 'git:origin/master'
origin/master
$ arc which --show-base --base 'git:upstream'
Usage Exception: None of the rules in your 'base' configuration matched a valid commit. Adjust rules or specify which commit you want to use explicitly.
$ arc which --show-base --base 'literal:derp'
derp
$ arc which --show-base --base 'arc:halt'
Usage Exception: None of the rules in your 'base' configuration matched a valid commit. Adjust rules or specify which commit you want to use explicitly.
$ arc set-config --local base git:origin/master
Set key 'base' = 'git:origin/master' in local config.
$ arc which --show-base
origin/master
$ arc which --show-base --base 'git:HEAD^'
HEAD^
$ arc which --show-base --base 'arc:yield, git:HEAD^'
origin/master
$ arc which --show-base --base 'arc:global, git:HEAD^'
HEAD^
$ arc which --show-base --base 'arc:global, git:merge-base(origin/master)'
3f4f8992fba8d1f142974da36a82bae900e247c0```

Reviewers: dschleimer, vrana

Reviewed By: dschleimer

CC: aran
Maniphest Tasks: T1233

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

14 years agoUse pht()
vrana [Tue, 12 Jun 2012 01:33:19 +0000 (18:33 -0700)]
Use pht()

Test Plan: `arc cover`

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1139

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

14 years agoCall clearstatcache() after changing ~/.arcrc permissions
epriestley [Thu, 14 Jun 2012 19:30:21 +0000 (12:30 -0700)]
Call clearstatcache() after changing ~/.arcrc permissions

Summary: Otherwise we'll get a cached result from fileperms() if we end up here again.

Test Plan: `chmod 644 ~/.arcrc ; arc help` no longer double prompts when run from outside of a .arcconfig working copy.

Reviewers: csilvers

Reviewed By: csilvers

CC: aran
Maniphest Tasks: T1359

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

14 years agoMinor, fix relative path in PhutilLibraryMapBuilder
epriestley [Thu, 14 Jun 2012 19:15:00 +0000 (12:15 -0700)]
Minor, fix relative path in PhutilLibraryMapBuilder