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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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:
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
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
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
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
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
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
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
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
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:
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:
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:
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:
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
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
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
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
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
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
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
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
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:
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:
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:
broken __init__.php.
Summary: This allows phutilmodulelinter to generate missing __init__.php and
recover from missing modules without horrible fataltown.
Test Plan:
Reviewers:
CC: