]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
14 years agoThrow a helpful message when users run "arc diff --raw --update".
epriestley [Tue, 20 Mar 2012 02:15:58 +0000 (19:15 -0700)]
Throw a helpful message when users run "arc diff --raw --update".

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

14 years agoIn "arc patch", use "cat-file -t" instead of "rev-parse --verify" to check for commits.
epriestley [Tue, 20 Mar 2012 02:11:52 +0000 (19:11 -0700)]
In "arc patch", use "cat-file -t" instead of "rev-parse --verify" to check for commits.

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

14 years agoAdd an arc.bat file for Arcanist
epriestley [Mon, 19 Mar 2012 02:42:53 +0000 (19:42 -0700)]
Add an arc.bat file for Arcanist

Summary: Allow Windows users to type "arc" with appropriate env config.

Test Plan: Typed "arc", got arc.

Reviewers: Makinde, btrahan, Koolvin, jungejason

Reviewed By: jungejason

CC: aran, epriestley
Maniphest Tasks: T124

Differential Revision: https://secure.phabricator.com/D1937

14 years agoDon't fatal without Conduit for "--patch" and "--bundle"
epriestley [Fri, 16 Mar 2012 20:40:33 +0000 (13:40 -0700)]
Don't fatal without Conduit for "--patch" and "--bundle"

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

14 years agoFix an issue with unified patch generation for terminal newline changes
epriestley [Fri, 16 Mar 2012 20:40:11 +0000 (13:40 -0700)]
Fix an issue with unified patch generation for terminal newline changes

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

14 years agoRemove debugging print from a test case
Nick Harper [Thu, 15 Mar 2012 02:49:16 +0000 (19:49 -0700)]
Remove debugging print from a test case

Test Plan: reran the test

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1906

14 years agoRespect custom set encoding in patch/export workflows
David Reuss [Wed, 14 Mar 2012 14:08:06 +0000 (07:08 -0700)]
Respect custom set encoding in patch/export workflows

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

14 years agoStrip colorized diffs, show line numbers in context
epriestley [Wed, 14 Mar 2012 13:34:00 +0000 (06:34 -0700)]
Strip colorized diffs, show line numbers in context

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

14 years ago[svn1.7] handle removed directories in svn in arc diff
Nick Harper [Wed, 14 Mar 2012 06:42:05 +0000 (23:42 -0700)]
[svn1.7] handle removed directories in svn in arc diff

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

14 years ago[svn1.7] Handle changes to svn properties in svn1.7 working copies
Nick Harper [Tue, 13 Mar 2012 23:05:57 +0000 (16:05 -0700)]
[svn1.7] Handle changes to svn properties in svn1.7 working copies

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

14 years agoAdd a check to 'arc liberate' for loose .php files in the library root
epriestley [Tue, 13 Mar 2012 18:17:28 +0000 (11:17 -0700)]
Add a check to 'arc liberate' for loose .php files in the library root

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

14 years ago[svn1.7] treat nonpositive rev numbers as added files
Nick Harper [Mon, 12 Mar 2012 23:18:44 +0000 (16:18 -0700)]
[svn1.7] treat nonpositive rev numbers as added files

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

14 years agoAdd a test case to make sure prefix/suffix intraline diffs work correctly
epriestley [Tue, 13 Mar 2012 01:21:44 +0000 (18:21 -0700)]
Add a test case to make sure prefix/suffix intraline diffs work correctly

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

14 years agoDon't show "not executable" for files with no coverage information
epriestley [Tue, 13 Mar 2012 00:04:51 +0000 (17:04 -0700)]
Don't show "not executable" for files with no coverage information

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

14 years agoImprove "arc cover" parameters
epriestley [Tue, 13 Mar 2012 00:04:20 +0000 (17:04 -0700)]
Improve "arc cover" parameters

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

14 years agoArcanistRepositoryAPI: add getCanonicalRevisionName
Edward Speyer [Fri, 9 Mar 2012 22:40:47 +0000 (14:40 -0800)]
ArcanistRepositoryAPI: add getCanonicalRevisionName

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

14 years agoDon't record anonymous functions into the symbol map
epriestley [Fri, 9 Mar 2012 23:45:47 +0000 (15:45 -0800)]
Don't record anonymous functions into the symbol map

