1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-14 02:42:40 +01:00
Commit graph

150 commits

Author SHA1 Message Date
epriestley
b076b1c02a Use libphutil __init_script__.php to initialize Arcanist
Summary:
See D1950, same patch for arc/.

NOTE: I'm moving the ob_get_level() stuff to libphuil.

Test Plan: Ran "arc".

Reviewers: btrahan, killermonk

Reviewed By: btrahan

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1951
2012-03-19 19:17:03 -07:00
epriestley
6a7b1a7bdd Don't record anonymous functions into the symbol map
Summary:
Although we currently forbid anonymous functions, some day we will likely permit them, and our behavior for them is wrong.

Handle them correctly rather than throwing an exception because we should be covered by D1846 against accidental use, and we won't be on PHP 5.2 forever.

Test Plan: Ran against a test file with anonymous functions. Before, it emitted a declaration of a nameless function; afterward, it did not.

Reviewers: btrahan, edward

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T963

Differential Revision: https://secure.phabricator.com/D1847
2012-03-09 15:45:47 -08:00
epriestley
f57199268f Remove chooseRevision() and DifferentialRevisionRef
Summary: `arc which` and related workflows have supplanted these now-unused mechanisms.

Test Plan: Grepped for chooseRevision() and DifferentialRevisionRef.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1841
2012-03-09 08:57:24 -08:00
epriestley
92febf184e Use PhutilArgumentParser for some argument parsing in Arcanist
Summary:
Instead of doing custom parsing for --trace and --no-ansi, use builtin parsing.

This also gives us access to xprofile.

I eventually want to fully switch over, but that'll take some work.

Test Plan: Ran `arc list --trace`, `arc list --no-ansi`, etc.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1827
2012-03-08 12:20:26 -08:00
epriestley
2f9a422bc6 Improve arc compatibility on Windows
Summary:
  - When altering the include_path(), use PATH_SEPARATOR (";" on Windows, ":" elsewhere) instead of hard-coded ":".
  - Detect missing php_curl.dll extension.
  - Use APPDATA instead of HOME for storing .arcrc (the internet implies this is correct?)
  - Don't try to do chmod() stuff on Windows; it's not critical and I don't want to figure out how it works.

Test Plan: Was able to run part of some arc commands on Windows.

Reviewers: btrahan, Makinde, Koolvin

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T124

Differential Revision: https://secure.phabricator.com/D1756
2012-03-05 10:02:37 -08:00
Nick Harper
09c814ed48 Allow loading multiple phutil libraries from command line
Summary: see title

Test Plan: loaded multiple libraries

Reviewers: blair, epriestley, jungejason

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1668
2012-02-22 12:46:13 -08:00
epriestley
b058efbb51 Add an "arc alias" command
Summary:
Allow users to easily define aliased arc commands. This is easier than making
them muck around with shell stuff, and lets me do stuff like "arc alias adiff
diff -- --auto" so I can test --auto more easily.

There are some limitations here (for example, you can't put --trace in an alias
because it gets parsed too early) but I think it's a reasonable starting point.

Test Plan: Set, listed, removed and used aliases.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T896

Differential Revision: https://secure.phabricator.com/D1653
2012-02-21 13:16:52 -08:00
epriestley
93db641a3e Allow "arc liberate" / PhutilModuleLinter to ignore declared external symbols
Summary:
See T762. Currently, some externals functions (recaptcha, xhprof) raise errors
and prevent clean runs of "arc liberate" without --force-update or a forced
cache.

Allow such symbols to be declared:

  /**
   * @phutil-external-symbol function some_function
   */

This prevents them from being treated as dependencies.

Test Plan: Ran "arc liberate src/ --all" on Phabricator, fixed all the warnings
by adding @phutil-external-symbol declarations.

Reviewers: btrahan, jungejason

Reviewed By: jungejason

CC: aran, jungejason

Maniphest Tasks: T762

Differential Revision: https://secure.phabricator.com/D1381
2012-01-12 15:19:43 -08:00
epriestley
f3eccfbe81 Unify arguments for 'arc lint', 'arc unit'
Summary: See T645. These commands take inconsistent and overly-magical arguments
right now. Instead, make them behave consistently and allow them both to operate
on "arc <workflow> path path2 path3 ...", which is a generally useful workflow.

