Summary: Mechanical changes from D2588. No "Class.php" moves yet because they aren't necessary for libraries to function.
Test Plan: See D2588.
Reviewers: vrana, btrahan, jungejason
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1103
Differential Revision: https://secure.phabricator.com/D2589
Summary:
- "arc liberate" now works for v1 or v2 libraries.
- "arc liberate --upgrade" converts a v1 to a v2.
- We delete __init__.php files but do not move Class.php files, since this is vastly simpler. Authors can do this on their own if they want. We'll do it separately.
- v2 has less lint support than v1, but I think we can move first and migrate lint support later. Much of the v1 lint is bad anyway.
Test Plan: Upgraded libphutil, arcanist and phabricator to v2
Reviewers: vrana, btrahan, jungejason
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1103
Differential Revision: https://secure.phabricator.com/D2588
Summary: We recover from Conduit exceptions, but not from transport exceptions or other general classes of error here. Recover from everything, and add an explicit flag to skip uploads.
Test Plan: Added a "throw", created a diff, skiped upload. Removed throw, created a diff with --skip-binaries. Created a diff normally.
Reviewers: btrahan, vrana
Reviewed By: vrana
CC: aran
Differential Revision: https://secure.phabricator.com/D2598
Summary:
Adds a linter for v2 libraries which raises the relevant errors.
NOTE: Not hooked up anywhere yet, so this diff has no effect.
Test Plan:
Switched the ModuleLinter to LibraryLinter and ran it with a junk block to trigger errors:
>>> Lint for src/lint/linter/phutillibrary/ArcanistPhutilLibraryLinter.php:
Error (PHL3) One Class Per File
File 'lint/linter/phutillibrary/ArcanistPhutilLibraryLinter.php' mixes
function (id) and class/interface (ArcanistPhutilLibraryLinter)
definitions in the same file. A file which declares a class or an
interface MUST declare nothing else.
190 }
191
192 if (false) {
193 function id() { }
194 new XYZ();
195 }
Error (PHL2) Duplicate Symbol
Definition of function 'id' in
'lint/linter/phutillibrary/ArcanistPhutilLibraryLinter.php' in library
'arcanist' duplicates prior definition in 'utils/utils.php' in library
'phutil'.
190 }
191
192 if (false) {
193 function id() { }
194 new XYZ();
195 }
Error (PHL1) Unknown Symbol
Use of unknown class 'XYZ'. This symbol is not defined in any loaded
libphutil library.
191
192 if (false) {
193 function id() { }
194 new XYZ();
195 }
Reviewers: vrana, btrahan
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1103
Differential Revision: https://secure.phabricator.com/D2597
Summary:
We have a linter that needs to read data from the repo that isn't in the commit,
so that data isn't part of the svn transaction, thus not available in svnlook
cat --transaction. This change provides a method to get data from a committed
file.
Test Plan:
Successfully ran arc svn-hook-pre-commit with a linter that needs something
not in the transaction.
Reviewers: epriestley, jungejason, vrana
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2582
Summary:
One line is usually more than enough for these excuses.
The excuse is quite often the same as in past so history is very useful.
Prompting user right below the errors is better than writing them below prompt.
Test Plan:
Produce a lint error.
Provide an empty explanation.
Provide a non-empty explanation.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2580
Summary: I am trying to stop using `--verbatim` and miss this information.
Test Plan: This diff.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2575
Summary:
`arc diff` adds a space after each field in template.
It is later removed for the last field.
Test Plan: This diff.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2564
Summary:
Simple wrapper for PHP_CodeSniffer.
You need to have PHP_CodeSniffer and it's dependencies installed.
Test Plan: - Try running it with your custom lint engine
Reviewers: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2560
Summary: On windows paths are separated with \.
Test Plan: - Run filename linter on windows (or some path with \)
Reviewers: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2559
Summary: Git supports this feature (https://git.wiki.kernel.org/index.php/Aliases), it's fairly simple to implement, and gives us a little more ammunition to dissuade users with unusual workflow requirements from actually requesting features.
Test Plan: Defined the alias described in the documentation. Ran "arc ls", "arc ls -alh", etc.
Reviewers: btrahan, csilvers
Reviewed By: csilvers
CC: aran
Differential Revision: https://secure.phabricator.com/D2552
Summary:
there are two problems making the ArcanistSvnHookPreCommitWorkflow not working.
- pathExists($path) will always return false because it hasn't loaded the path yet. Because of this, PhutilLintEngine will unset the path at https://secure.phabricator.com/diffusion/ARC/browse/master/src/lint/engine/phutil/PhutilLintEngine.php;032b9b30b0721c3f$46, so ArcanistSvnHookPreCommitWorkflow will have no path to lint against and never detects a problem.
- In ArcanistSubversionHookAPI::getCurrentFileData(), the $path is already the full path in svnroot (path got from https://secure.phabricator.com/diffusion/ARC/browse/master/src/workflow/svn-hook-pre-commit/ArcanistSvnHookPreCommitWorkflow.php;032b9b30b0721c3f$72). Prepending the project root to it will make the file path to be wrong so that the file content is empty. Again, ArcanistSvnHookPreCommitWorkflow never detects a problem.
Test Plan:
changed --transaction to --revision in related code and manually ran the following command. It detected the syntaxt error correctly. 558937 is a revision with syntax error.
/usr/local/bin/php -f /home/jungejason/nfs_devtools/arcanist/bin/arc svn-hook-pre-commit --load-phutil-library=/tmp/testwww/www/lib/arcanist --load-phutil-library=/home/jungejason/nfs_devtools/facebook/src /svnroot 558937 2>&1
Reviewers: epriestley, nh
Reviewed By: nh
CC: aran, Girish, Koolvin
Differential Revision: https://secure.phabricator.com/D2485
Summary:
It's easy to forget to do this when writing a new lint engine (like I recently
just did), so I added it to the example to improve documentation on how to write
a lint engine. This code is copied from PhutilLintEngine (as well as many
others).
Test Plan: php -l
Reviewers: jungejason, vrana, epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2553
Summary: If you develop in "master" and try to "arc land", you get an error. You can reasonably "arc amend" in this situation, most of the time. Give the user an explicit pointer.
Test Plan:
$ arc land master
Usage Exception: You can not land a branch onto itself -- you are trying to
land 'master' onto 'master'. For more information on how to push changes, see
'Pushing and Closing Revisions' in 'Arcanist User Guide: arc diff' in the
documentation. You may be able to 'arc amend' instead.
Reviewers: csilvers, btrahan
Reviewed By: csilvers
CC: aran
Differential Revision: https://secure.phabricator.com/D2547
Summary:
More & more use cases come up with empty suite names, guessing
and making test names nice is mess. Will leave it as it is, except
data set part, as it could be super long.
Test Plan: - Try running some phpunit tests with & without data sets
Reviewers: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2544
Summary: Request from @csilvers, whose team is alergic to $EDITOR.
Test Plan:
Adding reviewers and CCs to this diff via CLI. The initial commit message for this diff is:
Add "--reviewers" and "--ccs" flags to arc diff
Request from @csilvers, whose team is alergic to $EDITOR.
Tested: Adding reviewers and CCs to this diff via CLI. The initial commit message for this diff is:
(...infinite recursion omitted...)
Reviewers: csilvers, btrahan
Reviewed By: csilvers
CC: aran
Differential Revision: https://secure.phabricator.com/D2538
Summary:
- When you run "arc diff" in Mercurial, we currently give you an empty template. Instead, prefill a likely template by parsing messages, as we do for Git.
- Unify Git and Mercurial logic for acquiring messages, since `getLocalCommitInformation()` now provides this information. This should improve Git performance, and allows us to delete some code.
- Merge messages more intelligently. Currently, we just overwrite fields. Instead, merge arrays (like ccs, reviewers, tasks) and concatenate strings (like summary and test plan). We need to special case "title", see inline.
- @csilvers: this is a precursor to implementing "--reviewers", etc.
Test Plan: See next post, test plan includes giant output.
Reviewers: btrahan, csilvers, Makinde, jungejason, vrana
Reviewed By: csilvers
CC: aran
Differential Revision: https://secure.phabricator.com/D2536
Summary:
Better test name handling for tests with data sets.
Instead of showing test name with full data set, show it's id/name,
e.g. `testConstructor with data set #1`
Test Plan: - Try running tests with data sets
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2535
Summary:
PHPUnit wrapper for arc.
The idea here is simple - find the test case which is related to the updated
class file. Generate tmp files for json & clover reports, run phpunit
with provided arguments.
It supports phpunit configuration file setting in `.arcconfig`: `phpunit_config`.
Path should be relative to project root.
Test Plan:
- Set `unit_engine` to `PhpunitTestEngine`
- Try running tests with & without `phpunit_config` option.
Reviewers: epriestley, davidreuss
Reviewed By: epriestley
CC: aran, Koolvin, jungejason
Differential Revision: https://secure.phabricator.com/D2472
Summary:
Several related changes:
- Add a "--conduit-version" flag, so you can actually diff conduit version bumps. Otherwise, the server rejects you.
- Make "arc upgrade" upgrade both libphutil and arcanist, not just arcanist.
- Bump the version number to 5. See D2527.
Test Plan:
- Ran "arc upgrade".
- Ran "arc diff". Got told there was a version issue.
- Ran "arc diff --conduit-version=4" to create this diff.
Reviewers: indiefan, nh, vrana, btrahan, jungejason, Makinde
Reviewed By: vrana
CC: aran
Differential Revision: https://secure.phabricator.com/D2528
Summary:
Hive has custom integration which relies on prefilling a bunch of information from JIRA. This is currently broken and accomplished in a roundabout way. Instead, add an event that the integration can listen for. See next diff.
@Girish, I guess you're official Phabricator/Hive support now?
Test Plan: Ran the Hive/JIRA workflows in Git and SVN, see next diff.
Reviewers: Girish, btrahan, ashutoshc
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T1206
Differential Revision: https://secure.phabricator.com/D2449
Summary:
There are different options how to implement this:
We can also generate the warning in `validateField()` and handle it in all callsites.
This is sufficient for me and simple enough.
Test Plan: `arc diff` revision with reviewer away/not away.
Reviewers: btrahan, jungejason
Reviewed By: jungejason
CC: epriestley, aran
Differential Revision: https://secure.phabricator.com/D2493
Summary:
If you forget to provide an argument for --update and have another argument
following it (e.g. HEAD^), we should provide a nice error message instead
of passing that argument through to a conduit call and then printing the
conduit error.
Test Plan: ran 'arc diff --update HEAD^' and got a nice error message
Reviewers: epriestley, jungejason, vrana
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2468
Summary:
- "git log" still includes "\n", so we're currently generating nonsense hashes like "\nabd9879bab86ad78ab...".
- Correct the log range we use in Git. See comment. When users perform merges, their expectations about what the "included commits" and what the included changes are are different. Represent them with two different ranges.
- Same deal for Mercurial
Test Plan: Ran "arc which" in various contexts.
Reviewers: btrahan, aurelijus, Makinde
Reviewed By: Makinde
CC: aran, nh, jungejason
Maniphest Tasks: T873
Differential Revision: https://secure.phabricator.com/D2460
Summary: Provide far more information about what "arc diff" intends to do.
Test Plan: Ran "arc which" in a variety of circumstances.
Reviewers: btrahan, Makinde
Reviewed By: Makinde
CC: aran
Maniphest Tasks: T1183
Differential Revision: https://secure.phabricator.com/D2454
Summary:
When getting an encoding, we should query the server for the encoding of the
project that we're exporting from, not the project that we're running arc in
(arc might not be in a working copy).
Test Plan: ran arc export with --diff and didn't get a workflow exception
Reviewers: epriestley, jungejason, vrana, davidreuss
Reviewed By: jungejason
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2455
Summary:
- Allow users to delete the remote copy of a feature branch as well as the local one, for workflows that push feature branches. We test if the remote exists before trying to delete it.
- Raise a better warning when you misuse "arc land".
- I also wrote some documentation about this, see next diff.
Test Plan:
- Tried to land a branch onto itself.
- Ran "arc land --delete-remote" on feature branches with and without remote feature branches.
Reviewers: aurelijus, btrahan
Reviewed By: aurelijus
CC: aran
Maniphest Tasks: T1204
Differential Revision: https://secure.phabricator.com/D2445
Summary: I renamed this in D2437 for greater consistency with everything else, but missed this use of the old key.
Test Plan: idk lmk?
Reviewers: Makinde
Reviewed By: Makinde
CC: aran
Differential Revision: https://secure.phabricator.com/D2452
Summary: Currently, we ship only the summary, but we need to ship the whole thing for T1189.
Test Plan: Added var_dump() + die, ran in git and hg working copies, verified 'message' included the whole message.
Reviewers: csilvers, btrahan, Makinde
Reviewed By: csilvers
CC: aran
Maniphest Tasks: T1189
Differential Revision: https://secure.phabricator.com/D2437
Summary:
- Try to limit the pain of //future// version bumps by making arc self-updating.
- When the server needs a newer version, prompt the user to update.
- (We need them to reissue their command because we may already have loaded classes which have changed in the update.)
- Make the message sound exciting!
Test Plan: Artifically bumped server forward, ran "arc list", got to upgrade!
Reviewers: Makinde, nh, jungejason, btrahan
Reviewed By: nh
CC: aran
Differential Revision: https://secure.phabricator.com/D2435
Summary:
ArcanistDiffWorkflow::getGitParentLogInfo() calls
ArcanistDifferentialCommitMessage::newFromRawCorpus() which may throw a
ArcanistUsageException if the parent commit message is malformed (specifically,
a bad "Differential Revision:" line); this should not stop arc diff.
Test Plan: successfully ran arc diff where the parent commit message was malformed.
Reviewers: epriestley, jungejason
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2434
Summary:
There's no reason these should be exclusive: -m is used only on update for the
update message, and --verbatim doesn't affect the udpate message. It's also
useful to allow both of these, if say I want to update my test plan by editing
my git commit message and also provide a message for the update from the
command line.
Test Plan:
ran arc diff with --verbatim and -m and saw my message from -m was used, as
well as my updates in the commit message went through.
Reviewers: jungejason, epriestley, vrana
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2426
Summary:
This is mostly an onboarding thing, but also allows "arc upload", "arc download", and "arc paste" to work anywhere on the system.
- Try to read the Phabricator install URI from arc global config if we can't find ".arcconfig".
- Build a WorkingCopy anyway if we can't find ".arcconfig", as long as we can find ".svn", ".git", or ".hg".
- Make all the workflows handle "no project ID" at least somewhat gracefully.
Test Plan:
- Ran "arc diff" in .arcconfig-less Mercurial, Git, and Subversion working copies.
- Ran "arc upload" and "arc download" from my desktop.
- Ran "arc paste" from somewhere random.
- Cleared my config and hit the error, got useful instructions.
Reviewers: btrahan, csilvers
Reviewed By: csilvers
CC: aran
Differential Revision: https://secure.phabricator.com/D2424
Summary: These are the unambiguously-good changes from D2388. Show commits included in a revision in the editor in "arc diff".
Test Plan: Ran "arc diff", saw which commits were being included.
Reviewers: nh, jungejason, vrana, btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T1183
Differential Revision: https://secure.phabricator.com/D2406
Summary:
Always use the value in git.default-relative-commit when getting the relative
commit in git.
Test Plan:
Ran arc diff in a repo with git.default-relative-commit set to HEAD^ on a
branch tracking a remote (that is different from HEAD^), and checked that
the diff against HEAD^, not the remote, was published.
Reviewers: jungejason, epriestley, vrana
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2409
Summary:
Essentially D2391, but with, uh, more comments?
- I forgot that we already implemented shouldOverwriteWhenCommitMessageIsEdited(). This patch already behaves nearly correctly.
- Requires changes in D2412.
- Use `'edit' => 'edit'`, which does the same thing as `'edit' => true`, but is more correct after the "edit" / "create" split.
- Under "--verbatim", always get the message "from the user", which means "from the working copy" because verbtatim disables the editor part.
Test Plan:
- Created and updated revisions with `arc diff`.
- Created and updated revisions with `arc diff --verbatim`.
- Updated revisions with `arc diff --edit`.
Reviewers: jungejason, btrahan
Reviewed By: jungejason
CC: vrana, aran
Differential Revision: https://secure.phabricator.com/D2411
Summary:
Clean up the remaining odds-and-ends here -- move to "differential.close", get rid of the old constant, etc.
I'll wait a week or two to land this since "differential.close" just landed and all the other stuff is trivial.
Test Plan: Grepped for "committed".
Reviewers: btrahan, vrana, Makinde
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T909, T1182
Differential Revision: https://secure.phabricator.com/D2309
Summary:
The major thing I want to do here is allow you to set a default Phabricator URI, so we can make "arc paste", and "arc upload", "arc download" work anywhere.
We can also relax the .arcconfig requirements (request from @csilvers).
Test Plan:
Get/set some values?
iiam
Reviewers: btrahan, vrana, jungejason
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D2400
Summary:
- We no longer need color options since we fake our way through parsing ANSI colorized diffs and use HGPLAIN (on Windows, too!). Drop 'em.
- In the case where you have nothing outgoing, we don't cache the relative commit and thus run "hg outgoing" too many times, which is fairly slow (even if you have nothing outgoing). Cache it.
Test Plan: Ran "arc diff --trace" in a mercurial working copy with nothing outgoing; verified we run "hg outgoing" only once.
Reviewers: Makinde, csilvers, btrahan
Reviewed By: Makinde
CC: aran
Differential Revision: https://secure.phabricator.com/D2399
Test Plan:
Cancel `arc diff`.
Verify that the message is created.
Run `arc diff --verbatim` and see no reuse message question.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2390
Summary: With `--verbatim` flag, notes created from parse errors are never displayed to user resulting in blank fields.
Test Plan:
- `arc diff --verbatim` with invalid Cc
- `arc diff --verbatim` with all fields correct
Reviewers: epriestley, jungejason
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2395
Test Plan: Ran arc land locally with both the mutable default option and with the --merge flag to ensure that messages are set properly.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2372
Summary: In Windows, you can't use `X=y cmd` syntax to set variables. Use "set X=y & cmd" instead.
Test Plan:
- Ran "arc diff" in a Mercurial repo in Windows, created D2367.
- Verified this does //not// cause 'HGPLAIN' to be set in the outer shell (where you type "arc diff").
Reviewers: Makinde, tido, indiefan, btrahan
Reviewed By: tido
CC: aran
Maniphest Tasks: T1179
Differential Revision: https://secure.phabricator.com/D2368
Test Plan: Run arc diff locally, verify via git log that the commit is amended afterwards (using the mutable history paradigm)
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2369
Summary:
We do unnecessary working copy checks under "--show", even though the working copy isn't relevant.
Also, 'sourcePath' may not be set (e.g., "arc commit --show --revision X" where X is some "--only" revision).
Test Plan: Ran "arc commit --show --revision 1" against some test data, got clean output.
Reviewers: vrana, btrahan, jungejason
Reviewed By: vrana
CC: aran
Differential Revision: https://secure.phabricator.com/D2353
Summary: Apparently my advice here was terrible, and `--no-decorate` and `--decorate=no` are both very recent additions to Git which a bunch of users don't have. Get rid of them since D2344 allows us to parse all decorate levels anyway.
Test Plan: Tried to google "git changelog", got a bunch of pages about managing changelogs with git.
Reviewers: zeeg, ehren
Reviewed By: ehren
CC: ehren, aran, NorthIsUp
Differential Revision: https://secure.phabricator.com/D2354
Summary:
"git diff -M -C" generates useful metadata (moves/copies) but (for a pure move) no diff text. Synthetically build the diff text after the fact so this information is available in Differential.
This patch is kind of nasty but I couldn't see a cleaner way to do it. :/
This also needs some UI changes in Differential: we get a full-green new file right now, but it would be better to default-hide it with "This file was moved. Show More" or similar.
Test Plan: Moved a file, ran "arc diff", got textual diff.
Reviewers: aran, tuomaspelkonen, jungejason, btrahan, vrana
Reviewed By: vrana
CC: aran, epriestley, vrana
Maniphest Tasks: T230
Differential Revision: https://secure.phabricator.com/D479
Summary:
Arcanist fails to find git's 'commit <hash>' header when log.decorate is
set in one of git's config files. git adds the named refs that point to
the commit in parentheses following the hash. This changes the regex
used by arcanist to match git commit headers to optionally match the
branch names in parentheses following the hash.
Test Plan:
Run `git config --global log.decorate short` and check that `arc diff`
runs successfully.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2344
Summary: Missed this when getting rid of all the 'file' calls.
Test Plan: Meta.
Reviewers: btrahan, vrana, jungejason
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1159
Differential Revision: https://secure.phabricator.com/D2327
Summary:
Wrapper for Python 'nose' (http://readthedocs.org/docs/nose/en/latest/)
testing tool.
Test Plan:
Install latest 'nose' v1.1.3. Currently it is available through
Github only (``pep install git+https://github.com/nose-devs/nose.git``).
Create a Python project with following structure:
/package_name/module_name.py
/tests/package_name/test_module_name.py
Write some tests
Run ``arc unit``
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin, zeeg
Differential Revision: https://secure.phabricator.com/D2322
Summary: Currently, if you change a symlink outside a libphutil library and the link target is something inside a libphutil library, we may enter an inifite loop in the "do { ... } while(...)" later. Just bail if the loop won't resolve.
Test Plan: Ran arc unit, Airtime reported the issue resolved by a similar fix.
Reviewers: cpiro, btrahan
Reviewed By: cpiro
CC: aran
Differential Revision: https://secure.phabricator.com/D2318
Summary:
Allow tests to be skipped by calling assertSkipped(). It's not really
an assertion of anything tangible; more like "assert that we can't
really assert anything right now".
Test Plan: Added a new test to the PhutilUnitTestEngineTestCase.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2312
Summary:
- Add branch name tab completion to "arc land".
- Default to landing the current branch.
- This is a little bit hacky but not too terrible. I'm planning to move the whole thing to PhutilArgumentParser at some point so that'll be an opportunity for a big refactor.
Test Plan: Hit tab, landed this branch.
Reviewers: zeeg, btrahan, vrana, jungejason
Reviewed By: btrahan
CC: aran, kdeggelman
Differential Revision: https://secure.phabricator.com/D2293
Summary:
Don't use abstract subclasses of ArcanistPhutilTestCase, only use
concrete ones.
This lets you put common functionality in an abstract BaseTestCase
(which itself is a subclass of ArcanistPhutilTestCase), then implement
concrete subclasses of the BaseTestCase.
Test Plan: Tested with a simple Base -> {Case1, Case2} setup.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2300
Summary:
- Replace SVN-specific language with VCS-agnostic language.
- Add new "arc close-revision", works exactly like "arc mark-committed" but with agnostic language.
- Use status constants, not status strings.
- Mark "arc mark-committed" deprecated.
- Remove deprecated "arc merge".
Test Plan: Ran "arc mark-committed", "arc close-revision".
Reviewers: btrahan, vrana, jungejason
Reviewed By: btrahan
CC: aran, Makinde
Maniphest Tasks: T909
Differential Revision: https://secure.phabricator.com/D2244
Summary: See rage in T1117. Don't use the <project + branch> heuristic anymore..
Test Plan: Ran "arc diff --strict HEAD^" on a commit stacked on top of this one, got no matches.
Reviewers: btrahan, vrana, simpkins, beng
Reviewed By: btrahan
CC: aran, avive
Maniphest Tasks: T1117
Differential Revision: https://secure.phabricator.com/D2221
Summary:
- Historically, "--preview" was forbidden under SVN. No reason for that now.
- The "--auto" patch moved the "--preview" / "--only" checks later than they should be.
- Fix an issue with Conduit query construction in SVN.
Test Plan: Ran "arc diff --preview" in an SVN working copy. Ran "arc diff" in an SVN working copy.
Reviewers: svemir, btrahan, vrana, jungejason
Reviewed By: svemir
CC: aran
Differential Revision: https://secure.phabricator.com/D2218
Summary:
When people create the .arc/default-relative-commit scratchfile with $EDITOR of
choice, their editor usually puts a newline at the end, which breaks arc diff.
We should trim the newline before using the contents of the scratchfile.
Test Plan:
ran arc diff in a working copy that contained a .arc/default-relative-commit
with a newline
Reviewers: epriestley, jungejason
Reviewed By: epriestley
CC: aran
Differential Revision: https://secure.phabricator.com/D2209
Summary: If you have two projects (say, libphutil and arcanist) and you prepare a patch for one of them on branch "master", run "arc diff", and then prepare a patch for the other one on the same branch, "arc diff" will try to update the first revision when you run it. Instead, make it smart enough to stay within arc projects.
Test Plan: Ran "arc which" in circumstances where it previously generated a false positive, no false positive.
Reviewers: btrahan, vrana, jungejason
Reviewed By: jungejason
CC: aran
Maniphest Tasks: T1100
Differential Revision: https://secure.phabricator.com/D2199
Summary: See discussion in D1861.
Test Plan: Ran "arc diff" on master, got an upstream-based relative commit. Ran "arc diff" on a feature branch, got a config-based relative commit. Ran "arc diff x", got an argument-based relative commit.
Reviewers: btrahan, vrana, davidreuss, elgenie
Reviewed By: davidreuss
CC: aran
Differential Revision: https://secure.phabricator.com/D2192
Summary:
For Objective-C repositories, we want to provide aliases to
arc diff --amend-autofixes by default.
This adds the ability to define aliases in .arcconfig (overridden
by any specified in the user config, of course).
Test Plan:
Tested defining alias with nothing in .arcconfig, with
an alias in .arcconfig. Tested arc alias outside of working
repository.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran
Differential Revision: https://secure.phabricator.com/D2191
Summary:
Xcode (a popular code editor on Mac OS X) has no facility
to trim trailing whitespace automatically.
This adds a new lint severity "AUTOFIX" that's between
WARNING and ERROR. When running the linter, any lint message
whose severity is AUTOFIX will automatically be patched.
Furthermore, if all lint messages returned from the engine are
AUTOFIX, we'll automatically amend HEAD with the patch.
Test Plan:
arc lint on files with and without trailing whitespace,
with and without UTF-8 contents to confirm those still error
Reviewers: epriestley, jungejason
Reviewed By: epriestley
CC: aran
Differential Revision: https://secure.phabricator.com/D2125
Summary:
--auto doesn't work right now on the implicit --create pathway in SVN and HG because we hit these conditions.
Also improve a message.
Test Plan: Ran "arc diff" in unaffiliated working copies in HG and SVN.
Reviewers: svemir, btrahan, vrana, jungejason
Reviewed By: svemir
CC: aran
Differential Revision: https://secure.phabricator.com/D2187
Summary: See next diff for an explanation of this issue.
Test Plan: See next diff.
Reviewers: Makinde, btrahan, vrana, jungejason
Reviewed By: Makinde
CC: aran
Differential Revision: https://secure.phabricator.com/D2174
Summary:
```arc close T1088 --status wontfix --message "I'm not going to fix this."```
T1088 is the test task to screw with, so feel free.
Test Plan: ```arc close T1088 --status [ resolved | wontfix | invalid | duplicate | spite | open ] -m "Message"```
Reviewers: epriestley
CC: aran
Differential Revision: https://secure.phabricator.com/D2162
Summary: Saw this in a diff somewhere; complain about it.
Test Plan: Unit coverage.
Reviewers: btrahan, vrana, jungejason
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T1060
Differential Revision: https://secure.phabricator.com/D2153
Summary:
Added `arc tasks`:
%%%arc tasks
arc tasks --view-all // View Open and Closed Tasks
arc tasks --by-status // Group By Status
arc tasks --by-priority // Group By Priority%%%
Test Plan: Connect to conduit and run arc tasks >> make sure you have tasks =p
Reviewers: epriestley, indiefan
Reviewed By: epriestley
CC: aran, epriestley
Maniphest Tasks: T749
Differential Revision: https://secure.phabricator.com/D1943
Summary:
NOTE: This is a disruptive change to how 'arc diff' behaves by default.
Many years ago, Differential (then DiffCamp) supported SVN. Someone added a "-i" mode to the "diffcamp" script so you could "git show | diffcamp -i", and thus we were
forever bound to storing metadata in commit messages.
But this isn't a common use case outside of Facebook + git-svn, and isn't very flexible. We now have a great deal of flexibility to identify revisions based on
hashes, branch names, etc, and to sync metdata from web to CLI and back. I want to jettison the commit-message-bound artifacts of the tool's history, and move to a
more flexible, modern workflow.
I added "--auto" a while ago, which figures out if you want to create or update a diff automatically, and then prompts you for whatever data it needs, reading
information if it can from commit messages in the range. This is a vastly better workflow in general, especially for SVN and Mercurial users (who currently need to
jump to the web UI to create revisions). It's better for git users too, since they don't need to use template commits and don't have to muck with or configure
templates. However, it's a nontrivial change to git users' core workflow that is clearly different in more ways than it is clearly better.
- This might be contentious, but probably not toooo much, I hope?
- I also deleted the (fairly ridiculous) workflow where we sync commit message changes from the working copy. I think two or three people will be REALLY upset about
this but I have no sympathy. "--edit" covers this and has been around for like two years now, and making the commit message and web dual-authoritative was always a bad
idea that we only ever half-accommodated anyway (see giant swaths of removed TOOD nonsense).
Test Plan:
- I've been using "--auto" exclusively for like a month, it seems to work well.
- Created/updated SVN, Git and HG diffs with "arc diff" under this workflow.
Reviewers: btrahan, jungejason, nh
Reviewed By: btrahan
CC: Makinde, vrana, zeeg, mbautin, aran, yairlivne, 20after4
Maniphest Tasks: T614
Differential Revision: https://secure.phabricator.com/D2080
Summary:
This should be a raw text block, not a parsed message object.
I broke this in rARC1f13e022cdc9bf4859274a83784bd615caf62ef9 when I improved Mercurial support.
See: https://github.com/facebook/arcanist/issues/23
Test Plan: (Will update this diff...)
Reviewers: vrana, jungejason, btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D2136
Summary: Allows you to set a default in .arcconfig. This default is overriden by any .arc/ setting.
Test Plan: Ran "arc diff" with a .arcconfig setting but no .arc/ setting, got a diff against the specified relative commit.
Reviewers: nh, btrahan
Reviewed By: nh
CC: aran
Differential Revision: https://secure.phabricator.com/D2093
Summary:
Most setters returns `$this` but some don't.
I guess it's not by purpose.
Test Plan:
arc lint
Reviewers: epriestley
Reviewed By: epriestley
CC: aran
Differential Revision: https://secure.phabricator.com/D2084
Summary:
The default of "arc diff" to "arc diff HEAD^" in git is universally confusing to everyone not at Facebook.
Drive the default with configuration instead. Even at Facebook, "origin/trunk" (or whatever) is probably a better default than "HEAD^".
See D863 for the last attempt at this.
NOTE: This is contentious!
Test Plan: Ran "arc diff", got prompted to set a default. Ran "arc diff" from a zero-commit repo, got sensible behavior
Reviewers: btrahan, vrana, nh, jungejason, tuomaspelkonen
Reviewed By: btrahan
CC: aran, epriestley, zeeg, davidreuss
Maniphest Tasks: T651
Differential Revision: https://secure.phabricator.com/D1861
Summary:
See D2049, D2050. Identify reuses of locals as iterator variables. Before raising an error, we require:
- Variable is declared before the loop.
- Variable is used after the loop, ignoring uses as an iterator variable.
I think this identifies all problems with a very low false positive rate (the false positives are suspicious/unconventional code, but not necessarily errors).
Also fix an issue identified by the linter.
Test Plan:
- Verified this identified the bugs in D2049 and D2050.
- Ran linter against libphutil/, arcanist/ and phabricator/ (see D2051, this, and next diff).
- Ran unit tests.
Reviewers: vrana, btrahan
Reviewed By: vrana
CC: aran, epriestley, jungejason
Differential Revision: https://secure.phabricator.com/D2052
Summary:
Addresses concerns in rARCefb8219196abf047f14b505959e54d078e1df6d3:
- As I recall, the intent of "generateFile" was that these warnings would replace all the other warnings for that file, under the theory that if one warning caused regeneration of
the file the other warnings were irrelevant.
- However, this code never had any effect and I haven't seen any issues with the behavior.
- So, just remove it.
Addresses concerns in rARC070e963d1c26879e47eab19a2377e388c2f166c5:
- Ran "arc liberate --all".
Test Plan: Ran "arc lint" after removing an "__init__.php" with and without a "fixed" generateFile block, there was no behavioral change. So I just nuked it.
Reviewers: vrana, btrahan
Reviewed By: vrana
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D2049
Summary:
D2016 changed the behavior of `phutil_console_wrap()`.
The new behavior is better so I am fixing callsites instead of the function.
Test Plan:
arc help help
Verify that the options descriptions is not indented with 28 spaces.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D2047
Summary: When tests have a lot of output, show a diff of the expected/actual.
Test Plan: Used this when developing D2016 to examine large output usefully.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D2017
Summary: Git can't apply filename case change patches on case-insensitive filesystems. Some day we could manually do this ourselves, but it's fairly rare and complicated -- just raise a useful warning.
Test Plan: Tried to apply a case-changing patch, got a good error.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T618
Differential Revision: https://secure.phabricator.com/D2015
Summary:
- We have "--merge", added similar "--squash" for completeness.
- Switched away from (cd .. && ...) pattern which is not functional on Windows.
- Allow a default --onto to be specified, if master isn't the best default for a project.
Test Plan:
- Did --hold --keep dry runs, changes landed properly.
- Set a default onto branch in .arcconfig.
- Ran --merge and --squash together to verify conflict configuration.
Reviewers: btrahan
CC: aran, epriestley
Maniphest Tasks: T124, T1033
Differential Revision: https://secure.phabricator.com/D2001
Summary:
In Mercurial, we figure out if the working copy is dirty with "hg diff", and do a somewhat expensive merge-base / outgoing operation if the relative commit isn't set. We can set the relative commit earlier and avoid some extra work.
We also may incorrectly cache this state (diff from merge-base of outgoing to tip) and pass the wrong rev and file dirty list to the linters.
Test Plan: Made commits which changed (A, B) and then (A). Ran "arc diff tip^". Before this change, observed full outgoing + merge base resolve and both "A" and "B" passed to lint. Observed execution of fewer commands and lint executing against "A" only after this change.
Reviewers: Makinde, btrahan
Reviewed By: Makinde
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1998
Summary: Obvious error in refactoring code around getCanonicalRevisionName() in D1954.
Test Plan: Ran "arc diff" without looping. Can you verify this fixes your case?
Reviewers: Makinde, btrahan
Reviewed By: Makinde
CC: aran, epriestley
Maniphest Tasks: T1025
Differential Revision: https://secure.phabricator.com/D1970
Summary:
See task. Allow mercurial users to diff with uncommitted changes.
- By default, commit range is merge-base of `hg outgoing` to `.` (dirstate).
- You can get JUST dirstate with `arc diff tip` or similar.
- This ended up being a giant mess various other changes to deal with empty `hg outgoing` and empty dirstate.
Test Plan: Diffed with uncommitted changes, got sensible prompts and results.
Reviewers: Makinde, btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T998
Differential Revision: https://secure.phabricator.com/D1954
Summary: We crash and burn right now, trying to launch an interactive editor against a non-tty stdin. Raise a helpful error message instead.
Test Plan: Will run "arc diff --raw --update".
Reviewers: btrahan, yairlivne
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1949
Summary:
- `git rev-parse --verify` "verifies" very valid-looking commit name, not just valid commit names.
- Currently, if we can't find the base rev we'll incorrectly "verify" it and then fail on "git checkout -b <branch> <some bogus commit>".
- Instead, use `git cat-file -t`.
- See similar fix in D1590.
Example:
$ git rev-parse --verify aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Test Plan: Ran "arc patch" in a mismatched local, hit "Y" to branch, got a branch off HEAD instead of an error.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1947
Summary:
In some workflows, we don't have Conduit at all, so we'll fail with a raw exception. Test for conduit presence before trying to make the encoding call.
Also move some "instanceof" logic for updates into RepositoryAPI (factoring, windows compat).
Test Plan: Ran "arc patch --patch some.patch".
Reviewers: 20after4, davidreuss, nh, btrahan
Reviewed By: 20after4
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1935
Summary:
We currently detect the "\" as a change, and may generate a hunk like this, without changes.
@@ -97,4 +98,4 @@
mmm
mmm
mmm
\ No newline at end of file
While "git apply" is OK with this, "patch" is not. Instead, don't detect this as a change (it is always accompanied by - / + if it's a real change).
Test Plan: Successfully applied a previously-failing SVN patch to a file without a terminal newline that had nonlocal changes.
Reviewers: 20after4, nh, btrahan
Reviewed By: 20after4
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1934
Summary:
In cases where a codebase is not UTF-8, we will attempt an conversion,
if an alternative encoding is given/configured.
This is now possible in two ways:
- by configuring one under repository tracking in diffusion
- by passing an --encoding option to the workflow
If the first is not available we will make a conduit call
to do an extra check and see if an encoding is configured directly with
phabricator.
Test Plan:
Tried various diffs with known encodings (mostly ISO-8859-1), and passed
it in, via stdin, or downloaded a known problematic revision from
phabricator, and they applied where they otherwise failed.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley
Maniphest Tasks: T452
Differential Revision: https://secure.phabricator.com/D1880
Summary:
- When users pipe in colorized diffs, strip the colors instead of failing.
- When showing context, show line numbers (we do show 3 lines around the failure, the failure was just on the first line).
- Remove an irrelevant TODO comment (we handle this elsewhere now).
Test Plan: Unit tests.
Reviewers: Makinde, btrahan
Reviewed By: Makinde
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1887
Summary:
`svn rm $directory` removes the directory and its contents in svn 1.7, whereas
svn 1.6 only removes the directory's contents, so arc diff needs to not try
to read the directory.
Test Plan:
ran arc diff in a svn working copy that had a directory removed (with both
svn 1.6 and svn 1.7) and confirmed that the command did not throw an exception,
and that the removed directory was marked as directory (not a file).
Reviewers: epriestley, jungejason
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1889
Summary: svn changed the format of property changes for svn1.7.
Test Plan: arc diff on a working copy with svn property changes
Reviewers: epriestley, jungejason
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1885
Summary: @koolvin ran into this and was justifiably confused.
Test Plan: Put some random .php file in src/, ran arc liberate src/, got warned.
Reviewers: btrahan, Koolvin
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1878
Summary:
svn 1.7 reports a rev number of -1 for added files; previous versions
reported a rev number of 0. Interpret nonpositive rev numbers to mean
the file was added.
Test Plan: ran arc diff on an svn1.7 working copy with added files
Reviewers: epriestley, jungejason
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1867
Summary: Wanted to double-check that this works properly; it does, but might as well keep the test case.
Test Plan: Ran tests.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T970
Differential Revision: https://secure.phabricator.com/D1869
Summary: We incorrectly merge array() into empty string, which is later interpreted as "this file is entirely not-executable". Instead, show no coverage information in the UI.
Test Plan: Looked at a README diff with no coverage information, got no UI render.
Reviewers: tuomaspelkonen, btrahan, zeeg
Reviewed By: tuomaspelkonen
CC: aran, epriestley
Maniphest Tasks: T965
Differential Revision: https://secure.phabricator.com/D1863
Summary: Give "arc cover" --rev and paths parameters like "arc lint" and "arc unit".
Test Plan: Ran 'arc cover' with various rev/path things. Ran in SVN to verify it works/fails correctly.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T707
Differential Revision: https://secure.phabricator.com/D1860
Summary:
Resolves crazy stuff like 'HEAD' or '{2001-01-01T01:01:01}' into an
actual revision, with a provided implementation for git.
Test Plan: Tested in a hacky script.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1849
Summary:
svn 1.7 no longer has a .svn directory in every subdirectory of the working
copy, only one in the root of the working copy (like git, except you can still
check out subtrees). Thus, we can't check whether we're in an svn repo by
looking for a .svn directory alongside the .arcconfig file.
Test Plan: ran arc diff in an svn 1.7 working copy where it previously wasn't working
Reviewers: epriestley, btrahan, jungejason
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1848
Summary:
- Add a lint check for PHP 5.3 features (namespaces, anonymous functions).
- Add unit tests.
- Disable it by default.
- Enable it for us.
Test Plan: Ran unit tests.
Reviewers: btrahan, edward
Reviewed By: edward
CC: aran, epriestley
Maniphest Tasks: T962
Differential Revision: https://secure.phabricator.com/D1846
Summary:
Make lint output look like gcc errors / grep output; a format used by
editors to jump from a compiler error to a file+line of code which
triggered the error.
Test Plan:
In vim, I ran:
:set makeprg=~/checkouts/devtools/arcanist/bin/arc\ lint\ --output\ compiler
Then:
:make
And was able to jump directly to problematic lines of code.
Reviewers: jungejason
Reviewed By: jungejason
CC: aran, edwardspeyer, jungejason, codeblock, tuomaspelkonen, epriestley
Differential Revision: https://secure.phabricator.com/D550
Summary:
This allows for disabling certain PEP8 linter errors by calling
setCustomSeverityMap on an ArcanistPEP8Linter. However, any custom severities
besides disabled will be ignored.
Test Plan: arc lint
Reviewers: epriestley, andrewjcg
Reviewed By: epriestley
CC: jungejason, aran, epriestley
Differential Revision: https://secure.phabricator.com/D1839
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
Summary: Similar to rARC298ed9cda55d90b755e4dc45d202213e91631888, work around "differential.anonymous-access" issues until we get proper permissions up.
Test Plan: Ran "arc patch" against a "differential.anonymous-acccess" install with a revision argument
Reviewers: btrahan, mbautin
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T848
Differential Revision: https://secure.phabricator.com/D1835
Summary: Simpler assert function for asserting a type of exception was raised.
Test Plan: Wrote this for (and tested it with) D1836.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1837
Summary: If a case does not end with break, continue, throw, exit or return and does not have a "fallthrough" comment, raise a warning.
Test Plan: Ran test case; ran linter against all of Phabricator (no hits).
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1824
Summary: Linter flipped out on D1817; reign it in.
Test Plan: Ran "arc lint" on D1817, got one message.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1818
Summary:
- When you try to "arc patch" a change which adds or removes a trailing newline or alters a file with a trailing newline near the newline, the patch fails because we fail to reconstuct the "\ No newline at end of file" line.
- We don't currently record enough information about these diffs to reconstruct them with a sensible amount of effort. Store the "\ No newline at end of file" line instead of just a flag.
- There are some special rules for these lines; implement them.
NOTE: This causes some display glitching in Differential, but nothing major; I'll fix that in a followup patch.
Test Plan:
- Created a diff which added a trailing newline, removed a trailing newline, and altered a file without a trailing newline near the end of the file.
- Verified that the git version of this patch and the 'arc export --git' version of this patch are (essentially) identical.
- Verified that "arc diff" + "arc patch" can apply these changes.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T533
Differential Revision: https://secure.phabricator.com/D1810
Summary: good title
Test Plan: ran "arc patch DX" a bunch
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley
Maniphest Tasks: T892
Differential Revision: https://secure.phabricator.com/D1789
Summary: This may raise other types of exceptions, e.g. http/network exceptions, where getErrorCode() is not defined.
Test Plan: Reasoned about beahvior.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1804
Summary:
See <https://github.com/facebook/phabricator/issues/97>. Mercurial branch names may contain any characters, but we currently reject branch names with spaces.
NOTE: Mercurial allows you to name branches things like ` ` (five spaces). We do not parse this correctly. Die in a well fire.
Test Plan:
- Added some horrible-but-possible test cases for crazy branch names.
- Unit tests now pass.
Reviewers: btrahan, Makinde, killermonk
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1795
Summary:
On Windows, the PHP function escapeshellarg() replaces '%' with ' ' (space). This is apparently because there is no safe way to escape % inside of strings.
cmd.exe does use "^" as an escape character, so I think replacing "xyz" with "^x^y^z" might work for arbitrary strings (maybe?), or at least some subset of strings, but I don't know cmd.exe well enough to make that call without being concerned I'm introducing a security issue.
Although this patch is dumb, it's certinaly safe, and can only do something wrong if the user has environmental variables like H, P, T, or x01, in which case they're sort of asking for it.
cmd.exe also truncates output on \0, so use \1 as a delimiter instead.
Seriously it's like this thing was written in 1982 and never ever changed.
Test Plan: Created D1783 successfully after applying this patch.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T124
Differential Revision: https://secure.phabricator.com/D1785
Summary: This use of "(cd ..)" is outside of the RepositoryAPI proper (it's when we're trying to figure out which VCS a directory uses) and explodes on Windows.
Test Plan: @koolvin applied this patch manually and got farther than before.
Reviewers: btrahan, Koolvin, jungejason
Reviewed By: jungejason
CC: aran, epriestley
Maniphest Tasks: T124
Differential Revision: https://secure.phabricator.com/D1779
Summary:
`arc help` currently prints more than 500 lines and it is hardly usable without ##> arc.help##, ##| less##, ##| grep##, ##| wc -l## or such.
It is even worse with custom commands and options.
This diff changes `arc help` to only list commands with no description (under 100 lines).
It also adds `arc help --full` which maintains the original behavior.
It doesn't change `arc help <command>`.
NOTE: BC break on different levels.
Test Plan:
arc help
arc help --full
arc help help
arc help lint
Reviewers: epriestley
Reviewed By: epriestley
CC: nh, aran, epriestley
Differential Revision: https://secure.phabricator.com/D1769
Summary:
There's no reason this can't work now, we're just not quite careful enough about definitions.
NOTE: If you use a message which has a revision ID in it already, this will fail in an obtuse way when launching the update editor fails because stdin isn't a tty. I'll clean this all up after T614 is fully sorted.
Test Plan: Ran "arc diff --raw -C HEAD".
Reviewers: btrahan, yairlivne
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1765
Summary:
We currently raise a very confusing error when we hit this case:
Exception: The phutil library '' has not been loaded!
Because of the trickiness of init-order stuff, it's difficult to detect this more explicitly earlier -- instead, just raise a more descriptive error.
Test Plan: Ran "arc unit" in a copy of libphutil other than the one arc loads.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T580
Differential Revision: https://secure.phabricator.com/D1760
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
Summary:
Otherwise it says after hitting Tab everytime:
> Warning: Invalid argument supplied for foreach() in arcanist/src/workflow/shell-complete/ArcanistShellCompleteWorkflow.php on line 99
Test Plan: arc h<Tab>
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1766
Summary:
- This is simpler and reuses more code than doing "(cd %s && ...)" every time.
- If we have an issue like HGPLAIN, we have one place to fix it now.
- On Windows, the construct "(cd %s && ...)" does not mean what we'd like it to.
Test Plan: Ran "arc diff" in a git repo with this change.
Reviewers: btrahan, Makinde
Reviewed By: Makinde
CC: aran, epriestley
Maniphest Tasks: T124
Differential Revision: https://secure.phabricator.com/D1761
Summary: Allow the user to pick a revision explicitly if they think they know what they're doing. Similar to "arc amend --revision", etc.
Test Plan: Obviously compells a meta-test.
Reviewers: btrahan, fratrik
Reviewed By: fratrik
CC: aran, epriestley
Maniphest Tasks: T928
Differential Revision: https://secure.phabricator.com/D1753
Summary:
If a user reverts HEAD in the index or working copy, "git diff" shows no changes
and we explode.
Instead, we should simply return no changes; the rest of the lint pipeline
accommodates this correctly.
Test Plan: Reverted HEAD in a working copy, ran "arc lint", got an error.
Applied patch, ran "arc lint", got accurate lint.
Reviewers: Koolvin, btrahan
Reviewed By: Koolvin
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1729
Summary: Missed this in review (D1715), idx() does not operate on strings (maybe
it does in HPHP/i?).
Test Plan: Faked an editable lint warning, ran "arc lint".
Reviewers: Koolvin, andrewjcg, btrahan
Reviewed By: Koolvin
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1728
Summary:
When the user runs "arc diff --create" or triggers it via "arc diff
--auto", prefill the template as best we can.
Test Plan:
Ran "arc diff --auto" with a template commit message in the working
copy under various configurations, results seemed reasonable.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley, dmi
Maniphest Tasks: T614
Differential Revision: https://secure.phabricator.com/D1719
Summary:
When a user invokes the update flow from Mercurial, prefill the update message
like we do for Git.
Also add a little caching to improve performance since "hg" execs cost ~100ms.
Test Plan: Updated a Mercurial diff repeatedly, got sensible default message
fills.
Reviewers: Makinde, btrahan
Reviewed By: Makinde
CC: aran, epriestley
Maniphest Tasks: T28
Differential Revision: https://secure.phabricator.com/D1718
Summary: See comments. Skip [defaults] in .hgrc when executing commands.
Test Plan: Ran "arc diff" in a mercurial working copy.
Reviewers: Makinde, btrahan
Reviewed By: Makinde
CC: aran, epriestley
Maniphest Tasks: T922
Differential Revision: https://secure.phabricator.com/D1707
Summary:
Not too familiar with the patch rendering code, but diff should fix
a few issues:
1) The current didn't seem to handle the case of an insertion only
diff (where the original text is empty). Specifically, it would
still print a replacement line and would merge the line immediately
after the patch location into the patch application.
2) Patches with trailing newlines were rendered with an additional
newline. This appears to be due to using ##explode## to break the
patch into lines.
Test Plan:
1) Verified that this fixed apache license linting for files that had
no license.
2) Checked that this didn't affect trailing-whitespace patch application.
Reviewers: epriestley, aran
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1715
Summary:
Modified the arc diff workflow, introduced new diff properties -
arc:lint-excuse and arc:unit-excuse for respective errors/warnings.
The diff author inputs the explanation in an editor (similar to commit
message).
Task ID: #
Blame Rev:
Test Plan:
Ran sandbox arc on itself with some lint errors and verified that the
Diff property (== user explanation) is being set.
Revert Plan:
Tags:
Reviewers: epriestley, nh
CC: akramer, blair, aran, andreygoder, Girish, epriestley
Differential Revision: https://secure.phabricator.com/D1676
Summary:
When a Differential revision is updated in git, try to find all commit messages
in the range which we haven't already attached and combine them into a default
update message.
This won't work perfectly in a workflow where you rebase //and// stack local
commits, but worst case is that you just have to delete some lines, which is
still probably better overall than losing this information.
Test Plan: Meta-testing in progress.
Reviewers: btrahan, ptarjan
Reviewed By: btrahan
CC: aran, epriestley, davidreuss
Maniphest Tasks: T28
Differential Revision: https://secure.phabricator.com/D1671
Summary: Otherwise, "arc diff --auto" on a branch with the same name as some
other branch you previously used tries to update that revision.
Test Plan: Ran "arc diff --auto" on a "listdocs" branch; arc didn't try to
update D1639.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T614
Differential Revision: https://secure.phabricator.com/D1662
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
Summary:
Our failure behavior currently sucks. In particular:
- If lint or unit fail (expectedly or unexpectedly), we throw away your
message. omglol sux 2 b u
- If there's a parsing error, we dump the message to 'arc-commit-message' in
CWD and tell you to go deal with it.
This is awful. Improve the behavior:
- Once we read a message, save it in .arc/commit-message so we always have it
if anything goes wrong.
- If that file exists, prompt to read it without any "-F" nonsense.
- If there's a parsing error, tell the user and prompt them to just edit the
file again, showing what they need to fix.
Test Plan: Ran "arc diff --auto" and made a bunch of intentional errors; arc
never screwed me over and was generally fairly pleasant.
Reviewers: btrahan, Makinde
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T614, T895
Differential Revision: https://secure.phabricator.com/D1656
Summary:
Our one Mercurial client doesn't use it (T614) and I moved git off to "arc
land".
This workflow can never work properly for Mercurial without extensions anyway
since it doesn't have --no-ff.
Test Plan: Ran "arc merge" in SVN, git and Mercurial repositories.
Reviewers: btrahan, Makinde
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T614
Differential Revision: https://secure.phabricator.com/D1650
Summary:
I think "arc land" is better than "arc merge" in every case? Make "arc merge"
hg-only (possibly nuke it later, see T614) and point users at "arc land".
Add an explicit "--merge" flag to force --no-ff behavior in mutable reposiories.
Test Plan:
Ran "arc land --hold --merge <feature>" on this branch, got a clean
merge.
Reviewers: fratrik, btrahan
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1647
Summary:
For some workflows (all Mercurial, all SVN, some git) I eventually want arc to
pick between "arc --create" and "arc --update" automatically.
"arc which" laid the groundwork for this. For now, implement it as an optional
flag because I think there are still some rough edges on this pathway (for
example, handling of commit messages when errors happen).
When 'arc diff --auto' is invoked, guess whether the user meant --create or
--update.
Test Plan: Created this revision with 'arc diff --auto'.
Reviewers: Makinde, btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T614
Differential Revision: https://secure.phabricator.com/D1648
Summary: 'cuz the method would fail without authentication! see D1604 for some
discussion on approaches here
Test Plan: ran arc patch and it worked
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley, johnduhart
Maniphest Tasks: T856
Differential Revision: https://secure.phabricator.com/D1645
Summary: T854 is hilarious. seriously, what are the odds?
Test Plan: ran arc patch a few times in a row with the same DX and verified
branches were made with expected, differing names
Reviewers: epriestley, fratrik
CC: aran, epriestley
Maniphest Tasks: T854
Differential Revision: https://secure.phabricator.com/D1605
Summary:
I want to use JSON which allows me to automatically open the files in editor.
I also want to apply patches, especially those modifying __init__.php.
I see no reason why these options should be mutually exclusive.
Also output nothing for okay result which is more standard and better parsable.
Test Plan:
arc lint --output json
arc lint --output json --never-apply-patches # same as above
arc lint --output json --apply-patches
Reviewers: aran, epriestley
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1599
Summary: This is probably just the first step down a long road of not handling
exotic filenames correctly, but if you diff a file named "∆.jpg" it currently
chokes while parsing the diff.
Test Plan: Added minimal failing unit test, fixed parser, test passed.
Reviewers: zeeg, btrahan
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1592
Summary:
Some linters return absolute path.
It causes separate lint messages for the same file.
Also lint messages aren't properly bound in Phabricator.
I've preferred changing addLintMessage() to fixing all linters because it is
more robust.
Test Plan: arc lint of a file with lint problem from linter using absolute paths
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1589
Summary: These are meaningless / unreachable after D1491 and nonsense after
D1582. Depends on D1579.
Test Plan: Grepped for 'sourcePath' references.
Reviewers: arice, btrahan
Reviewed By: arice
CC: aran, epriestley
Maniphest Tasks: T838
Differential Revision: https://secure.phabricator.com/D1584
Summary: Move toward deprecating "differntial.find". Also update the output to
be more inline with "arc branch".
Test Plan: Ran "arc list", "arc branch".
Reviewers: btrahan, arice
Reviewed By: arice
CC: aran, epriestley
Maniphest Tasks: T838
Differential Revision: https://secure.phabricator.com/D1579
Summary:
If you're on A and run "arc land B", run "git checkout A" after
everything's said and done.
Test Plan: Ran "arc land B" from A, got switched back to it.
Reviewers: davidreuss, kdeggelman, btrahan
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1568
Summary:
- Renamed sanityCheckPatch to sanityCheck
- Move check for clean working copy into sanityCheck
- Execute sanityCheck before executing any other command
Test Plan:
- Run ##arc patch <revision id>## from a dirty working copy
and verify that a usage exception is thrown before the new branch is
created.
- Run ##arc patch <revision id> --force## and verify that it attempts
to create a new branch, apply, and commit the patch.
- Then clean your working copy and verify that ##arc patch <revision
id> works as expected
Reviewers: epriestley, btrahan
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T830, T479
Differential Revision: https://secure.phabricator.com/D1546
Summary:
- Show coverage for all files, not just files that have some coverage
information.
- Read file data off disk, under git the "current" data is the data at HEAD,
not the (possibly unstaged/uncommitted) file in the working copy which we
actually ran.
Test Plan: Ran "arc unit --detailed-coverage" on various files.
Reviewers: tuomaspelkonen, btrahan
Reviewed By: tuomaspelkonen
CC: aran, epriestley
Maniphest Tasks: T818
Differential Revision: https://secure.phabricator.com/D1542
Summary:
- Remove "new and experimental" because arc land is super awesome and great.
- Run the 'mark-committed' finalize workflow after pushing for untracked repo
setups.
Test Plan: Ran "arc mark-committed --quiet --finalize 123". Will run "arc land"
on this. so lazy
Reviewers: cpiro, btrahan
Reviewed By: cpiro
CC: aran, epriestley
Maniphest Tasks: T819
Differential Revision: https://secure.phabricator.com/D1538
Summary:
Mark all applicable Arcanist classes as "final", except PhutilLintEngine, which
needs a little finesse.
@jungejason / @nh, does this break any Facebook stuff?
Test Plan: Linter no longer raises warnings. Ran "testEverythingImplemented" in
Phabricator.
Reviewers: btrahan, jungejason, nh
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T795
Differential Revision: https://secure.phabricator.com/D1519
"@concrete-extensible"
Summary:
See T795. I think ~all classes in the classtree should be "abstract" or "final",
but I provided "@concrete-extensible" if you really have "Rectangle extends
Square extends Shape" or something.
I'm not totally sure this should be enabled globally by default, maybe I should
default it to DISABLED and then enable it for libphutil/arcanist/Phabricator? It
feels like it might be a little overbearing to push on everyone by defualt.
Test Plan: See unit tests.
Reviewers: btrahan, aran, nh, arudolph, jungejason
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T795
Differential Revision: https://secure.phabricator.com/D1510
Summary:
Revert of D715, which allowed you to put xhp classes into libphutil libraries.
We're removing support for XHP in resolving T635.
According to @ide, removing this won't break anything.
Test Plan: Straight revert. Grepped for methods.
Reviewers: btrahan, ide, nh, jungejason
Reviewed By: ide
CC: aran, epriestley
Maniphest Tasks: T635
Differential Revision: https://secure.phabricator.com/D1511
Summary:
- Move name helper functions to ArcanistXHPASTLintNamingHook to make it easier
to write custom linters.
- Add test coverage for name functions.
- Add 'variable' and 'global' naming convention tests.
- Expand test cases.
- Improve lint message error when an unexpected message is raised during a
test.
- Remove a defunct XHP lint message.
Test Plan:
- Ran unit tests.
- Ran "arc lint --lintall" on arcanist/.
Reviewers: btrahan, nh, jungejason
Reviewed By: btrahan
CC: johnduhart, aran, epriestley, arudolph
Differential Revision: https://secure.phabricator.com/D1506
Summary:
Check that the base revision is a valid git ref before trying to create a branch
starting at that rev. When arc patch is used in a git repo using the git-svn
bridge, the base reversion is a uri for the svn rev, not a git ref.
Test Plan:
run arc patch on a git-svn repo, run it on a pure git repo, and verify it works
for both
Reviewers: epriestley, btrahan
CC: jungejason, aran, epriestley
Differential Revision: https://secure.phabricator.com/D1505
Summary: You can get this out of reflog, but we can easily just give you the
command in case you want to undo the -D.
Test Plan: Ran "arc land --hold" on this branch, used recovery command to
recover it.
Reviewers: cpiro, btrahan, jungejason
Reviewed By: cpiro
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1504
Summary: Better instructions in the 'git merge' failure case for 'arc land'.
Test Plan: no you test
Reviewers: fratrik, btrahan, jungejason
Reviewed By: fratrik
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1500
Summary:
- Use differential.query, not differential.find.
- Use loadWorkingCopyDifferentialRevisions ("arc which").
- Some general cleanup.
Test Plan:
oh man
$ arc commit --revision 999 # Does not exist
Usage Exception: Revision 'D999' does not exist.
$ arc commit --revision 1 # Exists, not accepted.
Revision 'D1: bleorp' has not been accepted. Commit this revision anyway?
[y/N] y
Committing 'D1: bleorp'...
A locally modified path is not included in this revision:
DERP
It will NOT be committed. Commit this revision anyway? [y/N] y
Done.
$ arc commit --revision 3 # Not mine, from a git repo
You are not the author of 'D3: bloop'. Commit this revision anyway? [y/N]
y
Revision 'D3: bloop' was generated from
'/INSECURE/repos/git-working-copy/', but current working copy root is
'/INSECURE/repos/svn-working-copy/'. Commit this revision anyway? [y/N] y
Committing 'D3: bloop'...
A locally modified path is not included in this revision:
DERP
It will NOT be committed. Commit this revision anyway? [y/N] y
svn: Commit failed (details follow):
svn: '/INSECURE/repos/svn-working-copy/derp' is not under version control
Exception:
Executing 'svn commit' failed!
(Run with --trace for a full exception trace.)
$ arc commit # Nothing accepted
Usage Exception: Unable to identify the revision in the working copy. Use
'--revision <revision_id>' to select a revision.
$ arc commit # Now accepted
Committing 'D1: bleorp'...
Marking revision D1 'bleorp' committed...
Done.
$ svn st # Complicated test for a bizarre SVN edge case
A svnderp
A svnderp/A
A svnderp/B
$ arc diff --create
Linting...
LINT OKAY No lint problems.
Running unit tests...
No unit test engine is configured for this project.
Created a new Differential revision:
Revision URI: http://local.aphront.com/D28
Included changes:
A (dir) svnderp
A svnderp/A
A svnderp/B
$ touch svnderp/C
$ svn add svnderp/C
A svnderp/C
$ arc commit
Usage Exception: Unable to identify the revision in the working copy. Use
'--revision <revision_id>' to select a revision.
$ arc commit --revision 28
Revision 'D28: derp' has not been accepted. Commit this revision anyway?
[y/N] y
Committing 'D28: derp'...
Usage Exception: This commit includes the directory 'svnderp', but it contains
a modified path ('svnderp/C') which is NOT included in the commit. Subversion
can not handle this operation and will commit the path anyway. You need to sort
out the working copy changes to 'svnderp/C' before you may proceed with the
commit.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1491
Summary: I removed the "--interactive" flag since it makes no sense with 'arc
merge --squash', and transposed a space.
Test Plan: Read text.
Reviewers: cpiro, btrahan, davidreuss
Reviewed By: cpiro
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1493
Summary:
Split ArcanistXHPASTLinter::LINT_FORMATTING_CONVENTIONS into seperate
lint names so that each linting rule can be controled sperately
Test Plan:
This shouldn't break anything, if it does we'll know soon enough.
<epriestley> Better things break loudly/obviously I think.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1495
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
Summary:
- Allow 'arc amend' to identify revisions by hash and branch, so it works with
"arc diff --create".
- Warn when the requested revision is not (apparently) in the working copy.
Test Plan:
Ran "arc amend" in working copies with different states (right
revision, wrong revision, hash/branch identification).
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T723
Differential Revision: https://secure.phabricator.com/D1480
ArcanistRepositoryAPI->loadWorkingCopyDifferentialRevisions()
Summary:
- See T787.
- @cpiro has an immediate use case for this, which is ##arc amend --revision
`arc which --id` --show master## for "git merge --autosquash" or similar.
- For T614, we need this to choose "--create" vs "--update".
- Other workflows should also use this to improve how often we automatically
get things right, particularly in Mercurial and SVN.
Test Plan:
Ran "arc which" in SVN, Git and HG working copies with various flags;
results seemed reasonable.
Reviewers: btrahan, cpiro, jungejason
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T787
Differential Revision: https://secure.phabricator.com/D1478
Summary: ...basically by adding "getConduitURI" and then falling through to
that, rather than repeating work from the main arc wrapper that setConduitURI in
the first place. The explicit drawback here is the error message gets a little
more vague.
Test Plan:
- arc install-certifate --conduit-uri=https://secure.phabricator.com
// verified that the install flow was going for
https://secure.phabricator.com...!
- arc install-certificate https://secure.phabricator.com
// verified that the install flow was going for
https://secure.phabricator.com...!
- arc install-certificate
// verified that it reverted back to the .arcconfig conduit uri
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley
Maniphest Tasks: T794
Differential Revision: https://secure.phabricator.com/D1468
Summary:
under git, we now create a branch that is at the patch's base revision if we
know it or whatever the working copy happened to be at if we don't. This diff
also adds the --nobranch flag to disable this new behavior.
Also added an --update flag. When specified, we run the appropriate "update"
command in the VCS. By default this is off.
Finally, tried to give the user more information about what the heck arc just
did to their working copy.
Test Plan:
// verify --update flag works
// -- git
Assume we are at HEAD and we got to HEAD from HEAD^1 via DX
git reset --hard <THE BEGINNING>
arc patch --update DX
// ...versus svn
Assume we are at HEAD and we got to HEAD from HEAD^1 via DX
svn checkout -r 1
arc patch --update DX
// ...versus hg
Assume we are at HEAD and we got to HEAD from HEAD^1 via DX
hg update -r 1
arc patch --update DX
// verify under git a nice branch is made
// -- test where we should get a good name
// -- test where we have a base revision to check out the branch at
Assume we are at HEAD and we got to HEAD from HEAD^1 via DX
git reset --hard HEAD^1
arc patch DX
// verify under git an "okay" branch is made if we can't get "nice"
// -- test where we should get a "bad" name
// -- test where we DON'T have a base revision to check out the branch at
git diff HEAD^1 > ~/example.patch
git reset --hard HEAD^1
arc patch --patch ~/example.patch
// verify --nobranch flag skips the test for git
Assume we are at HEAD and we got to HEAD from HEAD^1 via DX
git reset --head HEAD^1
arc patch --nobranch DX
Reviewers: epriestley
Reviewed By: epriestley
CC: aran
Maniphest Tasks: T479
Differential Revision: https://secure.phabricator.com/D1459
Summary:
Julien built a really cool static analysis database of our codebase. One
capability is that it can suggest typehints that are not in the code. The
analysis to do this is very expensive, so it can't reasonably be run locally.
But it can remain indexed on a server.
The idea here is to provide a familiar interface to it through arc lint, via a
generic Conduit service call.
In our lint engine, this will probably be gated on --advice for performance.
This will introduce a slight awkwardness in that running with --advice can add
new non-advice lint if the server chooses, but this isn't likely to cause a
practical problem.
Test Plan:
Construct a fake Conduit lint endpoint, attach this linter to it, and see bogus
lint
appear with --advice.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran
Differential Revision: https://secure.phabricator.com/D1462
Summary:
without "nocommit" we commit the patch to the working copy. add the nocommit
flag and this commit does not happen.
making this happen required adding revisionID to arc bundle to fetch the proper
commit message. if we can't get a commit message -- suppose the fetch fails or
the source is self::SOURCE_PATCH, we ask the user for the commit message on the
command line
Test Plan:
git reset --hard <SOME_REV>
arc patch DX, where this got us to <SOME_REV + 1>
observe correct patch committed with correct commit message in working copy
git reset --hard <SOME_REV>
arc patch --nocommit DX, where this got us to <SOME_REV + 1>
observe correct patch landed BUT NOT committed. note "commit message" does not
exist since there isn't a commit...!
git diff HEAD^1 > ~/file.patch
git reset --hard HEAD^1
arc patch --patch ~/file.patch
observe prompted for commit message and patch committed with commit message i
typed in
Reviewers: epriestley
Reviewed By: epriestley
CC: aran
Maniphest Tasks: T479
Differential Revision: https://secure.phabricator.com/D1450
Summary:
This allows engines to check the canRun method on linters,
which should determine if a linter is configured and can
be run in the current environment.
Test Plan:
Implement a linter with canRun as false, and ensure
it doesnt run.
Ensure all existing linters still run by default.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran
Differential Revision: https://secure.phabricator.com/D1445
Summary:
This cleans up the PEP8 linter to bring it inline
with the new JSHint Linter's level of quality.
It adds a getPEP8Path method which gives the ability
for users to override the pep8 binary with two new
options in .arcconfig:
* lint.pep8.prefix
* lint.pep8.bin
* lint.pep8.options
Test Plan:
Adjust your engine to use the 'ArcanistPEP8Linter' and run
arc lint against Python files.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran
Differential Revision: https://secure.phabricator.com/D1440
Summary:
This adds a new lint engine, ComprehensiveLintEngine, which
includes sane defaults for some generic languages.
Ideally this would include *all* available language linters,
but that can be enhanced at a later point. Right now it's mostly
the base linter with additional JavaScript and Python linters.
Test Plan:
Adjust the lint_engine to be "ComprehensiveLinterEngine". You'll
also need jshint, pyflakes, and pep8 to all be available on PATH.
Run arc lint against files which contain .php, .py, and .js.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran
Differential Revision: https://secure.phabricator.com/D1439
Summary:
pretty easy stuff as mercurial accepts git style patches...!
also fixed two issues where we were 1) storing the short hash and 2) storing it
with a trailing "\n". This diff makes us store the full hash AND no trailing
return character
Test Plan:
in my mercurial repo
<note repo at revision $foo>
<did something dumb>
hg commit -m "something dumb"
arc diff
<go to web and fill out stuff for DX>
hg checkout $foo
arc patch DX
<verify patch DX successfully applied!>
use conduit console to verify a few diffs were returning the correct full
revision hash with a trailing \n
Reviewers: epriestley
Reviewed By: epriestley
CC: aran
Maniphest Tasks: T630
Differential Revision: https://secure.phabricator.com/D1431