Summary:
Although we currently forbid anonymous functions, some day we will likely permit them, and our behavior for them is wrong.

Handle them correctly rather than throwing an exception because we should be covered by D1846 against accidental use, and we won't be on PHP 5.2 forever.

Test Plan: Ran against a test file with anonymous functions. Before, it emitted a declaration of a nameless function; afterward, it did not.

Reviewers: btrahan, edward

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T963

Differential Revision: https://secure.phabricator.com/D1847

14 years agoImprove arc support for svn 1.7
Nick Harper [Fri, 9 Mar 2012 21:37:48 +0000 (13:37 -0800)]
Improve arc support for svn 1.7

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

14 years agoRaise a lint error when code uses a PHP 5.3 feature in Phabricator
epriestley [Fri, 9 Mar 2012 21:51:02 +0000 (13:51 -0800)]
Raise a lint error when code uses a PHP 5.3 feature in Phabricator

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

14 years agoMake lint output look like a compiler
Edward Speyer [Wed, 29 Jun 2011 01:14:07 +0000 (18:14 -0700)]
Make lint output look like a compiler

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

14 years ago[arcanist] respect severity disabled in PEP8 linter
Nick Harper [Fri, 9 Mar 2012 05:22:36 +0000 (21:22 -0800)]
[arcanist] respect severity disabled in PEP8 linter

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

14 years agoRemove chooseRevision() and DifferentialRevisionRef
epriestley [Fri, 9 Mar 2012 16:57:24 +0000 (08:57 -0800)]
Remove chooseRevision() and DifferentialRevisionRef

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

14 years agoFix another "arc patch" authentication issue
epriestley [Fri, 9 Mar 2012 16:57:18 +0000 (08:57 -0800)]
Fix another "arc patch" authentication issue

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

14 years agoFix implicit fallthrough in arc
epriestley [Fri, 9 Mar 2012 16:57:03 +0000 (08:57 -0800)]
Fix implicit fallthrough in arc

Summary: Raised by new linter.

Test Plan: Lint/inspection.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1831

14 years ago[ArcanistPhutilTestCase] add ->assertException() to the base test case
Edward Speyer [Thu, 8 Mar 2012 22:54:49 +0000 (14:54 -0800)]
[ArcanistPhutilTestCase] add ->assertException() to the base test case

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

14 years agoImprove performance of XHPASTLinter
epriestley [Thu, 8 Mar 2012 20:20:46 +0000 (12:20 -0800)]
Improve performance of XHPASTLinter

Summary:
  - XHPASTLinter + coverage is ass-slow.
  - Use caching/perf options introduced by D1828.

Test Plan:
  - Ran profiling for unit tests with new --xprofile command line flag.
  - Old profile: https://secure.phabricator.com/xhprof/profile/PHID-FILE-uiuwsqa5wulj7eyfkjy2/
  - New profile: https://secure.phabricator.com/xhprof/profile/PHID-FILE-nl635t3jcp2sfo2spzwu/
  - Overall runtime decreased from 18.2s to 3.7s (4.9x performance increase) with coverage enabled.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1829

14 years agoUse PhutilArgumentParser for some argument parsing in Arcanist
epriestley [Thu, 8 Mar 2012 20:20:26 +0000 (12:20 -0800)]
Use PhutilArgumentParser for some argument parsing in Arcanist

Summary:
Instead of doing custom parsing for --trace and --no-ansi, use builtin parsing.

This also gives us access to xprofile.

I eventually want to fully switch over, but that'll take some work.

Test Plan: Ran `arc list --trace`, `arc list --no-ansi`, etc.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1827

14 years agoAdd a lint warning for implicit fallthrough in switch statements
epriestley [Thu, 8 Mar 2012 20:20:19 +0000 (12:20 -0800)]
Add a lint warning for implicit fallthrough in switch statements

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

14 years agoWhen a file doesn't begin "<?php", raise one warning, not one for each line
epriestley [Thu, 8 Mar 2012 01:52:46 +0000 (17:52 -0800)]
When a file doesn't begin "<?php", raise one warning, not one for each line

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

14 years agoFix arc diff / arc patch to handle files with missing trailing newlines properly
epriestley [Wed, 7 Mar 2012 21:19:58 +0000 (13:19 -0800)]
Fix arc diff / arc patch to handle files with missing trailing newlines properly

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

