1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-21 01:18:50 +02:00
Commit graph

583 commits

Author SHA1 Message Date
epriestley
65c0d07935 Add PHP lint check for expressions which can be statically evaluated
Summary:
This is pretty coarse and could be refined, but I often do this when testing:

  lang=diff
  - if (some_complicated_condition())
  + if (true || some_complicated_condition())

aran has caught me not only doing it but sending out diffs with it like 30
times. Catch it in lint instead.

Test Plan:
Unit test, added a "true || $junk" to the code and linted it.

Reviewed By: aran
Reviewers: aran, jungejason, tuomaspelkonen, pad
CC: aran
Differential Revision: 447
2011-06-13 10:17:43 -07:00
tuomaspelkonen
42c6f00315 Let TestEngine know if the command that triggered tests is 'arc diff' or 'arc
unit'

Summary:
We want to handle 'arc unit' and 'arc diff' differently in our test
framework.

Test Plan:
Tested that with 'arc unit' the value was set to 'unit' and with 'arc diff'
the value was set to 'diff'.

Reviewed By: epriestley
Reviewers: slawekbiel, epriestley
CC: jungejason, grglr, aran, tuomaspelkonen, epriestley
Differential Revision: 430
2011-06-10 13:00:03 -07:00
tuomaspelkonen
dcc76bb58b Send postponed test results to differential.
Summary:
Differential showed 'okay' as the arc unit status even when there were
postponed tests.

Test Plan:
Tested that test results were pushed to differential when there were
postponed tests.

Reviewed By: jungejason
Reviewers: epriestley, jungejason
CC: slawekbiel, aran, jungejason
Differential Revision: 417
2011-06-09 10:29:54 -07:00
Andrew Gallagher
ffbc7aae62 arc amend: fix failure when amending merge commit
Summary:
The amend process used "git log HEAD^..HEAD" to get log for the
commit being amended.  When run on a merge commit this can return
any number of commits from the non-first parents.  Since only a
single commit was expected, arc fails here.

This diff changes the amend process to use the '--first-parent' flag
to be consistent with using '^', which references the first parent.
This should guarantee a single commit log every time.

Test Plan:
arc amend on a merge commit

Reviewed By: epriestley
Reviewers: epriestley, jungejason
CC: aran, epriestley, andrewjcg
Differential Revision: 415
2011-06-08 16:24:16 -07:00
tuomaspelkonen
9b7ee674eb Child classes can prevent echoing test results.
Summary:
We changed our Facebook implementation to echo test results while the
tests are running. We do not want to echo the test results twice.

Test Plan:
Tested that implementing the function in PhutilUnitTestEngine and
returning true showed the results and returning false didn't show the
results.

Reviewed By: epriestley
Reviewers: jungejason, epriestley, grglr, slawekbiel
Commenters: slawekbiel, aran
CC: sgrimm, slawekbiel, aran, tuomaspelkonen, epriestley
Differential Revision: 400
2011-06-07 11:01:51 -07:00
epriestley
b763cecdb2 Use a consistent indent depth to display summary test results
Summary:
I typed the wrong number of spaces into some of these.

Test Plan:
Visual inspection, ran 'arc unit'

Reviewed By: tuomaspelkonen
Reviewers: tuomaspelkonen
CC: aran, tuomaspelkonen
Differential Revision: 402
2011-06-07 10:53:42 -07:00
tuomaspelkonen
fe9daa7ae3 'arc diff' passes the diff ID to Test Engine class.
Summary:
Test Engine classes might need the differential Diff ID to be
able to attach postponed test results to diffs.

Test Plan:
Added setDifferentialDiff function to PhutilUnitTestEngine class
and made sure it was called with the correct diff ID when running
'arc diff --preview'

Reviewed By: jungejason
Reviewers: jungejason, grglr
Commenters: sgrimm
CC: epriestley, sgrimm, slawekbiel, aran, tuomaspelkonen, jungejason
Differential Revision: 395
2011-06-02 12:19:05 -07:00
epriestley
03056c7206 Reorganize documentation. 2011-05-31 12:14:20 -07:00
epriestley
d3816f1c9e Allow 'arc diff' to detect non-UTF8 files and mark them binary
Summary:
There are a bunch of different ways we could approach this, but practically I
think this is probably the best one even though it's kind of yucky.

A big part of my motivation here is that if we just reject UTF-8 outright, users
are going to end up in a situation they don't understand how to resolve.

UPDATE: after discussion, going with a more conservative approach until such
time as we have a more compelling case for the less strict functionality.

Test Plan:
Created a diff with a text file that contained invalid UTF-8 subsequences.

Reviewed By: tuomaspelkonen
Reviewers: tuomaspelkonen, jungejason, aran
Commenters: aran
CC: aran, epriestley, tuomaspelkonen
Differential Revision: 325
2011-05-31 12:13:24 -07:00
epriestley
5b6fbf70e0 Disable 'textconv' when diffing
Summary:
Adds "--no-textconv" to all 'git diff' commands so we don't invoke textconv. See
T178 for discussion.

Test Plan:
Added something like this to .gitattributes:

  *.txt diff=uppercase

And then this to .git/config:

  [diff "uppercase"]
    textconv = /path/to/uppercase

...where "uppercase" is a script which takes a file and emits an uppercase
version of it.

Then I added a "wisdom.txt" text file:

  The cow goes "moo".
  The duck goes "quack".

Without this patch, the file appears in uppercase in Differential, i.e. textconv
runs. With this patch, it appears as the original text.

Reviewed By: tuomaspelkonen
Reviewers: tuomaspelkonen, jungejason, aran
CC: elgenie, aran, tuomaspelkonen
Differential Revision: 372
2011-05-31 12:13:07 -07:00
Lovro Puzar
4b041b8f84 Lint rule for duplicate keys in array literals
Summary:
Raise an error if an array is initialized with the same key present more than
once.

Test Plan:
bin/arc unit
Also added some duplicates to ArcanistXHPASTLinter.php and verified the output
of bin/arc lint.

Reviewed By: epriestley
Reviewers: jungejason, epriestley, aran
CC: aran, epriestley
Revert Plan:
Tags:

Differential Revision: 346
2011-05-25 16:26:33 -07:00
Andrew Gallagher
d762311a9d arc lint: add support for PyLint
Summary:
Provides a lint class as a wrapper around the external project PyLint.
This exposes some arc config variables to control the behavior:

lint.pylint.prefix - non-standard installation location of pylint
lint.pylint.logilab_astng.prefix - non-standard installation location
  of logilab-astng, a dependency of pylint
lint.pylint.logilab_common.prefix - non-standard installation location
  of logilab-common, a dependency of pylint
lint.pylint.codes.{error,warning,advice} - regexes matching against
  PyLint message codes which should trigger arc errors/warnings/advice
lint.pylint.options - options to pass PyLint

Test Plan:
used to lint python code

Reviewed By: epriestley
Reviewers: epriestley, jungejason
CC: aran, epriestley
Differential Revision: 343
2011-05-25 14:14:51 -07:00
tuomaspelkonen
1ef7aacff1 Image files should also be treated as binary files when patching.
Summary:
Arc patch for image files failed, because they were treated like text
files.

Test Plan:
Tested that 'arc patch' worked for a png file.

Reviewed By: jungejason
Reviewers: epriestley, jungejason
CC: aran, jungejason
Differential Revision: 341
2011-05-24 18:12:53 -07:00
epriestley
13ea6ea5b6 Add basic binary file support to 'arc patch'
Summary:
I'm probably missing some edge cases but it took me almost 3 hours to get this
far and I think it only makes things work that didn't work before. Some stuff
like SVN binary patches still won't work, although they should be far easier to
implement.

Most of the magic here just comes from reading the git source code. It appears
to work correctly; I sprinkled printf() around git liberally and recompiled it
during development. Took me about 45 minutes to figure out that "Index" vs
"index" causes git to silently fail in a confusing way. :/

Git has a diff mode for binary changes but I don't think we lose much by always
using the full binaries. We can enhance it later if we want.

Test Plan:
Exported and patched binary changes (a picture of a duck) into a working copy.

Reviewed By: aran
Reviewers: tuomaspelkonen, jungejason, aran
CC: simpkins, aran, epriestley
Differential Revision: 327
2011-05-22 06:58:16 -07:00
Andrew Gallagher
f8c3a5d555 arc lint: add support for PyFlakes
Summary:
Provide a simple linter wrapper around pyflakes.  This relies on finding
pyflakes via:
- lint.pyflakes.path - arcconfig setting of absolute path to pyflakes
- lint.pyflakes.prefix - arcconfig setting of the prefix that pyflakes
  was installed under
- users path

Test Plan:
linted python code with PyFlakes warnings

