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: D1439 added a new class which had the wrong name in the map from D1439.
Whoopsiepoos!
Test Plan: unit tests now pass
Reviewers: epriestley, zeeg
Reviewed By: epriestley
CC: aran
Differential Revision: https://secure.phabricator.com/D1441
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
Summary:
Inspired by http://news.ycombinator.com/item?id=3464671 and a lot of
diffs I've seen @ FB, I've added a spell checking linter. To reduce
false positives, it's only a blacklist. Still, it catches a large
number of 'issues'.
Test Plan:
Unit tests. Ran on FB's codebase. No false positives
noticed but a lot of cases caught.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, epriestley, jack
Differential Revision: https://secure.phabricator.com/D1409
Summary:
Extended the install-certificate workflow's timeout from 5
seconds to rely on the ConduitClient default (30 seconds), which matches the HTTP interface.
Test Plan: Run arc install-certificate
Reviewers: epriestley
CC: epriestley, aran
Differential Revision: https://secure.phabricator.com/D1404
This patch adds ArcanistJSHintLinter class and three new .arcconfig options:
* lint.jshint.prefix - directory where JSHint binary resides
* lint.jshint.bin - JSHint binary name (if different from 'jshint')
* lint.jshint.config - a JSON file with JSHint project-wide options
By default, this linter assumes that JSHint is installed on user's system
as an NPM package.
Test Plan:
(1)
Run `npm install jshint -g` to install JSHint and add
ArcanistJSHintLinter to your Lint Engine (I didn't see PEP8 or
PyFlakes in the PhutilLintEngine so I decided to not to put
JSHint in there). After that you can do `arc lint my.js`.
(2)
Create a new file, config.json, and add `{ "white": true }` in it.
Add `"lint.jshint.config": "/path/to/config.json"` to your .arcconfig and
run `arc lint my.js`. After that, unless your name is Douglas Crockford,
you'll see tons of JSHint warnings about minor PEP8-like things (spacing, etc.)
Summary:
Currently, we throw a fairly perplexing error when there are multiple valid
commit messages. Installs can also remove the "test plan" field entirely, which
is the only really strong discriminator here.
When the message to use is ambiguous, show the user all the valid messages and
prompt them to choose one.
Also add a -C flag like "git commit -C", so they can choose a message
explicitly.
Test Plan: Ran "arc diff HEAD^^^^^", "arc diff -C <rev>".
Reviewers: cpiro, btrahan, jungejason
Reviewed By: cpiro
CC: aran, cpiro
Differential Revision: https://secure.phabricator.com/D1385
Summary:
See T762. Currently, some externals functions (recaptcha, xhprof) raise errors
and prevent clean runs of "arc liberate" without --force-update or a forced
cache.
Allow such symbols to be declared:
/**
* @phutil-external-symbol function some_function
*/
This prevents them from being treated as dependencies.
Test Plan: Ran "arc liberate src/ --all" on Phabricator, fixed all the warnings
by adding @phutil-external-symbol declarations.
Reviewers: btrahan, jungejason
Reviewed By: jungejason
CC: aran, jungejason
Maniphest Tasks: T762
Differential Revision: https://secure.phabricator.com/D1381
Summary:
If the else clause does not have braces (one-liner), XHPASTLinter eats the
newline and brings the body statement of the else clause to the same line.
Test Plan: added a new test to space-after-control-keywords.lint-test
Reviewers: epriestley
CC: aran, epriestley, kiyoto
Differential Revision: https://secure.phabricator.com/D1367
revision is the correct base revision relative to the patch.
Summary: What the title says. If not correct, warn the user. This check
honors the --force flag to skip all these checks. This change also includes
moving some Differential constants into Arc so they can be used for both
projects. There is a corresponding phabricator diff (incoming) to address this
part of the change.
Test Plan:
For a project with actual diffs, a git repository tracked by phabricator, *AND*
development in master branch only, do some...
- git reset --hard HEAD^1
- arc patch DX, where X is what got us to HEAD in the first place
- verify successful patch
...then...
- git reset --hard HEAD^^
- arc patch DX, where X is what got us to HEAD in the first place
- verify warning
- verify Y versus N continues versus stops appropriately
Note if development were done outside the master branch this warning message
will fire early / often as git commit hashes are based on the commit *and* the
rest of the source code the commit is made against. This is (unfortunately) the
"typical" case so this warning is pretty active at the moment. T201 will
eventually land and when parsing a given commit update the corresponding diff.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, btrahan, epriestley
Differential Revision: https://secure.phabricator.com/D1328
Summary: See T645. These commands take inconsistent and overly-magical arguments
right now. Instead, make them behave consistently and allow them both to operate
on "arc <workflow> path path2 path3 ...", which is a generally useful workflow.
Test Plan: Ran "arc lint <path>", "arc unit <path>", "arc lint --rev
HEAD^^^^^^", "arc unit --rev HEAD^^^^^^^^^^^^", etc. Ran "arc diff --trace" and
verified --rev argument to child workflows.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, epriestley, btrahan
Maniphest Tasks: T645
Differential Revision: https://secure.phabricator.com/D1348