14 years agoArc patch - upgrade "same base rev" check to "does this commit exist in the working...
Bob Trahan [Wed, 7 Mar 2012 21:02:53 +0000 (13:02 -0800)]
Arc patch - upgrade "same base rev" check to "does this commit exist in the working copy?" check

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

14 years agoCatch "ConduitClientException", not "Exception", in "arc patch"
epriestley [Wed, 7 Mar 2012 04:14:34 +0000 (20:14 -0800)]
Catch "ConduitClientException", not "Exception", in "arc patch"

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

14 years agoImprove ArcanistMercurialParser's handling of unusual branch names
epriestley [Wed, 7 Mar 2012 04:14:25 +0000 (20:14 -0800)]
Improve ArcanistMercurialParser's handling of unusual branch names

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

14 years agoFix escaping of "git log ---format" command on Windows
epriestley [Mon, 5 Mar 2012 21:22:41 +0000 (13:22 -0800)]
Fix escaping of "git log ---format" command on Windows

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

14 years agoMake git repo discovery work on Windows
epriestley [Mon, 5 Mar 2012 21:22:04 +0000 (13:22 -0800)]
Make git repo discovery work on Windows

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

14 years agoSimplify `arc help`, add `arc help --full`
vrana [Sun, 4 Mar 2012 11:16:45 +0000 (03:16 -0800)]
Simplify `arc help`, add `arc help --full`

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

14 years agoMake "arc diff --raw -C HEAD" work correctly
epriestley [Mon, 5 Mar 2012 18:08:50 +0000 (10:08 -0800)]
Make "arc diff --raw -C HEAD" work correctly

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

14 years agoRaise a better error from PhutilUnitTestEngine when trying to use one copy of libphut...
epriestley [Mon, 5 Mar 2012 18:03:13 +0000 (10:03 -0800)]
Raise a better error from PhutilUnitTestEngine when trying to use one copy of libphutil to test another copy

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

14 years agoImprove arc compatibility on Windows
epriestley [Mon, 5 Mar 2012 18:02:37 +0000 (10:02 -0800)]
Improve arc compatibility on Windows

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

14 years agoWarn about wrong ID in `arc download D8O88`
vrana [Sun, 4 Mar 2012 07:55:50 +0000 (23:55 -0800)]
Warn about wrong ID in `arc download D8O88`

Summary: It also disables `arc download F7312-rainbow`.

Test Plan:
  arc download D8O88
  arc download F7312-rainbow
  arc download F7312

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1768

14 years agoEnable shell completion without set aliases
vrana [Sun, 4 Mar 2012 07:26:16 +0000 (23:26 -0800)]
Enable shell completion without set aliases

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

14 years agoUse execxLocal() for ArcanistGitAPI
epriestley [Sat, 3 Mar 2012 00:47:34 +0000 (16:47 -0800)]
Use execxLocal() for ArcanistGitAPI

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

14 years agoAdd "--revision <id>" flag to "arc land"
epriestley [Sat, 3 Mar 2012 00:47:05 +0000 (16:47 -0800)]
Add "--revision <id>" flag to "arc land"

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

14 years agoAllow disabling the part where you write an excuse
Andrey Sukhachev [Thu, 1 Mar 2012 00:30:17 +0000 (16:30 -0800)]
Allow disabling the part where you write an excuse

Summary:
Not everyone thinks it's a great feature

Task ID: #

Blame Rev:

Test Plan:
arc diff --skip-excuses

Revert Plan:

Tags:

Reviewers: akramer, epriestley, ide, mroch

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1735

14 years agoFix "arc lint" when HEAD has been reverted in the working copy
epriestley [Wed, 29 Feb 2012 20:18:46 +0000 (12:18 -0800)]
Fix "arc lint" when HEAD has been reverted in the working copy

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

14 years agoUse string operations, not idx(), for string indexing.
epriestley [Wed, 29 Feb 2012 16:39:25 +0000 (08:39 -0800)]
Use string operations, not idx(), for string indexing.

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

14 years agoPre-fill template fields under "arc diff --create" in git
epriestley [Wed, 29 Feb 2012 01:00:35 +0000 (17:00 -0800)]
Pre-fill template fields under "arc diff --create" in git

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