Reviewed By: epriestley
Reviewers: jungejason, epriestley
Commenters: jungejason
CC: aran, epriestley, andrewjcg, jungejason
Differential Revision: 310
2011-05-19 16:48:05 -07:00
Andrew Gallagher
ce06ec00cc arc lint: fix typo in PEP8 linter
Test Plan:
linted!

Reviewed By: jungejason
Reviewers: epriestley, jungejason
CC: aran, jungejason
Differential Revision: 314
2011-05-19 13:41:18 -07:00
epriestley
292c995d57 Use phutil_passthru() in "arc commit" instead of passthru().
Summary:
passthru() doesn't show up on --trace, and one time a while ago someone had an
issue which was harder than necessary to debug because the command wasn't
avialable in the log. Use the logged version.

Also fix a locale issue I ran into on my local machine, with "en_US.utf8" not
being a valid locale.

Test Plan:
Created an SVN repo and used "arc commit" to make commits against it.

Reviewed By: jungejason
Reviewers: jungejason, tuomaspelkonen, aran
CC: aran, epriestley, jungejason
Differential Revision: 306
2011-05-19 10:19:01 -07:00
Andrew Gallagher
399c505f1a arc lint: fix/enable PEP8 linter
Summary:
This diff:
- Adds the PEP8 linter to the externals directory
- Changes the path for finding pep8.py
- Removes use of execx since pep8.py return an errors code
  when it finds PEP8 violations

Test Plan:
tested linting python code

Reviewed By: epriestley
Reviewers: epriestley, jungejason
CC: aran, epriestley
Differential Revision: 309
2011-05-18 16:47:23 -07:00
Adam Simpkins
10bdc77f96 arc diff: --only doesn't conflict with --nounit or --nolint
Summary:
The --only flag implies --nounit and --nolint, so there's really no
conflict if these flags are specified together.

(My wrapper around arc diff automatically specifies --nounit in some
cases.  It is useful to be able to manually add --only in some cases,
and not have it fail because it conflicts with the automatically
specified --nounit flag.)

Test Plan:
Ran "arc diff --only --nounit".

Reviewed By: epriestley
Reviewers: epriestley, jungejason
CC: aran, epriestley, simpkins
Differential Revision: 298
2011-05-17 13:08:21 -07:00
Adam Simpkins
952fa69f72 lint: fail early if no lint engine is defined
Summary:
Update the lint workflow to exit immediately it there is no lint engine
configured.  Previously it scanned the repository to find the paths to
check before failing in this case.  Scanning the repository can be
relatively slow on large repositories.

Test Plan:
Ran "arc lint" in a large repository with no lint engine configured.
Verified that it failed quickly, without scanning the repository first.

Reviewed By: jungejason
Reviewers: jungejason, epriestley
CC: aran, jungejason
Differential Revision: 297
2011-05-17 12:59:49 -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
3edd525f83 Stop undeclared variable warning for $obj->{$prop} syntax
Summary:
This isn't necessarily a root-cause solution but this syntax is really really
bad. If we want to fix the root cause, I'd recommend making its use a lint
error?

Test Plan:
Unit tests failed before patch, passed afterward.

Reviewed By: aran
Reviewers: jungejason, tuomaspelkonen, aran
CC: aran
Differential Revision: 270
2011-05-11 22:06:03 -07:00
epriestley
23afdb99f0 Allow ArcanistLinter to load files not directly affected by lint
Summary:
This is necessary for the Javelin linters. The libphutil and flib linters do it
implicitly, so there's no real tradeoff here.

Test Plan:
Ran javelin linters.

Reviewed By: tuomaspelkonen
Reviewers: tomo, aran, jungejason, tuomaspelkonen
CC: aran, tuomaspelkonen, epriestley
Differential Revision: 238
2011-05-08 01:43:49 -07:00
epriestley
caed8a2830 Restore "arc patch D12345" syntax
Summary:
I only dropped this because it's slightly inconvient to accommodate, but
empirically it's pretty confusing to users (who often use --diff 12345 when they
mean --revision 12345).

Test Plan:
Ran "arc patch D45", "arc patch --revision 45", "arc help patch"

Reviewed By: tuomaspelkonen
Reviewers: tuomaspelkonen, jungejason, aran
CC: aran, tuomaspelkonen
Differential Revision: 241
2011-05-06 12:40:16 -07:00
epriestley
1fdead8c20 Provide 'arc call-conduit' to facilitate script integration with Phabricator
Summary:
Provide a formal mechanism for making conduit calls from other scripts.

