Summary:
This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory).
We are removing the headers for these reasons:
- It wastes space in editors, less code is visible in editor upon opening a file.
- It brings noise to diff of the first change of any file every year.
- It confuses Git file copy detection when creating small files.
- We don't have an explicit license header in other files (JS, CSS, images, documentation).
- Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new.
This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook).
Test Plan: Verified that the license survived only in unit tests and LICENSE file.
Reviewers: epriestley, btrahan, edward
Reviewed By: epriestley
CC: aran, Korvin, davidrecordon
Maniphest Tasks: T2035
Differential Revision: https://secure.phabricator.com/D3881
Summary: This is sort of documentation.
Test Plan:
Used the plugin for Notepad++ with default indent of 4 spaces.
Opened file from `src/`, verified that it indents 2 spaces.
Opened file from `externals/`, verified that it indents 4 spaces.
Reviewers: epriestley, btrahan
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3865
Summary: fix for T2011, first option in list of possible fixes
Test Plan: ...do I really have to setup mercurial with mq? :D
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Maniphest Tasks: T2011
Differential Revision: https://secure.phabricator.com/D3869
Summary: I broke this in D3750. Calling `getRepositoryAPI()` triggers a check for workflow requirement of the repository API. Instead, we should just check if we alreayd have one.
Test Plan: Ran `cat x | arc diff --raw`.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T1998
Differential Revision: https://secure.phabricator.com/D3848
Summary: turns out retina has files like image.png and image@2x.png. The latter breaks since '@' is a special command telling svn to "look for image at revision 2x.png" -- nonsensical garbage. If we add it to the end every time this error goes way.
Test Plan: touch 2@2.png; svn add '2@2@'; arc diff; <fill out form, accept commit>; arc commit -- observe commit working
Reviewers: epriestley
Reviewed By: epriestley
CC: mbishopim3, aran, Korvin
Maniphest Tasks: T1999
Differential Revision: https://secure.phabricator.com/D3845
Summary:
If you type `arc`, you currently get a fatal since $config isn't defined. Don't try to run the hook if we never built a config.
(We could build the config earlier and then run the hook anyway, but $workflow and $command would not be defined. It seems unlikely that executing the hook here is useful, since it affects only the case that the user types `arc` on its own.)
Test Plan: Typed `arc`. Typed `arc diff`, etc.
Reviewers: vrana, btrahan
Reviewed By: vrana
CC: aran
Differential Revision: https://secure.phabricator.com/D3841
Summary:
D3748 attempted to improve the behavior of `arc diff` when dealing with files merged from another branch, but had the side effect of marking all normal edits and deletes as adds. Revert this side effect, at least. This likely degrades the merging case, but it's comparatively rare, and editing/deleting files is very common.
I'll make an effort to fix this properly (and back it with DirectoryFixture tests) when I deal with T1947.
Test Plan: Ran `arc diff --preview` for a change that edits or removes files.
Reviewers: btrahan, vrana, svemir
Reviewed By: svemir
CC: aran
Differential Revision: https://secure.phabricator.com/D3836
Summary:
Some users assume they can update anything, not just revisions they own (see https://github.com/facebook/arcanist/issues/54).
Currently, if you `arc patch` or `arc amend` and get a commit message, then `arc diff` for a revision you don't own, we:
- Fail early with a very confusing message ("You can not review a revision you own!") if you are on the "Reviewers" line, until D3820.
- Or fail very very late with a good error message, but after lint, unit and update messages.
Instead, check that you own the revision as early as we can.
Test Plan: Tried to update revisions I didn't own, got good error messages early on (with D3820).
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D3821
Summary:
See T1973. In T1675, we addressed parsing of diffs with `--no-prefix` or custom `--src-prefix` and `--dst-prefix` flags. However, this inadvetently broke diffing of files with spaces in their names, which Git does not quote. They look like this normally:
diff --git a/old file b/new file
Prior to D3744, we accidentally got this right by looking for the `a/` and `b/`. However, we no longer do, and instead produce nonsense results.
This problem is difficult because for files with spaces, `git diff --no-prefix` may generate an ambiguous line like:
diff --git a b c d e f g
From this line, we have no way to deterine if this moves "a" to "b c d e f g", or "a b c d" to "e f g", or anything in between. In some diffs we have more information later on, but in some cases we do not, e.g. for binary diffs without `--binary`.
Try to get this right in as many cases as possible:
- If there are quotes, we can unambiguously get it right. This only happens for filenames with quotes or unicode characters, however.
- If there is exactly one space, we can unambiguously get it right.
- Interpret the common case of `a/<anything> b/<anything>` in the most-likely-correct way again.
- Interpret the rare case of `<anything> <that same thing>` in the most-likely-correct way.
- Complain about any `a b c d e f g` garbage.
Test Plan: Ran unit tests. Created a diff of a file called "File With Spaces".
Reviewers: vrana, btrahan
Reviewed By: btrahan
CC: aran, ReturnZero
Maniphest Tasks: T1973
Differential Revision: https://secure.phabricator.com/D3818
Summary: This is a BC break but it was introduced recently.
Test Plan:
$ arc unit x
No more:
> Fatal error: Argument 2 passed to ArcanistConfiguration::didAbortWorkflow() must be an instance of ArcanistBaseWorkflow, null given
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3812
Test Plan: Made lint error, slept in test, verified that tests are finished when I confirm `arc diff --excuse`.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3803
Summary: This diff obsoletes D3385.
Test Plan: Made lint error, explained it, verified that unit already finished before I finished explaining (by adding `sleep(3)` to test).
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3786
Summary:
We start Sandcastle push when `arc diff` starts.
If `arc diff` throws then HHVM waits for finishing the futures.
We need to kill them sooner.
Test Plan: Will implement the hook.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3713
Summary: Currently, a shutdown exception ("script exited with open transactions!") overwhelms the actual test failure exception, which is the one that needs to be fixed.
Test Plan: Ran a fixture test which opens a transaction and then throws. Got diagnostically useful output after this patch.
Reviewers: vrana, btrahan
Reviewed By: vrana
CC: aran
Differential Revision: https://secure.phabricator.com/D3780
Summary: We need to tweak a few patterns to accommodate the possibility that lines end in "\r\n".
Test Plan: Added failing unit test and made it pass.
Reviewers: vrana, btrahan
Reviewed By: vrana
CC: aran, mbishopim3
Maniphest Tasks: T1944
Differential Revision: https://secure.phabricator.com/D3772
Summary: The way we represent some move/copy stuff is a bit messed up, but it mostly works, so add coverage before I mess with it.
Test Plan: Ran unit tests.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T866
Differential Revision: https://secure.phabricator.com/D3752
Summary:
We have coverage for generating patches, applying them, and making sure they reproduce the original repository state. However:
- The code uses simplified patch generation which omits some flags like `-M` and `-C`, and generally produces less rich patches than we really produce. Instead, produce patches the same way `arc diff` does.
- We don't test the intermediate change representation. In theory it's not too important because if we get it wrong the output should be wrong, but in practice it makes it easier to nail down issues. We can also generate less-rich patches which still apply correctly, but would prefer not to.
- Similarly, we don't test the intermediate patch representation. This is almost entirely redundant with simply applying the patch, but easier to visualize.
Add coverage for all that stuff and fix some bugs with `-M` / `-C` patch generation that weren't caught under the simpler patch generation.
Test Plan: Ran unit tests.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T866
Differential Revision: https://secure.phabricator.com/D3751
Summary: Make this harder to get wrong. Instead of requiring a separate call for synthetic data, automatically load it if we can.
Test Plan: Unit tests; `arc diff`.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T866
Differential Revision: https://secure.phabricator.com/D3750
Summary: This information may be quite useful.
Test Plan: Threw exception from license linter.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3764
Summary:
This code is much more readable to me.
It should also be faster as building the array at once should be faster than one by one.
Test Plan: Made license and XHPAST errors in PHP file, made spelling error in JS file.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3758
Summary:
- I caused $parser to be reused in D3732 which I belived was safe, but actually isn't. We end up writing to the same changes. We should make it safe but there's some mess in Phabricator that needs to be cleaned up first.
- One minor error code thing, variable is undefined.
Test Plan: Ran `arc export --git` on a moved file, got a better result. Ran some command which made me hit the other case and didn't get a fatal anymore.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran
Differential Revision: https://secure.phabricator.com/D3749
Summary:
Currently, ArcanisSingleLintEngine lints deleted paths and directories. These are sometimes appropriate, but SingleLintEngine is a less-sophisticated linter and should have more safe defaults.
Also fix an error where JSHint reported useless messages on failure.
Test Plan:
Reproduced the problem:
$ git show
commit d71efe2b13770c8861bcd3415c15503fc377339f
Author: epriestley <git@epriestley.com>
Date: Fri Oct 19 12:22:50 2012 -0700
WIP
diff --git a/test.js b/test.js
deleted file mode 100644
index 8bd6648..0000000
--- a/test.js
+++ /dev/null
@@ -1 +0,0 @@
-asdf
$ arc set-config --local lint.engine.single.linter ArcanistJSHintLinter
Set key 'lint.engine.single.linter' = "ArcanistJSHintLinter" in local config (was null).
$ arc lint --engine ArcanistSingleLintEngine --rev HEAD^
Usage Exception: JSHint returned output we can't parse. Check that your JSHint installation.
Output:
Applied the error message fix:
$ arc lint --engine ArcanistSingleLintEngine --rev HEAD^
Usage Exception: JSHint returned unparseable output.
stdout:
stderr:
node.js:181
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ENOENT, No such file or directory '/INSECURE/repos/git-working-copy/test.js'
at Object.statSync (fs.js:400:18)
at _collect (/usr/lib/node_modules/jshint/lib/hint.js:77:12)
at /usr/lib/node_modules/jshint/lib/hint.js:93:13
at Array.forEach (native)
at Object.hint (/usr/lib/node_modules/jshint/lib/hint.js:92:17)
at Object.interpret (/usr/lib/node_modules/jshint/lib/cli.js:137:21)
at Object.<anonymous> (/usr/lib/node_modules/jshint/bin/hint:2:25)
at Module._compile (module.js:420:26)
at Object..js (module.js:426:10)
at Module.load (module.js:336:31)
Applied the remove paths fix:
$ arc lint --engine ArcanistSingleLintEngine --rev HEAD^
Usage Exception: No paths are lintable.
Reviewers: magazovski, btrahan, vrana
Reviewed By: btrahan
CC: aran, Korvin, vissi
Differential Revision: https://secure.phabricator.com/D3735
Summary:
When some linter throws then we don't print any result.
This is bad in case when the linter threw e.g. because of syntax error in some file which some other linter will tell us about.
Test Plan: Threw from a linter, made lint error in a file, saw error then exception.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3756
Summary:
After a reintegration merge, "Copied From URL" will be different and current approach will result in a wrong path. If the path does not match, just mark it as a new file.
moved the comment before if so lines stay at 80 chars
Test Plan: in trunk, svn merge --reintegrate ^/branches/foo and arc diff - without this change it will say "Copied from es/foo/..."
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3748
Summary: See T1675 for discussion. We currently strip `[abicwo12]/` from Git patches, but the user can provide arbitrary prefixes with `--src-prefix` and `--dst-prefix`, or strip prefixes entirely with `--no-prefix`. In these cases, trust they know what they're doing rather than rejecting the diff.
Test Plan: Added a bunch of tests. We have existing tests for `diff.mnemonicprefix` and normal prefixes.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T1675
Differential Revision: https://secure.phabricator.com/D3744
Summary:
This is horrible and git specific, but fixes a case where people are using "arc
patch --nobranch ..." when they're not currently on a branch.
The old code assumed you were on a branch and used getBranchName() to record
this, in order to return to that branch later and cherry-pick the patch.
When not on a branch, and using arc patch --nobranch, this was trying to return
to the branch '(no branch)'.
Now, I detect that we're not on a branch and just record what HEAD is instead.
Test Plan:
Checkout the SHA of master (so I'm on master, but not on a branch) then try to
patch it with a feature diff:
€ git checkout e7a3ec68159d6847372cab5ad913f2f15aa7c249
Warning: you are leaving 1 commit behind, not connected to
any of your branches:
ac1ad39 Updating a-file
If you want to keep them by creating a new branch, this may be a good time
to do so with:
git branch new_branch_name ac1ad392350a51edd10343f12b9713f5e5b3707c
HEAD is now at e7a3ec6... Fix arcconfig
€ arc patch --nobranch D7
Created and checked out branch arcpatch-D7.
OKAY Successfully committed patch.
€ git branch
* (no branch)
feature
haddock
master
€ git log --oneline | head -2
38c0235 Updating a-file
e7a3ec6 Fix arcconfig
Reviewers: vrana, epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3743
Summary: This also changes how we treat `@generated` and `@nolint` - after this diff, we will still lint their path.
Test Plan:
Created directory `a.php` and symlink `b.php` pointing to directory.
`arc lint` previously printed:
> Requested path `/data/users/jakubv/devtools/arcanist/_.php' is not a file.
Now it prints:
> No lint warnings.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3737
Summary:
We need to run new Arcanist over old code in Perflab.
We also need to run new Arcanist over new code (with already deleted custom `buildAllWorkflows()`).
This will work because old code overwrites `buildAllWorkflows()`.
Test Plan:
$ arc help
$ arc help # after deleting getWorkflowName() from one workflow
Reviewers: edward, epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3741
Summary:
Currently, adding a new workflow requires you to override ArcanistConfiguration, which is messy. Instead, just load everything that extends ArcanistBaseWorkflow.
Remove all the rules tying workflow names to class names through arcane incantations.
This has a very small performance cost in that we need to load every Workflow class every time now, but we don't hit __init__ and such anymore and it was pretty negligible on my machine (98ms vs 104ms or something).
Test Plan: Ran "arc help", "arc which", "arc diff", etc.
Reviewers: edward, vrana, btrahan
Reviewed By: edward
CC: aran, zeeg
Differential Revision: https://secure.phabricator.com/D3691
Summary:
This changes what --nobranch does, though not what it means. In git, the patch
is applied to the git commit it is based off where it will commit cleanly, and
if you specify --nobranch then arc-patch will then switch back to your original
branch and try to cherry-pick the commit there.
If this fails, you end up with merge-conflict markers in the file which can be
handy.
Test Plan: https://secure.phabricator.com/P572
Reviewers: epriestley, btrahan
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3712
Summary:
We currently pull message from Conduit twice in `arc diff` update.
Once in `buildCommitMessage()` and once in `buildRevisionFromCommitMessage()`.
Remeber that we already pulled it (and so it is authoritative) to save this call.
Even faster solution would be to not pull and update the message at all in common (non-`--edit`, non-`--verbatim` and such) update workflows but it's more involved.
Test Plan:
$ arc diff --trace
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3716
Summary: We want to use them in event.
Test Plan: Will use it in event.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3690
Summary:
I was thinking about creating a method `differential.setdiffproperties` updating all properties at once or adding 'properties' to `differential.creatediff` (better) but it will require bumping Conduit version.
This looks simpler and with similar effect.
We could postpone resolving properties more but I don't want to risk not resolving them after an error.
Test Plan:
This diff for that it works.
Benchmark: 0.55 s before, 0.25 s after (with three properties, the difference will be bigger with more).
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3689
Summary:
The 'review its own revision' check is now handled by Differential (bug T1879)
Previous behavior:
arc threw an "You can not be a reviewer for your own revision." exception
if an users adds itself as reviewer, even when this configuration is
allowed on the Differential remote install's configuration.
New behavior:
Arc doesn't check that anymore. It still will be checked by the server.
Test Plan: Tested locally pushing revisions with "arc diff" to a Phabricator server with differential.allow-self-accept at true or false with myself or not as reviewer.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Maniphest Tasks: T1879
Differential Revision: https://secure.phabricator.com/D3674
Test Plan: A lot of spew before. Not so much now.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3681