14 years agoPrefill template update message in Mercurial during --update
epriestley [Wed, 29 Feb 2012 00:59:40 +0000 (16:59 -0800)]
Prefill template update message in Mercurial during --update

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

14 years agoUse HGPLAIN when executing mercurial commands
epriestley [Wed, 29 Feb 2012 00:56:57 +0000 (16:56 -0800)]
Use HGPLAIN when executing mercurial commands

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

14 years agoPatch rendering fixes
Andrew Gallagher [Tue, 28 Feb 2012 04:04:43 +0000 (20:04 -0800)]
Patch rendering fixes

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

14 years agoMissing space in lint message
vrana [Tue, 28 Feb 2012 02:06:36 +0000 (18:06 -0800)]
Missing space in lint message

Test Plan: arc lint

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1711

14 years agoMerge branch 'master' of github.com:facebook/arcanist into arc_excuse
Natthu Bharambe [Thu, 23 Feb 2012 21:59:50 +0000 (13:59 -0800)]
Merge branch 'master' of github.com:facebook/arcanist into arc_excuse

14 years agoRequire explanation for failing lint/tests in arc.
Natthu Bharambe [Wed, 22 Feb 2012 23:57:55 +0000 (15:57 -0800)]
Require explanation for failing lint/tests in arc.

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

14 years agoWhen updating revisions, pre-fill update message with more commits in Git
epriestley [Thu, 23 Feb 2012 17:18:49 +0000 (09:18 -0800)]
When updating revisions, pre-fill update message with more commits in Git

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

14 years agoAllow loading multiple phutil libraries from command line
Nick Harper [Wed, 22 Feb 2012 19:05:50 +0000 (11:05 -0800)]
Allow loading multiple phutil libraries from command line

Summary: see title

Test Plan: loaded multiple libraries

Reviewers: blair, epriestley, jungejason

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1668

14 years agoMake 'arc diff --auto' only identify open revisions
epriestley [Wed, 22 Feb 2012 18:07:43 +0000 (10:07 -0800)]
Make 'arc diff --auto' only identify open revisions

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

14 years agoAdd an "arc alias" command
epriestley [Tue, 21 Feb 2012 21:16:52 +0000 (13:16 -0800)]
Add an "arc alias" command

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

14 years agoImprove handling of commit message on --auto/--update/--create workflows
epriestley [Tue, 21 Feb 2012 20:35:39 +0000 (12:35 -0800)]
Improve handling of commit message on --auto/--update/--create workflows

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

14 years agoRemove "arc merge" support for Mercurial
epriestley [Tue, 21 Feb 2012 17:27:52 +0000 (09:27 -0800)]
Remove "arc merge" support for Mercurial

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

14 years agoReplace "arc merge" with "arc land --merge" for git
epriestley [Mon, 20 Feb 2012 20:51:14 +0000 (12:51 -0800)]
Replace "arc merge" with "arc land --merge" for git

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

14 years agoUse "differential.query", not "differential.find", in "arc branch"
epriestley [Mon, 20 Feb 2012 20:51:08 +0000 (12:51 -0800)]
Use "differential.query", not "differential.find", in "arc branch"

Summary: find is deprecated, query is new hotness.

Test Plan: Ran "arc branch", got identical output.

Reviewers: nh, btrahan

Reviewed By: btrahan

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1646

14 years agoAdd an "--auto" flag to arc diff to activate heuristics
epriestley [Mon, 20 Feb 2012 20:51:01 +0000 (12:51 -0800)]
Add an "--auto" flag to arc diff to activate heuristics

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

14 years agohack up arc patch to not differential.query if its not authenticated
Bob Trahan [Sun, 19 Feb 2012 23:24:03 +0000 (15:24 -0800)]
hack up arc patch to not differential.query if its not authenticated

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

14 years agoMake arcanist-created branch names immune to potential git sha1 conflicts
Bob Trahan [Tue, 14 Feb 2012 00:42:24 +0000 (16:42 -0800)]
Make arcanist-created branch names immune to potential git sha1 conflicts

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

14 years agoAllow `arc lint --output json --apply-patches`
vrana [Sat, 11 Feb 2012 05:35:12 +0000 (21:35 -0800)]
Allow `arc lint --output json --apply-patches`

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