Test Plan:
Called 'conduit.ping'.

Reviewed By: jungejason
Reviewers: aran, jungejason, tuomaspelkonen
CC: aran, jungejason
Differential Revision: 239
2011-05-06 11:56:21 -07:00
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
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
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
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
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
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
482db3a83c Possible workaround for null 'changes'.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-28 11:33:22 -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
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
c13147cf53 Stop arc from destroying files under HPHPi.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-24 14:08:49 -08:00
epriestley
309609169d Make arcanist more flexible about SVN base revisions
Summary: When running "arc diff" in a mixed-base-revision working copy, we
prevent the operation. Relax this restriction so that having a different root
revision is okay, so long as all affected files share the same revision. This
facilitates multiple similar edits without updates.

Test Plan: Reverted a file to an older revision in an SVN working copy, ran
"arc diff", was rejected. Applied patch, ran "arc diff", diff went through and
was recorded with the right SVN base revision in the database.

Reviewers:

CC:
2011-02-23 12:06:22 -08:00
epriestley
ed53f98e9e Merge branch 'master' of github.com:facebook/arcanist 2011-02-21 17:00:05 -08:00
epriestley
fe256c59f4 Correctly parse conflicted files out of SVN XML.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-21 16:59:37 -08:00
epriestley
a4d30cc42b Partially restore --edit to stop it from stomping all over everything.
Summary: We sync from local right now, which is fairly terrible. But
fixing this correctly is also not trivial and I don't have the right
primitives yet.

Test Plan:

Reviewers:

CC:
2011-02-19 22:14:53 -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
0eecd3108f Resolve further subtlety with untracked files.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-18 17:08:10 -08:00
epriestley
0ac9b6c27b Merge branch 'master' of github.com:facebook/arcanist 2011-02-18 16:52:52 -08:00
epriestley
c921e20272 Don't send untracked files to lint or unit workflows when running 'arc diff'.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-18 16:52:27 -08:00
epriestley
58a2720785 Don't reject commits which fail to trigger any linters.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-17 12:45:15 -08:00
epriestley
a3466fcb6d Prep this for actual production installs.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 23:14:55 -08:00
epriestley
8dc45eac97 Merge branch 'master' of github.com:facebook/arcanist 2011-02-16 21:04:16 -08:00
epriestley
40349b6b26 Basic documentation for ".arcconfig".
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 21:03:32 -08:00
epriestley
e0de194e11 Move this block into a more sensible branch.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 18:49:45 -08:00
epriestley
4b1c4238bc Fix two common points of confusion:
- show "push upstream" instructions after arc amend
	- parse 'diffcamp revision'

Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 18:47:17 -08:00
epriestley
ba6091f945 Add @nocommit and tests to Text linter.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 17:26:51 -08:00
epriestley
2354d544e3 Restore hook configuration in lint unit tests. Make working copy setup an
external.

Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 11:53:34 -08:00
epriestley
2f37912946 Expose the already-functional "--engine" flag for the unit workflow.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 11:53:13 -08:00
epriestley
834b375e47 Improve bash completion for commands like 'arc lint' and 'arc unit'.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 11:51:06 -08:00
epriestley
7ef47d3e15 More SVN hook docs.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-16 10:06:44 -08:00
epriestley
026269a707 Inch toward a defensibly documented project state.
Summary:

Test Plan:

Reviewers:

CC:
2011-02-15 15:10:53 -08:00
epriestley
ca98fc175f Add lint support to 'arc svn-hook-pre-commit'.
Summary: The biggest blocker on getting rid of arc in trunk is that the lint
rules in the commit hooks are still running the old version. Push arc
commit hook support toward some reasonable state of approximately working.

Test Plan:

Reviewers:

CC:
2011-02-15 14:57:24 -08:00
epriestley
d2b5d9108b Provide coverage for the xhpast $a->b->c parsing bug exposed by tautolinting the
codebase.

Summary:

Test Plan:

Reviewers:

CC:
2011-02-13 16:43:32 -08:00
epriestley
b3b2da4608 Fix greediness in Apache License linter.
Summary: The multi-line comment regexp was potentially too greedy. See
"greedy.lint-test".
	- Made it less greedy.
	- Added test coverage.
	- Fixed an issue with the Apache license getting applied with too much
	  whitespace against C files.

