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

2031 commits

Author SHA1 Message Date
jungejason
8f59aff31a Make the rule for applying git diff less restrict
Summary:
the current command to apply a git diff is 'git apply --index',
which will fail the whole patch and does not touch the working tree when
some of the hunks do not apply. We want to allow the user to patch the
ones which apply.

Test Plan:
run 'arc apply' against a diff whcih partially applies and
verify that the hunks which apply are applied, and .rej files are
generated for the rest.

Reviewed By: simpkins
Reviewers: simpkins, epriestley
Commenters: ju
CC: aran, slawekbiel, simpkins, ju
Differential Revision: 235
2011-05-05 20:33:23 -07:00
jungejason
64ecf63680 init invest 2011-05-03 23:33:21 -07:00
tuomaspelkonen
e04ea5c7d8 Added 'edit' field to 'getcommitmessage' conduit calls.
Summary:
Server log was showing errors for undefined index 'edit'.

Test Plan:
arc lint

Reviewed By: jungejason
Reviewers: jungejason, grglr
Commenters: grglr
CC: aran, epriestley, grglr, jungejason, tuomaspelkonen
Differential Revision: 217
2011-05-03 11:26:01 -07:00
epriestley
17ac4d9ab1 Provide setup/teardown hooks for ArcanistPhutilTestCase
Summary:
I'm making a move on Lisk stubbability and need these so I can set up
Lisk isolation unconditionally in Phabricator tests. Also document and organize
this class.

Test Plan:
Changed the expected counts in the meta-tests and got failures. Ran
all unit tests.

Reviewed By: aran
Reviewers: aran, jungejason, tuomaspelkonen
CC: aran
Differential Revision: 192
2011-04-30 12:04:11 -07:00
slawekbiel
d70e5db39e Aggregate display of postponed tests
Summary:
Displaying each postponed test separately was spammy.
Now it will only display a single line with the total count

Test Plan:
~/local/arcanist/bin/arc unit --sandcastle-tests
35 tests to run.
Completed 'ParentInfoTestCase.php'
Interrupted 'MentionsUntagTestCase.php'
    PASS  ParentInfoTestCase
  POSTPONED  34 tests

Reviewed By: sgrimm
Reviewers: jungejason, sgrimm
CC: sgrimm
Revert Plan:
sure

Other Notes:

Differential Revision: 173
2011-04-28 12:05:00 -07:00
slawekbiel
8332d86ad2 add short option for fetching git revision hash
Summary:
Sometimes we need to show abbreviated hashes, passing --short is more
reliable than substring of fixed number of characters.

Test Plan:
- called with and without the parameter, got correct results
           -

Reviewed By: jungejason
Reviewers: jungejason
CC: jungejason
Revert Plan:
sure

Other Notes:

Differential Revision: 170
2011-04-27 15:26:20 -07:00
epriestley
8ffba323ea Stop this from failing on directories, etc.; u-u-u-u-ultra clown. 2011-04-11 16:13:22 -07:00
epriestley
c00da5bf4f Load more context for lint only if the files actually exist. 2011-04-11 14:54:17 -07:00
tuomaspelkonen
d67a081243 Arc cover handles a file that is added and modified correctly.
Summary:
Modifying a new file and running 'arc cover' before committing the
modifications confused arc. The problem was that 'unstaged' status
erased 'added' status and this caused problems.

Test Plan:
Tested that arc cover ignores added files when they are modified, but
old files that are modified are still handled correctly by arc cover.

Reviewed By: epriestley
Reviewers: epriestley
CC: jungejason, epriestley
Differential Revision: 122
2011-04-11 14:08:54 -07:00
epriestley
2cf1393219 Load files which we don't directly examine, since there are some common cases
where we either generate an entire file or an external script examines it.
2011-04-10 16:05:44 -07:00
epriestley
d87fda8561 Improve workflow for missing certificates. 2011-04-10 13:09:47 -07:00
adonohue
0472a5ff95 Improve lint rendering
Summary:
Declare victory like it's the United States.

Test Plan:
www copyright, apache copyright, control keyword whitespace and trailing
whitespace lint warnings

Reviewed By: epriestley
Reviewers: epriestley
CC: epriestley
Differential Revision: 117
2011-04-08 19:18:34 -07:00
epriestley
b1acee6ee5 Fix repository UUID parsing. 2011-04-05 22:27:32 -07:00
epriestley
ceb8a42003 Ship up repository UUIDs with diffs. 2011-04-05 21:09:59 -07:00
epriestley
1139eb1a73 Correctly detect uncommitted files in Git
Summary:
I simplified this code at some point and broke it horribly
in the process. Mask in the right flag here and combine the maps
correctly. This solves the great mystery of increased developer
clowniness.