14 years agoParse git diffs of files with unicode characters in the names
epriestley [Wed, 8 Feb 2012 18:04:15 +0000 (10:04 -0800)]
Parse git diffs of files with unicode characters in the names

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

14 years agoUse readable path in lint messages
vrana [Tue, 7 Feb 2012 17:57:26 +0000 (09:57 -0800)]
Use readable path in lint messages

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

14 years agoRemove sourcePath references from Arcanist
epriestley [Mon, 6 Feb 2012 21:08:08 +0000 (13:08 -0800)]
Remove sourcePath references from Arcanist

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

14 years agoMake "arc list" use "differential.query", not "differential.find"
epriestley [Mon, 6 Feb 2012 21:08:01 +0000 (13:08 -0800)]
Make "arc list" use "differential.query", not "differential.find"

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

14 years agoAdd simple, non-magical exception flow to test cases
epriestley [Mon, 6 Feb 2012 17:56:43 +0000 (09:56 -0800)]
Add simple, non-magical exception flow to test cases

Summary: Add a boring, simple construct for handling exception-based test cases.

Test Plan: Ran unit tests.

Reviewers: btrahan, tuomaspelkonen, nh, jungejason, vrana

Reviewed By: vrana

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1562

14 years agoSwitch back to former branch after landing some other branch
epriestley [Fri, 3 Feb 2012 23:44:59 +0000 (15:44 -0800)]
Switch back to former branch after landing some other branch

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

14 years agoMinor, fix bad conditional.
epriestley [Fri, 3 Feb 2012 23:26:13 +0000 (15:26 -0800)]
Minor, fix bad conditional.

14 years agoCheck for cleanWorkingCopy in sanityCheck, and execute sanityCheck first
Kevin Deggelman [Fri, 3 Feb 2012 22:04:41 +0000 (14:04 -0800)]
Check for cleanWorkingCopy in sanityCheck, and execute sanityCheck first

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

14 years agoMinor "arc unit" coverage display updates
epriestley [Thu, 2 Feb 2012 01:36:25 +0000 (17:36 -0800)]
Minor "arc unit" coverage display updates

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

14 years agoAdd a "--no-amend" flag to "arc diff"
epriestley [Wed, 1 Feb 2012 22:33:01 +0000 (14:33 -0800)]
Add a "--no-amend" flag to "arc diff"

Summary: This flag blocks amends.

Test Plan: Ran "arc diff --no-amend" ooooooh meta

Reviewers: davidreuss, btrahan

Reviewed By: davidreuss

CC: aran, epriestley
Maniphest Tasks: T822

Differential Revision: https://secure.phabricator.com/D1539

14 years agoRun 'mark-committed' from 'arc land'
epriestley [Wed, 1 Feb 2012 22:32:43 +0000 (14:32 -0800)]
Run 'mark-committed' from 'arc land'

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

14 years agoAdd coverage support to Arcanist
epriestley [Tue, 31 Jan 2012 20:07:19 +0000 (12:07 -0800)]
Add coverage support to Arcanist

Summary:
Add "--coverage" and "--no-coverage" flags, mechanisms for reporting
coverage information, xdebug coverage support, and CLI coverage reports.

Test Plan: Ran coverage locally.

Reviewers: tuomaspelkonen, btrahan, jungejason

Reviewed By: btrahan

CC: zeeg, aran, epriestley
Maniphest Tasks: T140

Differential Revision: https://secure.phabricator.com/D1526

14 years agoFinalize Arcanist Classes
epriestley [Tue, 31 Jan 2012 20:07:05 +0000 (12:07 -0800)]
Finalize Arcanist Classes

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

14 years agoRaise a lint warning for classes not marked "abstract", "final" or
epriestley [Sat, 28 Jan 2012 19:29:30 +0000 (11:29 -0800)]
Raise a lint warning for classes not marked "abstract", "final" or
"@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

14 years agoRevert XHP classtag support in arcanist
epriestley [Sat, 28 Jan 2012 19:18:33 +0000 (11:18 -0800)]
Revert XHP classtag support in arcanist

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

14 years agoImprove Arcanist symbol name linter
epriestley [Sat, 28 Jan 2012 19:17:45 +0000 (11:17 -0800)]
Improve Arcanist symbol name linter

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