Test Plan: Ran unit tests.

Reviewers: aran

CC:

Differential Revision: 36
2011-02-13 16:03:05 -08:00
adonohue
e0bc910dda Tweak license linter to support licenses on line immediately after <?php
Summary:
Tweak license linter to support licenses on line immediately after <?php

Test Plan:
Corrupt an apache license and re-lint twice.

Differential Revision: 34
Reviewed By: epriestley
Reviewers: epriestley
2011-02-11 17:51:55 -08:00
adonohue
f22d74f88d Refactor Apache license linter to parameterize the license itself.
Summary:
Refactor Apache license linter to parameterize the license itself.

Test Plan:
meta

- begin *PUBLIC* platform impact section -
Bugzilla: #
- end platform impact -

Differential Revision: 33
Reviewed By: epriestley
Reviewers: epriestley
2011-02-11 16:36:09 -08:00
epriestley
16db51bc3c Don't try to mark committed when running "arc amend --show". 2011-02-09 09:39:17 -08:00
epriestley
f938293ea8 Make Arcanist understand a phid-based response from
differential.parsecommitmessage.
2011-02-09 09:19:22 -08:00
epriestley
6082b89eb4 Use the '(?P<' syntax instead of '(?<' for capturing named subgroups. 2011-02-09 09:12:21 -08:00
epriestley
4b51720ba1 Tautological expression lint. 2011-02-06 13:04:01 -08:00
epriestley
c97b736a21 Treat empty update message as user abort on 'arc diff' workflow
Summary:
"-m ''" will still let you do a truly empty update if
you are insistent on that.

Test Plan:
meta

Differential Revision: 209194
Reviewed By: dschleimer
Reviewers: dschleimer
CC: epriestley
Revert Plan:
OK
2011-02-04 16:08:53 -08:00
epriestley
89a3606406 Merge branch 'master' of github.com:facebook/arcanist 2011-02-03 16:00:05 -08:00
epriestley
d7219a1619 Add a missing 'static' qualifier. 2011-02-03 15:59:45 -08:00
epriestley
83a0083b3b Improve argument passthru behavior to make added args available to test engines.
Summary:
When you add new arguments to the unit command, they need to be
threaded through to the unit engine. This enables you to specify passthru
command which will be shipped through the callstack.

Test Plan:
Ran 'arc diff --maxtests 8 --apply-patches --trace' and verified
resulting behavior was correct.

Differential Revision: 207877
Reviewed By: dschleimer
Reviewers: dschleimer
CC: dschleimer
Revert Plan:
OK
2011-02-01 20:45:32 -08:00
epriestley
9a699f261a Make change amending explicit in arc lint
Summary:
This should only happen on the 'diff' workflow.

Test Plan:
ran 'arc lint' and didn't get prompted to amend, ran 'arc diff' and got yelled
at for uncommitted changes, committed, ran 'arc diff' and got prompted to amend

Differential Revision: 206696
Reviewed By: adonohue
Reviewers: adonohue
CC: adonohue
Revert Plan:
OK
2011-01-29 17:28:57 -08:00
epriestley
100c55cf45 Make "arc export" work from a local git repo
Summary:

Test Plan:

Reviewers:

CC:
2011-01-29 12:45:37 -08:00
epriestley
9affcb0db2 Expose XHPAST parse tree down the line to other parsers.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-28 15:18:19 -08:00
epriestley
042081b47f Merge branch 'master' of github.com:facebook/arcanist 2011-01-28 11:38:45 -08:00
epriestley
ac7fd22061 Fix a bogus idx() call.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-28 11:37:44 -08:00
epriestley
072833dcb4 Merge branch 'master' of github.com:facebook/arcanist 2011-01-26 17:47:00 -08:00
epriestley
777c69699b Don't apply apache license lint rules if there is no copyright holder. 2011-01-26 17:46:17 -08:00
adonohue
c896d3814f [easy] remove no-op from ArcanistLinter#raiseLintAtPath
Summary:
Remove extra call to getActivePath

Test Plan:
Inspection

