Summary: Fixes T2112. These are fairly common now, and are used as the storage format for `hg export` and mq in most installs.
Test Plan: Ran unit tests, used `arc patch --patch`, uploaded some diffs manually.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Maniphest Tasks: T2112
Differential Revision: https://secure.phabricator.com/D4592
Summary: The binary may not be built, in which case this raises a warning.
Test Plan: Will make @zeeg test.
Reviewers: zeeg, vrana
Reviewed By: vrana
CC: aran
Differential Revision: https://secure.phabricator.com/D4569
Summary:
Previously, trying to arc land in a mercurial repo would
fail if the local branch was already at the tip of the onto branch
(since hg rebase exited with code 1). This change makes it check
if a rebase is needed before executing the rebase.
Test Plan:
hg init foo
cd foo
hg bookmark master
touch a && hg add a && hg commit -ma
// setup your .arcconfig
cd ..
hg clone foo foo2
cd foo2
hg bookmark mybook
touch b && hg add b && hg commit -mb
arc land --onto master --revision <your rev number>
Arc land should succeed. I also tried landing when a rebase was
necessary and it still worked.
Reviewers: epriestley, dschleimer, bos
Reviewed By: epriestley
CC: sid0, aran, Korvin
Differential Revision: https://secure.phabricator.com/D4588
Summary: Also include binary hash in the version.
Test Plan: New unit test.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4535
Summary:
A git submodule looks a lot like a normal git repo, but the .git
directory is replaced with a file that git reads to find the real
location of the git directory. When arcanist tries to write a file into
a directory inside of there, it was failing silently, and then crashing
silently when it couldn't read results back out. Instead of assuming the
git directory is a directory named .git at the toplevel of the tree, we
use the appropriate git command to get the correct git directory.
Test Plan: submit a diff from a submodule
Reviewers: epriestley, vrana
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4482
Summary: This should be done for all external and configurable linters.
Test Plan: Linted file with lint problems, changed options, relinted.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4475
Summary:
If linter with file cache granularity stops linting then we don't run it on the same path next time.
But we still run linters with non-file cache granularity causing that they run even on the paths that would be stopped otherwise.
Test Plan:
Put global granularity linter after Generated linter.
Caused an error from this linter but in ignored path.
Verified that 'stopped' is saved in `lint-cache.json`.
Linted the same files second time, verified that the path is still skipped (wasn't before).
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4446
Summary: To have at least one real callsite.
Test Plan:
$message = new ArcanistLintMessage();
$message->setOtherLocations(array());
$message->setOtherLocations(array(array()));
$message->setOtherLocations(array(1));
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4419
Test Plan: Created function named `f_a`, manually set other location.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4412
Summary:
Some errors (duplicate declaration, invalid number of arguments) have more related places.
We need to notify user if he changes any related place.
This could be currently achieved by triggering errors instead of warnings or by including both files in the range (impossible if the locations are in different files) or by issuing multiple errors.
All options are too aggressive.
Test Plan: Issued error on unmodified line with other location on modified line.
Reviewers: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4392
Summary:
FB runs some linters on background and it's a magnificent hack using `ParallelLinter` (two instances), `BackgroundLinter` and `FutureLinter`.
I want to simplify this by resolving the futures in engine instead of in some virtual linter.
It also seems like a better place to do it.
It should also fix caching problems I have with them (because the virtual linters don't know about the cache at all).
Test Plan: None yet.
Reviewers: epriestley, nh
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4380
Summary:
Fixes T2175. Git generates patches which have "\n" line endings on every system. We currently generate patches with system-dependent line endings.
Git accepts system-dependent line endings in almost call cases, but part of the parser tests for "\n" explicitly. T2175 has an example of this.
Test Plan:
Ran `arc export --git --revision D4366 > export.git` on a Windows machine, verified "\n" line endings. Ran the same with `--unified`, verified "\r\n" line endings.
(I didn't add any unit tests for this because it's Windows-dependent and very difficult to test meaningfully right now -- i.e., test that appliable patches are generated -- since the git reconstitution test doesn't run on Windows either, because we can't yet untar things there.)
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2175
Differential Revision: https://secure.phabricator.com/D4373
Summary: If you dump `arcanist/` into "Program Files" or similar, the `.bat` currently breaks. Quote the path so it doesn't. Fixes T1436.
Test Plan: Ran `arc` with `arcanist/` in a path with spaces in it.
Reviewers: vrana, btrahan
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1436
Differential Revision: https://secure.phabricator.com/D4375
Summary:
D4186 added an "svn status --xml x y" form to getSVNStatus(), but the parser doesn't work for multiple files, since we get multiple <target /> elements in the XML output. So, curently, `arc diff` works (one target, all files) and `arc diff x` works (one target, x) but `arc diff x y` does not (more than one target, hits the exception).
$ arc diff QUACK2 QUACK3
Exception
Expected exactly one XML status target.
Test Plan: Ran `arc diff QUACK2 QUACK3` in a working copy with modified QUACK2, QUACK3. Ran `arc diff`; `arc diff QUACK2`.
Reviewers: vrana, btrahan, codeblock, JThramer
Reviewed By: codeblock
CC: aran
Differential Revision: https://secure.phabricator.com/D4372
Summary: Ref T2296. This error is unreachable right now -- when I fixed all the "\r\n" stuff, we always end up with a nonempty first line for an empty input. Do this test earlier and more explicitly. This results in a less useful error: "expected (some junk) on line 1" instead of "can't parse an empty diff".
Test Plan: Tried to parse an empty diff, got a "you can't parse an empty diff" error.
Reviewers: btrahan, vrana, codeblock
Reviewed By: codeblock
CC: aran
Maniphest Tasks: T2296
Differential Revision: https://secure.phabricator.com/D4370
Summary: Add a comma because it was going to annoy the crap out of me.
Test Plan: See the comma. :)
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4365
Summary: We want to use TYPE_DIFF_DIDBUILDMESSAGE to abort arc diff when a message doesn't fit some
Test Plan: Created an EventListener subscribed to TYPE_DIFF_DIDBUILDMESSAGE, validated the 'message' field was filled in
Reviewers: vrana, epriestley
Reviewed By: epriestley
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D4361
Summary: This fix lets you run arc lint from any directory in the repository
Test Plan: Ran arc lint from any directory
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4356
Summary:
Currently, this spawns 125 concurrent processes on my machine, which overflows some limit and gives me an error:
PHP Warning: proc_open(): unable to create pipe Too many open files in /INSECURE/devtools/libphutil/src/future/exec/ExecFuture.php on line 491
Instead, limit parallelism to 16. The runtime is approximately the same for me, and dominated by other concerns (conduit calls).
Test Plan: Ran `arc branch` successfully. Ran `arc branch --trace`, observed behavior.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D4336
Summary:
Lints cpp code using the cppcheck static linter. This linter needs to
be downloaded and built from http://cppcheck.sourceforge.net/
Test Plan: Used it on a few files.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4353
Summary: Adds arc lint support for cpp files with Google's cpplint.py lint checking.
Test Plan: ran it on some cpp files. Added unit tests
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4344
Summary: see title
Test Plan: ran arc install-certificate <uri> in a directory without an .arcconfig and it worked! ran arc install-certificate in a directory with an .arcconfig and it worked! ran arc install-certificate <uri> in a directory with an .arcconfig and noted it correctly overrode the .arcconfig
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Maniphest Tasks: T2251
Differential Revision: https://secure.phabricator.com/D4332
Summary:
I type "arc brnach" about 300 times per day.
- Allow arc commands to be specified by unique prefix ("exp" for "export", "lib" for "liberate").
- Allow arc commands to be specified by unique levenshtein edit distance <= 2 ("brnach" for "branch", "halp" for "help", "ptach" for "patch").
- Reorganize code out of "arcanist.php".
I think this will be uncontentious because arc commands are rarely destructive, but if people complain we can either require certain commands be typed exactly (maybe "land"?) or allow this feature to be disabled in configuration.
Test Plan:
$ arc br
Usage Exception: Unknown command 'br'. Try 'arc help'.
Did you mean:
branch
browse
$ arc brnachh
Usage Exception: Unknown command 'brnachh'. Try 'arc help'.
$ arc brnach
(Assuming 'brnach' is the British spelling of 'branch'.)
doc-security No Revision security
sms Needs Revision D319: Add SMS support to Phabricator
phxtag No Revision derp
arantag No Revision derp
...
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D4305
Summary: flake8 is the better maintained combination of pep8 and pyflakes
Test Plan: There's a test!
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, jack
Differential Revision: https://secure.phabricator.com/D4082
Summary:
Fixes T2138.
- When a pull fails, restore the original branch.
- When a push fails, complain about it really loudly.
NOTE: No test plan for push yet since I'm not sure this is the right remedy, see T2138 for discsusion.
Test Plan:
- Tested pull by changing "git pull" to "git xxpull" and running "arc land". Saw the pull fail and my original branch restored.
Reviewers: vrana, aran
Reviewed By: vrana
Maniphest Tasks: T2138
Differential Revision: https://secure.phabricator.com/D4265
Summary: If you are explicit then there is no need to ask you.
Test Plan:
$ touch a
$ arc diff
$ arc diff a
$ arc diff existing
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4186
Summary:
Recently, in D4097 or one of the precursors I refactored this. However, when $rev is null parseBaseCommitArgument() throws ("This VCS does not support commit ranges."). Shield the call so it only happens if if $rev is nonempty (we still want to make the call, so "arc lint --rev x" on SVN will throw and inform the user that "--rev" is incorrect usage).
(@vrana, this was reported by FB and might be worth pushing.)
Test Plan: Ran "arc diff --preview <path>". Grepped for other parseBaseCommitArgument() callsites and verified they don't have similar issues.
Reviewers: vrana, btrahan, chad
Reviewed By: chad
CC: aran
Differential Revision: https://secure.phabricator.com/D4241
Summary: I don't know how to not be strict here plus we (Arcanist developers) don't have access to user's error log.
Test Plan:
Undeclared `ArcanistDiffWorkflow::$console`, then:
$ arc diff
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3607
Summary:
The main added value is loading the branch name from revision.
Sometimes I know the revision ID but I don't know the branch name.
The missing piece is the starting point of the branch.
I was thinking about using `arc.land.onto.default` but we also need to get 'origin'.
This is also the last step of a simple workflow where underlying VCS is not abstracted away.
In future, we can implement this for other APIs.
Test Plan:
$ arc branch new_branch
$ arc branch new_branch
$ arc branch D4168
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4170
Summary:
Currently, if you run `arc` in arcanist/ or libphutil/ and your PATH and on-disk configuration are set up so a different version of arc or libphutil are the ones that actually load, we fail with an exception like "running arcanist in a different copy of arcanist is not supported".
This causes problems for Harbormaster, since we'd like to be able to run 'arc' in a copy of libphutil/ and have it execute unit tests for that copy rather than failing abruptly. So, if we detect that we're in arcanist/ or libphutil/, execute 'arc' again with the same arguments but force it to load the working copy in place of either the 'arcanist/' or the 'libphutil/' that it decided to load.
This is pretty much horrible black magic.
Test Plan: Ran 'arc list --trace' inside copies of libphutil/ and arcanist/ outside of the normal include chain. Saw it detect these, emit a message, and re-execute itself correctly.
Reviewers: btrahan, vrana
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1049
Differential Revision: https://secure.phabricator.com/D4225
Summary: After D4191 this is a fatal.
Test Plan: Created this revision.
Reviewers: vrana, btrahan
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D4219
Summary: Adds "arc unit --everything", which runs every available test, provided the test engine supports it. Also add JSON output.
Test Plan: Ran `arc unit --everything` in arcanist/, libphutil/ and phabricator/. Saw all tests run.
Reviewers: btrahan, vrana
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2065
Differential Revision: https://secure.phabricator.com/D4214