14 years agoFix arc patch in git-svn repos
Nick Harper [Fri, 27 Jan 2012 02:36:43 +0000 (18:36 -0800)]
Fix arc patch in git-svn repos

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

14 years agoPrint out recovery command before running "git branch -D" in "arc land"
epriestley [Fri, 27 Jan 2012 01:59:42 +0000 (17:59 -0800)]
Print out recovery command before running "git branch -D" in "arc land"

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

14 years agoImprove 'arc land' in immutable workflows
epriestley [Fri, 27 Jan 2012 01:41:11 +0000 (17:41 -0800)]
Improve 'arc land' in immutable workflows

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

14 years agoUse "arc which" in "arc commit", modernize checks
epriestley [Fri, 27 Jan 2012 01:40:55 +0000 (17:40 -0800)]
Use "arc which" in "arc commit", modernize checks

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

14 years agoMinor 'arc' text fixes
epriestley [Fri, 27 Jan 2012 01:40:49 +0000 (17:40 -0800)]
Minor 'arc' text fixes

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

14 years agoSplit ArcanistXHPASTLinter::LINT_FORMATTING_CONVENTIONS into seperate lint names
John Du Hart [Thu, 26 Jan 2012 03:05:47 +0000 (19:05 -0800)]
Split ArcanistXHPASTLinter::LINT_FORMATTING_CONVENTIONS into seperate lint names

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

14 years agoAdd "arc land" as a first-class workflow
epriestley [Wed, 25 Jan 2012 23:10:59 +0000 (15:10 -0800)]
Add "arc land" as a first-class workflow

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

14 years agoUse 'arc which' in 'arc amend'
epriestley [Wed, 25 Jan 2012 19:40:22 +0000 (11:40 -0800)]
Use 'arc which' in 'arc amend'

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

14 years agoAdd 'arc which', and
epriestley [Tue, 24 Jan 2012 16:07:38 +0000 (08:07 -0800)]
Add 'arc which', and
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

14 years agoMake arc install-certificate respect --conduit-uri
Bob Trahan [Mon, 23 Jan 2012 23:31:56 +0000 (15:31 -0800)]
Make arc install-certificate respect --conduit-uri

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

14 years agoAugment arc patch behavior
Bob Trahan [Thu, 19 Jan 2012 20:16:01 +0000 (12:16 -0800)]
Augment arc patch behavior

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

14 years agoAdd ArcanistConduitLinter, a linter that delegates through Conduit
adonohue [Fri, 20 Jan 2012 01:09:27 +0000 (17:09 -0800)]
Add ArcanistConduitLinter, a linter that delegates through Conduit

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

14 years agoMerge pull request #16 from disqus/improve-pep8-linter
Evan Priestley [Fri, 20 Jan 2012 05:07:19 +0000 (21:07 -0800)]
Merge pull request #16 from disqus/improve-pep8-linter

Improve PEP8 Linter

14 years agoAdd "nocommit" git-only flag to arc patch workflow
Bob Trahan [Tue, 17 Jan 2012 23:47:00 +0000 (15:47 -0800)]
Add "nocommit" git-only flag to arc patch workflow

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

14 years agoMerge pull request #17 from disqus/improve-linters
Evan Priestley [Wed, 18 Jan 2012 01:16:08 +0000 (17:16 -0800)]
Merge pull request #17 from disqus/improve-linters

Add canRun to linters.

14 years agoAdd canRun to linters.
David Cramer [Wed, 18 Jan 2012 00:30:59 +0000 (16:30 -0800)]
Add canRun to linters.

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

14 years agoRebuild phutil library map for arc
Bob Trahan [Tue, 17 Jan 2012 22:54:27 +0000 (14:54 -0800)]
Rebuild phutil library map for arc

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

14 years agoImprove PEP8 Linter
David Cramer [Tue, 17 Jan 2012 20:38:54 +0000 (12:38 -0800)]
Improve PEP8 Linter

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

14 years agoMerge pull request #15 from disqus/comprehensive-linter
Evan Priestley [Tue, 17 Jan 2012 20:48:09 +0000 (12:48 -0800)]
Merge pull request #15 from disqus/comprehensive-linter

Implement Comprehensive Lint Engine