Differential Revision: 205579
Reviewed By: epriestley
Reviewers: epriestley
CC: epriestley
Revert Plan:
OK
2011-01-26 17:33:35 -08:00
epriestley
d933f20005 Blanket exclude 'externals/' directory from linting in the PhutilLintEngine. 2011-01-26 09:58:16 -08:00
epriestley
d46a138eb0 Don't issue lint about strangely named classes just because they have some
word character in them.
2011-01-26 07:03:52 -08:00
epriestley
210b4fe07d Include CSS and JS in PhutilLintEngine. 2011-01-25 11:32:57 -08:00
epriestley
7f4e6692cd Add ArcanistDiffUtils.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-24 16:48:20 -08:00
epriestley
adef7d4975 Expose diff IDs to post-diff workflows.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-21 16:17:30 -08:00
epriestley
746768e779 Enable PhutilModuleLinter to recover more gracefully from broken modules.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-17 20:18:42 -08:00
epriestley
4818892841 Basic 'shell-complete' workflow.
Summary:
Adds data-driven shell completion help to arcanist.

Test Plan:
ran various commands in git and svn working copies,
output seemed reasonable

Differential Revision: 201754
Reviewed By: adonohue
Reviewers: mroch, adonohue
Commenters: crackerjack
CC: epriestley, adonohue, achao
Revert Plan:
OK
2011-01-17 20:18:27 -08:00
adonohue
026a322dd2 Implement lint check that filename matches only declared interface/class.
Differential Revision: 201593
Reviewed By: epriestley
2011-01-14 15:30:11 -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
2c4b453757 Correct some references to '--diff-only', now '--preview'.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-13 15:31:37 -08:00
epriestley
50f42aad8d Provide a better error message for 'arc patch' when patches fail.
Summary:
Be more clear about what happened.

Test Plan:
ran 'arc patch' on good/bad patches

Differential Revision: 201085
Reviewed By: adonohue
Reviewers: adonohue
CC: adonohue
Revert Plan:
OK
2011-01-13 13:40:09 -08:00
epriestley
8c73ed915d Fix a typo ish.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-12 17:20:45 -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
c8b303bc90 Add SVN pre-commit hook support.
Summary: Basic support for an SVN pre-commit hook. Still very skeletal.

Test Plan:

Reviewers:

CC:
2011-01-12 03:02:05 -08:00
epriestley
7d36705215 Ship unresolved unit test information to Differential.
Summary:

Test Plan:

Reviewers:

CC:
2011-01-11 22:37:06 -08:00
epriestley
bb7e649fa5 Ship lint warnings to Differential.
Summary: Send skipped lint warnings to Differential. This also fixes a nasty
bug with lint excluding too many warnings based on line changes.

Test Plan: meta

Reviewers:

CC:

Differential Revision: 200387
2011-01-11 20:45:36 -08:00
epriestley
964630facc Integrate with file.upload over conduit to ship binary changes to Differential.
Summary: support binary upload in the new arc so we can show image diffs, e.g.

Test Plan:

Reviewers:

CC:
2011-01-11 15:39:40 -08:00
epriestley
e508504ddf Fix an issue in Subversion with a root working copy which is actually a symlink.
Summary: lol svn lol

Test Plan:

Reviewers:

CC:
2011-01-11 14:26:21 -08:00
epriestley
b7ccb78ece Work around an issue with older diffs in the Facebook database.
Summary: We have some diffs which predate property tracking and are shipping
down sketch data, work around it in the client for now.

Test Plan:

Reviewers:

CC:
2011-01-10 14:15:08 -08:00
epriestley
9e77d3b3ba Add --never-apply-patches and --apply-patches to lint.
Summary: These flags let you force the behavior of 'arc lint' instead of
prompting. Also made the amend behavior default to false since I've screwed
this up about 300 times in the mere hours I've been using git as a primary VCS.

Test Plan: ran arc lint with these flags

Reviewers:

CC:
2011-01-10 14:04:51 -08:00
epriestley
f071a55266 Avoid path change collision issue when diffing an unusual edge case out of
svn.

Summary: when you "svn cp" with a revision, we end up with some path collision
problems. This isn't a complete fix but it gets the change to Differential,
at least.

Test Plan:

Reviewers:

CC:
2011-01-10 12:41:58 -08:00
epriestley
10b0a553b4 Improve phutil module linter behavior for vanished modules and missing or
broken __init__.php.

Summary: This allows phutilmodulelinter to generate missing __init__.php and
recover from missing modules without horrible fataltown.

Test Plan:

Reviewers:

CC:
2011-01-10 00:07:58 -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
efb8219196 Fix some problems with the module linter that would cause various conflicting
warnings raised in __init__.php to overwrite eachother in uncomfortable ways.
2011-01-09 20:40:31 -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