Test Plan: Ran "arc lint <path>", "arc unit <path>", "arc lint --rev
HEAD^^^^^^", "arc unit --rev HEAD^^^^^^^^^^^^", etc. Ran "arc diff --trace" and
verified --rev argument to child workflows.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran, epriestley, btrahan

Maniphest Tasks: T645

Differential Revision: https://secure.phabricator.com/D1348
2012-01-10 10:42:22 -08:00
jungejason
6910fd77a4 Use getcwd() which is more reliable than $_SERVER['PWD']
Summary:
in arcanist we are using $_SERVER['PWD'], but in some cases it
is not returning the correct result. For example, when I'm using
PhpStorm (an php IDE) to launch the script, $_SERVER['PWD'] returns the
path of the binary of the IDE:
/home/jungejason/tools/PhpStorm-107.658/bin, not the path where arcanist
is at. getcwd() returns the correct value.

One difference between getcwd() and $_SERVER['PWD'] is that getcwd()
resolves symlink where $_SERVER['PWD'] does not. From what I can see,
using realpath should work.

Test Plan:
* ran arcanist as normal and it worked;
* run arcanist in PhpStorm and it worked.
* created a symlink pointing to the repository inside which
I ran the arc command, and it worked.
* created a symlink pointing to arcanist project, run `.
* resources/shell/bash-completion`  and it worked

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1285
2011-12-24 15:05:13 -08:00
epriestley
ecc8fb13a8 Add some version/env sanity checks to 'arc'
Summary:
A user filed an issue on GitHub about not having 'json_decode()':

  https://github.com/facebook/arcanist/issues/10

Detect this issue and raise a detailed error message.

Test Plan:
  - Set minimum version to 6.0.0, arc told me to upgrade.
  - Changed function/flag configuration and hit the flag and no-flag error
pathways.

Reviewers: btrahan, jungejason, rm

Reviewed By: rm

CC: aran, rm, epriestley

Differential Revision: https://secure.phabricator.com/D1267
2011-12-24 09:00:37 -08:00
Marek Sapota
53c64f64b0 Add events framework to Arcanist
Test Plan:
Added a test event listener, added an event dispatch in diff workflow, run the
workflow, the listener was called.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, jungejason, epriestley

Differential Revision: 1102
2011-11-16 16:38:22 -08:00
epriestley
fcf37e38e3 @include_once libphutil, not @require_once
(Committing on behalf of @cpiro)

Summary: there's a check beneath to see if it worked, but @require_once will
fail silently if libphutil isn't available

Test Plan: tried it with libphutil findable and not findable, got expected
behavior

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: 1018
2011-10-20 14:35:34 -07:00
Felipe Oliveira Carvalho
0eab28fe1b Fix phutil_analyzer bug on interface dependency creation
Summary:
Use $interface_name instead of $class_name when dealing with
interfaces. Problem happens when you extend an interface:

    interface SubIface extends SuperIface { ...

    Notice: Undefined variable: class_name in ...
	Fatal error: Call to a member function getConcreteString() on a
	non-object in ...

Test Plan: phutil_mapper.php works!
2011-08-10 12:01:30 -03:00
epriestley
39e4656278 Fix an obscure dependency issue in Arcanist + libphutil
Summary:
The module analyzer reads "phutil_require_module" in the source of a module as a
dependency, and tries to regenerate __init__.php if symbols from that module
aren't actually used. This creates patches which don't actually resolve the
problem, since changing __init__.php won't change the dependency.

Instead, trust that anyone using phutil_require_module in the source of a module
knows what they're doing and don't mark it as a dependency.

We currently have an issue with this in phabricator's Setup process since I load
some other libraries' modules just to test if they can be loaded

@lesha, this might be the issue you reported a while ago.

Test Plan: Ran "arc lint" on a module which pulls in another module explicitly
in the source, didn't get a no-op lint error.
Reviewed By: jungejason
Reviewers: jungejason, tuomaspelkonen, aran, lesha
CC: aran, epriestley, jungejason
Differential Revision: 770
2011-08-03 12:17:49 -07:00
epriestley
2d50e08ee6 Flush output buffers before running 'arc'
Summary: See D589. Some environments configure output buffering with a prepend script. This is rather silly, but we can at least recover from it.

Test Plan: Started multiple output buffers with ob_start() and then used phutil_console_confirm() to create a prompt. Verified that 'arc' was broken under output buffering prior to the patch, but now works correctly.

Reviewed By: dreuss
2011-07-16 08:09:47 -07:00
epriestley
41b23519e6 Move Conduit management into Workflow
Summary:
The primary goal of this is to allow pre/post workflow hooks to upgrade a
workflow which doesn't require conduit into one which does, or one which doesn't
require authentication into one which does. They do this by calling
$workflow->establishConduit() or $workflow->authenticateConduit() respectively.

It also removes a bunch of dead code and a bunch of now-unnecessary public
interfaces.

Test Plan:
Broke my certificate and ran "arc list", "arc unit", "arc help", "arc
call-conduit".
Restored my certificate and re-ran the commands.

Reviewed By: mgummelt
Reviewers: mgummelt, jungejason, tuomaspelkonen, aran
CC: aran, epriestley, mgummelt
Differential Revision: 664
2011-07-15 12:38:45 -07:00
mgummelt
7490da8139 Run post hook regardless of error code
Summary:
In order to support more flexible post hooks.  Also send the
error code to the hook for use by client code.

Test Plan: None
Reviewed By: epriestley
Reviewers: epriestley
CC: dpepper, aran, epriestley
Differential Revision: 656
2011-07-12 14:40:32 -07:00
epriestley
2aa853f85c From Arcanist, send 'host' to server for validation on setup workflows
Summary: This allows us to detect and complain about mismatched client and
server host identities. It causes some subtle and not-so-subtle problems if the
client and server don't agree on the install's primary URI.
Test Plan: Ran "arc install-certificate" and "arc list" against my local host
with intentionally bogus configs and was warned. Ran with normal configs and
everything worked.
Reviewed By: tuomaspelkonen
Reviewers: jungejason, llorca, tuomaspelkonen, aran
CC: aran, tuomaspelkonen
Differential Revision: 591
2011-07-05 10:10:28 -07:00
epriestley
5ebfa50db3 Improve library resolution chain for 'arc'
Summary:
We currently look:

  - In the working copy
  - Alongside libphutil/
  - In PHP include_path

Before checking next to libphutil/, check next to the working copy. The problem
right now is that javelin/ references diviner/, but it won't find it next to
javelin/, only next to the libphutil/ instance which is loaded off
/home/engshare/devtools.

Test Plan: Moved javelin to tmp/javelin and diviner to tmp/divinerx. Ran 'arc
list' and got a library load error. Moved 'divinerx' to 'diviner' and ran 'arc
list'. It loaded correctly. Ran '--trace' to verify load location.
Reviewed By: cpojer
Reviewers: cpojer, jungejason
CC: aran, cpojer
Differential Revision: 568
2011-06-30 19:26:33 -07:00
epriestley
a30a9a8353 Give users meaningful error messages for missing 'arc' credentials
Summary:
We give you a worthless message that doesn't point at "arc install-certificate"
if you don't have an .arcrc right now. Instead, tell the user to run "arc
install-certificate".

Test Plan:
Nuked my ~/.arcrc and tried to run "arc list".

Reviewed By: llorca
Reviewers: codeblock, llorca, jungejason, aran, tuomaspelkonen
CC: aran, llorca
Differential Revision: 538
2011-06-27 13:00:14 -07:00
epriestley
448cd31fff Automatically use the correct path for Conduit URIs in arc
Summary:
Right now, if you specify "/api" instead of "/api/" the entire world breaks in a
horrible way. Generally, this whole thing is silly. Just use the right path.

Test Plan:
Edited .arcconfig to use the "wrong" path, so this diff demonstrates the change
works.

Reviewed By: llorca
Reviewers: jungejason, llorca, aran, tuomaspelkonen
CC: aran, llorca, epriestley
Differential Revision: 506
2011-06-23 17:26:08 -07:00
epriestley
55353001d4 Stop defualting to USER from env in arcanist
Summary: This once made sense but hasn't been a reasonable default for a long time, get rid of it.

Test Plan: Ran "arc list".

Reviewers: llorca, toulouse

CC:

Differential Revision: 496
2011-06-22 00:16:07 -07:00
epriestley
63e7ddc12d Point certificate documentation at "arc install-certificate". 2011-06-20 06:01:46 -07:00
epriestley
d73179ea99 "arc install-certificate", client side changes
Summary:
Provide an "install-certificate" workflow to simplify ~/.arcrc edits. See also
D460.

Test Plan:
Installed certificates via "arc install-certificate".

Reviewed By: aran
Reviewers: aran, jungejason, tuomaspelkonen
CC: aran, epriestley
Differential Revision: 465
2011-06-20 05:48:40 -07:00
epriestley
857f08ae47 Make sure 'id' and 'idx' are not marked as builtin functions?
Summary:
This is sort of a guess. In D357, arc has gone crazy and removed a bunch of
'utils' dependencies for gc3. I think this is because his HPHP/i has them marked
as builtins.

However, I don't have an HPHP/i build (and probably don't have the fortitude to
build it outside of a Facebook environment, I spent about two hours on it at one
point and got maybe 25% of the way through the build process before running into
things I didn't know how to resolve) so I'm not sure this is the issue. No one
else's diffs have exhibited this problem eitehr, so I'm not confident this is
actually the problem or solution.

gc3, can you apply this locally to a copy of arcanist and then run 'arc lint'
(or 'arc lint --apply-patches') on your commit and see if it restores all the
libphutil/utils requirements?

Test Plan:
unable, see summary

Added 'array_keys' to this blacklist and verified the technical behavior of the
patch is correct by var_dump()'ing builtins.

Reviewed By: gc3
Reviewers: gc3, tuomaspelkonen, jungejason, aran
CC: aran, gc3, epriestley
Differential Revision: 361
2011-05-29 02:35:26 -07:00
epriestley
7e4bde114e Detect library conflicts in Arcanist and raise a very specific error message
Summary:
When you run one copy of arcanist against another copy, you previously got a
meaningless error. After D311 you get a slightly more meaningful error.

Capture the new exception and raise an extremely specific error.

NOTE: Adding arcanist to .arcconfig forces the library conflict error to
trigger; otherwise there's just an implicit conflict because 'arc' reads the
running-copy library amp instead of the working-copy library map. This only
worked before because arcanist includes itself.

Test Plan:
Ran arcanist on a different copy of arcanist, got a good error message.

Reviewed By: jungejason
Reviewers: jungejason, tuomaspelkonen, aran
CC: aran, jungejason, epriestley
Differential Revision: 312
2011-05-19 11:32:53 -07:00
epriestley
3a559ddd13 'arc liberate', convenience wrapper for various libphutil operations
Summary:
The story for creating and maintaining libphutil libraries and modules
is pretty terrible right now: you need to know a bunch of secret scripts and
dark magic. Provide 'arc liberate' which endeavors to always do the right thing
and put a library in the correct state.

Test Plan:
Ran liberate on libphutil, arcanist, phabricator; created new
libphutil libraries, added classes to them, liberated everything, introduced
errors etc and liberated that stuff, nothing was obviously broken in a terrible
way..?

Reviewed By: aran
Reviewers: jungejason, tuomaspelkonen, aran
CC: aran, epriestley
Differential Revision: 269
2011-05-17 09:53:19 -07:00
epriestley
ade681e0db Update arcanist to use PhutilServiceProfiler.
Summary:
Switch to the new PhutilServiceProfiler API.

Test Plan:
Ran "arc" with "--trace", got mostly reasonable output. I'll clean up conduit
output in a followup.

Reviewed By: aran
Reviewers: aran, jungejason, tuomaspelkonen
CC: aran
Differential Revision: 292
2011-05-16 17:09:54 -07:00
epriestley
d87fda8561 Improve workflow for missing certificates. 2011-04-10 13:09:47 -07:00
jungejason
1dd69bdbee Improve 'arc' error message when failing to load a library
Summary:
display better message about the .arcconfig. The message will
be something like this now:
  Usage Exception: Failed to load library "phabricator" at location
  "srcaaaaa/". Please check the "phutil_libraries" setting in your
  .arcconfig file. Refer to page
  http://phabricator.com/docs/arcanist/article/Setting_Up_.arcconfig.html
  for more info.

Test Plan:
modify the .arcconfig file to test it. Also make sure it
works for correct settings.

Reviewed By: epriestley
Reviewers: epriestley
CC: jungejason, epriestley
Differential Revision: 99
2011-04-04 16:44:09 -07:00
jungejason
51b371481b Improve the error message for ERR-NO-CERTIFICATE
Summary:
list the hosts for which the .arcrc file have certificate and
which conduit-uri the user is trying to access.

Test Plan:
test the case where a cert is missing.

Reviewed By: epriestley
CC: epriestley
Differential Revision: 76
2011-03-21 16:40:57 -07:00
epriestley
0eba67ce9f Get rid of explicit timezone silliness.
Summary:

Test Plan:

Reviewers:

CC:
2011-03-07 20:20:48 -08:00
epriestley
a7cbae1dc6 Make 'arc' work for users without the POSIX PHP installed.
Summary:
Some PHP installs don't have this by default. Do a conditional check
since this functionality is noncritical.

Test Plan:
will make srash test

Differential Revision: 43
Reviewed By: aran
Reviewers: rash67, aran, jungejason
CC: aran
2011-03-03 16:11:03 -08:00
epriestley
6b2c8c6bbb Fix a couple of warnings raised by HipHop.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-26 20:54:06 -08:00
epriestley
651f567f96 Improve error messages when trying to parse bad .arcconfig files.
Summary: Haiping is getting a pretty confusing error message when trying to
commit.

Test Plan: Created a mock repository, installed the hook, made commits against
directories with bad .arcconfigs.

Reviewers:

CC:
2011-02-24 16:34:27 -08:00
epriestley
5099b005cf Some documentation.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-19 11:36:08 -08:00
epriestley
b50acb5129 Provide a "--conduit-uri" override for testing, and tweak some documentation.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-18 22:17:41 -08:00
epriestley
964030050b Respect --no-ansi and disable ansi for non-TTY terminals.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 23:41:03 -08:00
epriestley
1040046f3a Support --load-phutil-library in arcanist.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 10:07:48 -08:00
epriestley
db9f629499 Stop arc from triggering bogus exceptions. 2011-02-05 23:32:04 -08:00
epriestley
c44c4cf988 Hook up conduit auth. 2011-02-05 22:44:30 -08:00
epriestley
d933f20005 Blanket exclude 'externals/' directory from linting in the PhutilLintEngine. 2011-01-26 09:58:16 -08:00
epriestley
71ff2d85de Use caching to provide a huge perf boost to phutil_mapper. 2011-01-25 18:05:15 -08:00
adonohue
59f48f7901 Disable phutil filename check. To be implemented as a more pervasive check.
Differential Revision: 201587
Reviewed By: epriestley
2011-01-14 15:21:39 -08:00
epriestley
68dee48bf4 Clarify confusing error message about missing .arcconfig vs missing conduit.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-13 15:36:15 -08:00
epriestley
3f13e36182 Update arcanist to use the PhutilSymbolLoader.
Summary: This should also fix the bug with double help for certain commands

Test Plan:

Reviewers:

CC:
2011-01-12 16:02:28 -08:00
epriestley
12f1ba1d77 Remove XHPAST from arcanist.
Summary: see corresponding commit in libphutil

Test Plan: linted and analyzed both libraries, got more sensible build behavior

Reviewers:

CC:
2011-01-09 22:13:30 -08:00
epriestley
2c235bdf38 Fix a couple of lint issues, and update to version 2 (github). 2011-01-09 15:51:04 -08:00
epriestley
2e73916fa2 Initial commit. 2011-01-09 15:22:25 -08:00