Test Plan:
Ran 'arc diff' in a working copy with staged but
uncommitted files, got an error message (previously, I didn't).

Reviewed By: aran
Reviewers: mroch, aran
CC: aran
Differential Revision: 104
2011-04-05 21:08:55 -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
Aran Donohue
76c45a74f3 JSON output for Lint
Summary:
Refactor ArcanistLintRenderer into three independent classes, and let
the Workflow select between them based on its 'output' parameter.

Test Plan:
Introduce a Lint warning and lint with no --output, with --output summary and
with --output JSON.

Reviewed By: epriestley
Reviewers: epriestley
CC: aran, epriestley
Differential Revision: 96
2011-04-04 10:07:06 -07:00
epriestley
4bce8732e5 Expand ArcanistDiffParser to accept awkward Diffusion + SVN workflows. 2011-03-30 19:33:50 -07:00
epriestley
11e25f5840 Add an empty file lint test. 2011-03-22 20:51:45 -07:00
epriestley
b8e7e9017a Special case ArcanistTextLinter for completely empty files. 2011-03-22 11:09:28 -07:00
slawekbiel
aa44db2f96 [Adding postpone status for unittests]
Summary:
That's for the tests that will be run asynchronously.

Test Plan:
run arc unit with some tests that returned postponed status - they showed up.
Background was yellow.

Reviewed By: epriestley
CC: epriestley
Revert Plan:
sure

Other Notes:

Differential Revision: 77
2011-03-21 19:11:58 -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
bdde006484 Detect SVN 1.6 "tree-conflicts". 2011-03-20 15:06:55 -07:00
epriestley
efcd70c2d7 Use phutil_console_confirm() correctly, not vestigal $this->confirm().
Summary:

Test Plan:
$ arc patch --diff 553961

    Patch deletes file 'html/miniprofile.php', but the file does not exist in
    the working copy. Continue anyway? [y/N] y

    Patch deletes file 'html/index.php', but the file does not exist in the
    working copy. Continue anyway? [y/N] y

 OKAY  Successfully applied patch to the working copy.

Reviewers:

CC:
2011-03-19 12:16:47 -07:00
epriestley
b7be6dbf32 Fix symbol reference in arcconfig.diviner (thanks, jason!) 2011-03-17 19:19:31 -07:00
epriestley
9b6e8aa6e1 Resolve paths when running "--lintall"
Summary: this was all kinds of fail when running from a subdirectory or on
invalid paths. Detect nonexistent paths; resolve valid paths.

Test Plan: ran "arc lint --lintall" on a file from a subdirectory, and on a
file which did not exist. Received patches and an error, respectively

Reviewers: arudolph

CC:

Differential Revision: 72
2011-03-15 18:59:48 -07:00
epriestley
eb58ed1b8b asukhachev's patch for 'arc amend' not being overeager. 2011-03-14 17:39:12 -07:00
epriestley
628de7d7a1 Make all the working-copy-paths errors extremely explicit. 2011-03-12 18:23:52 -08:00
epriestley
982e482290 Make some UI things less confusing and reduce the amount of horrific torture
that arc apparently inflicts upon users.

Summary:

Test Plan: .

Reviewers:

CC:

Differential Revision: 223104
2011-03-12 17:59:15 -08:00
epriestley
fd19dfaebc Detect use of "+" on a string literal in PHP.
Summary:
This is realistically always wrong and the author means "."

Test Plan:
lint / unit

Reviewed By: crackerjack
Reviewers: crackerjack, aran
CC: crackerjack
Differential Revision: 68
2011-03-10 15:15:45 -08:00
epriestley
692d2a8b6f Arcanist: Apply symlink patches correctly
Summary:
When an arcbundle includes a symlink, we fail to apply it correctly
when applying to a subversion working copy.

Test Plan:
created a diff which added a symlink, removed it locally, bundled
and applied the patch, got a good symlink out

Reviewed By: aran
Reviewers: aran
CC: epriestley, aran
Differential Revision: 63
2011-03-09 00:47:01 -08:00
epriestley
12aa487790 Merge branch 'patch' 2011-03-07 22:09:11 -08:00
epriestley
02627b1762 Fix 'arc patch' when adding files in new directories
Summary:
If you apply an arcbundle to a subversion working copy which adds
files in new subdirectories, we fail to create and add the parent directories
so the whole operation fails. Make sure we create and add any missing parent
directories before apply patches.

Test Plan:
Applied Facebook diff #542056 to www@rE349795 cleanly, while it
failed previously.

Reviewed By: aran
Reviewers: aran
CC: aran
Differential Revision: 62
2011-03-07 22:09:02 -08:00
epriestley
66099afd91 Merge branch 'master' of github.com:facebook/arcanist 2011-03-07 22:04:29 -08:00
epriestley
f794418ba9 Arcanist: parse SVN "replaced" status
Summary:
SVN has a special 'replaced' status which was not being parsed
correctly. Parse it correctly.

Test Plan:
Replaced a file, ran arc diff, got a sensible diff.

Reviewed By: aran
Reviewers: aran
CC: aran
Differential Revision: 60
2011-03-07 22:04:22 -08:00
epriestley
b891519d3d Merge branch 'master' of github.com:facebook/arcanist 2011-03-07 20:21:09 -08:00
epriestley
0eba67ce9f Get rid of explicit timezone silliness.
Summary:

Test Plan:

Reviewers:

CC:
2011-03-07 20:20:48 -08:00
epriestley
71016a09f8 Explicitly use "--format=medium" when running 'git log'
Summary:
Git (the world's hardest revision control system) allows you to change
output formats by accident and/or without your direct knowledge. Protect users
from themselves.

Test Plan:
Changed "pretty" in [format] to "format:quack" so every log just
outputs the word "quack". Ran "arc diff" successfully.

Reviewed By: aran
Reviewers: aran
CC: epriestley, aran
Differential Revision: 56
2011-03-07 16:13:06 -08:00
epriestley
4b30319747 Make XHPAST parse-depth warning an actual warning.
Summary:
XHPAST encounters a parse-depth problem on some files because PHP
5.2 has an un-overridable parse depth limit for JSON. The text of this error
says it is a "warning" but we currently raise an error. Make it a warning
instead.

The JSON depth is 20 until PHP 5.2.3, where it becomes 128. After PHP 5.3
it defaults to 512 and is user-configurable, which will allow us to resolve
this issue in nearly all cases.

Since I made if/else express as a list in the AST, this only actually arises
in long binary chains, most commonly string concatenation, like:

  $out = 'a'.'a'.'a'.'a'...

...where each string is a variable or HTML tag and the program is constructing
a complicated document.

At some point I'll add some PHP 5.3 massaging to the XHPAST decoder itself to
raise this limit to something more huge.

Test Plan:
Ran "arc lint --lintall" on a file with a very deep binary
expression tree ("1 + 1 + 1 ...") and received a warning instead of an error.

Reviewed By: aran
Reviewers: pad, aran
CC: epriestley, aran
Differential Revision: 54
2011-03-07 11:44:11 -08:00
epriestley
61e16d9cc3 Fix issue with svn-hook-pre-commit when resolving .arcconfig for nested
directories

Summary:
If you had changes to a directory covered by a .arcconfig residing
inside another directory also covered by an .arcconfig, the hook would
incorrectly attribute the first file it attempted to resolve to the topmost
.arcconfig because it failed to break out of the loop after resolving it.

All other files would be correctly attributed, because they'd hit the cache.

Test Plan:
Created an svn repository and checked it out locally. Created a
structure like this:

  .arcconfig
  shallow
  a/
   b/
    c/
     .arcconfig
     d/
      deep
      deep2
      deep3

Made modifications to "deep", "deep2", and "deep3". Received an error message
about multiple .arcconfig changes, attributing one file to the topmost
arcconfig and the other two to the deeper one.

Applied patch.

Commit now goes through. Made a commit affecting 'shallow' and 'deep' and
'deep2', commit was correctly blocked and files were attributed to the
corresponding .arcconfigs.

Reviewed By: mroch
Reviewers: mroch
CC: mroch
Differential Revision: 50
2011-03-05 00:49:52 -08:00
epriestley
0a0aa6d718 Restore the --edit workflow somewhat properly. (2)
Summary: summary999

Test Plan: test2

Reviewers:

CC:

Differential Revision: 219938
2011-03-04 16:37:41 -08:00
epriestley
d9e8c2d0aa Merge branch 'master' of github.com:facebook/arcanist 2011-03-03 16:11:10 -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
f1b2cfa3f6 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

Reviewers: rash67, aran, jungejason

CC:

Differential Revision: 43
2011-03-02 19:32:57 -08:00
epriestley
d01dc4df37 Merge branch 'master' of github.com:facebook/arcanist 2011-03-02 19:31:36 -08:00
epriestley
bef6b0a244 Updated .divinerconfig.
Summary:

Test Plan:

Reviewers:

CC:
2011-03-02 15:25:45 -08:00
epriestley
482db3a83c Possible workaround for null 'changes'.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-28 11:33:22 -08:00
epriestley
22ceb9a60a Merge branch 'master' of github.com:facebook/arcanist 2011-02-26 20:54:21 -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
adonohue
cc8c7d4997 Respect @nolint
Summary:
Respect @nolint annotations

Test Plan:
New "test case"

Differential Revision: 41
Reviewed By: epriestley
Reviewers: epriestley
CC: epriestley
2011-02-26 20:54:06 -08:00