]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
13 years agoDelete useless code in ArcanistBaseWorkflow
vrana [Wed, 23 Jan 2013 21:08:58 +0000 (13:08 -0800)]
Delete useless code in ArcanistBaseWorkflow

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4601

13 years agoAdded support for hg diffs generated in git mode
Asher Baker [Wed, 23 Jan 2013 02:13:53 +0000 (18:13 -0800)]
Added support for hg diffs generated in git mode

Summary: Fixes T2112. These are fairly common now, and are used as the storage format for `hg export` and mq in most installs.

Test Plan: Ran unit tests, used `arc patch --patch`, uploaded some diffs manually.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2112

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

13 years agoDon't use xhpast binary to compute xhpastlinter cache version if the binary doesn...
epriestley [Wed, 23 Jan 2013 01:16:37 +0000 (17:16 -0800)]
Don't use xhpast binary to compute xhpastlinter cache version if the binary doesn't exist

Summary: The binary may not be built, in which case this raises a warning.

Test Plan: Will make @zeeg test.

Reviewers: zeeg, vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4569

13 years agoAllow hg arc land when no rebase is necessary
durham [Tue, 22 Jan 2013 22:29:00 +0000 (14:29 -0800)]
Allow hg arc land when no rebase is necessary

Summary:
Previously, trying to arc land in a mercurial repo would
fail if the local branch was already at the tip of the onto branch
(since hg rebase exited with code 1).  This change makes it check
if a rebase is needed before executing the rebase.

Test Plan:
hg init foo
cd foo
hg bookmark master
touch a && hg add a && hg commit -ma
// setup your .arcconfig
cd ..
hg clone foo foo2
cd foo2
hg bookmark mybook
touch b && hg add b && hg commit -mb
arc land --onto master --revision <your rev number>

Arc land should succeed.  I also tried landing when a rebase was
necessary and it still worked.

Reviewers: epriestley, dschleimer, bos

Reviewed By: epriestley

CC: sid0, aran, Korvin
Differential Revision: https://secure.phabricator.com/D4588

13 years agoFix PHT linter
vrana [Sat, 19 Jan 2013 18:26:24 +0000 (10:26 -0800)]
Fix PHT linter

Summary: Variables in strings and concatenation lists.

Test Plan:
New unit tests.

  preg_match('/^((?>[^$\\\\]*)|\\\\.)*$/s', str_repeat('a', 1e6));

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4540

13 years agoWarn against usage of nowdoc
vrana [Sat, 19 Jan 2013 17:19:21 +0000 (09:19 -0800)]
Warn against usage of nowdoc

Summary: Also include binary hash in the version.

Test Plan: New unit test.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4535

13 years agoSet used variable
vrana [Fri, 18 Jan 2013 21:32:48 +0000 (13:32 -0800)]
Set used variable

13 years agoFix arc diff when run from a git submodule
Nick Harper [Thu, 17 Jan 2013 19:28:13 +0000 (11:28 -0800)]
Fix arc diff when run from a git submodule

Summary:
A git submodule looks a lot like a normal git repo, but the .git
directory is replaced with a file that git reads to find the real
location of the git directory. When arcanist tries to write a file into
a directory inside of there, it was failing silently, and then crashing
silently when it couldn't read results back out. Instead of assuming the
git directory is a directory named .git at the toplevel of the tree, we
use the appropriate git command to get the correct git directory.

Test Plan: submit a diff from a submodule

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4482

13 years agoAllow pht(<<<HEREDOC ... HEREDOC)
epriestley [Wed, 16 Jan 2013 22:57:10 +0000 (14:57 -0800)]
Allow pht(<<<HEREDOC ... HEREDOC)

Summary: Don't raise lint on heredoc literals.

Test Plan: Linted pht() + heredoc in D4477.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4478

13 years agoInclude real PEP8 version and options in lint cache key
vrana [Wed, 16 Jan 2013 20:10:17 +0000 (12:10 -0800)]
Include real PEP8 version and options in lint cache key

Summary: This should be done for all external and configurable linters.

Test Plan: Linted file with lint problems, changed options, relinted.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4475

13 years agoFix whitespace around else
vrana [Wed, 16 Jan 2013 20:15:46 +0000 (12:15 -0800)]
Fix whitespace around else

13 years agoCache stopped paths in lint
vrana [Tue, 15 Jan 2013 21:47:11 +0000 (13:47 -0800)]
Cache stopped paths in lint

Summary:
If linter with file cache granularity stops linting then we don't run it on the same path next time.
But we still run linters with non-file cache granularity causing that they run even on the paths that would be stopped otherwise.

Test Plan:
Put global granularity linter after Generated linter.
Caused an error from this linter but in ignored path.
Verified that 'stopped' is saved in `lint-cache.json`.
Linted the same files second time, verified that the path is still skipped (wasn't before).

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4446

13 years agoUse assert_instances_of(, 'array')
vrana [Sat, 12 Jan 2013 04:12:01 +0000 (20:12 -0800)]
Use assert_instances_of(, 'array')

Summary: To have at least one real callsite.

Test Plan:
  $message = new ArcanistLintMessage();
  $message->setOtherLocations(array());
  $message->setOtherLocations(array(array()));
  $message->setOtherLocations(array(1));

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4419

13 years agoDisplay other locations of lint errors in console renderer
vrana [Fri, 11 Jan 2013 23:23:47 +0000 (15:23 -0800)]
Display other locations of lint errors in console renderer

Test Plan: Created function named `f_a`, manually set other location.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4412

13 years agoAdd hook after running linters
vrana [Fri, 11 Jan 2013 22:11:38 +0000 (14:11 -0800)]
Add hook after running linters

Summary: This resolves D4380#7 by reverting https://secure.phabricator.com/D4380?vs=9112&id=9123.

Test Plan: Used it in our linters.

Reviewers: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4409

13 years agoFormat whitespace in XHPAST linter
vrana [Fri, 11 Jan 2013 20:38:08 +0000 (12:38 -0800)]
Format whitespace in XHPAST linter

Test Plan: Linted a method named `f_a`.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4405

13 years agoAllow specifying multiple locations of the same lint error
vrana [Thu, 10 Jan 2013 23:03:33 +0000 (15:03 -0800)]
Allow specifying multiple locations of the same lint error

Summary:
Some errors (duplicate declaration, invalid number of arguments) have more related places.
We need to notify user if he changes any related place.
This could be currently achieved by triggering errors instead of warnings or by including both files in the range (impossible if the locations are in different files) or by issuing multiple errors.
All options are too aggressive.

Test Plan: Issued error on unmodified line with other location on modified line.

Reviewers: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4392

13 years agoFix checking for lint binary paths
vrana [Thu, 10 Jan 2013 23:22:49 +0000 (15:22 -0800)]
Fix checking for lint binary paths

Summary: Like D4379.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4391

13 years agoAdd some new misspellings of "hierarchy"
Gregor Stocks [Thu, 10 Jan 2013 22:32:23 +0000 (14:32 -0800)]
Add some new misspellings of "hierarchy"

Summary: turns out people really like misspelling "hierarchy"

Test Plan: hope

13 years agoRun all willLintPaths() before any lintPath()
vrana [Wed, 9 Jan 2013 21:00:45 +0000 (13:00 -0800)]
Run all willLintPaths() before any lintPath()

Summary:
FB runs some linters on background and it's a magnificent hack using `ParallelLinter` (two instances), `BackgroundLinter` and `FutureLinter`.
I want to simplify this by resolving the futures in engine instead of in some virtual linter.
It also seems like a better place to do it.
It should also fix caching problems I have with them (because the virtual linters don't know about the cache at all).

Test Plan: None yet.

Reviewers: epriestley, nh

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4380

13 years agoGenerate Git patches with "\n" metadata line endings unconditionally
epriestley [Wed, 9 Jan 2013 21:51:51 +0000 (13:51 -0800)]
Generate Git patches with "\n" metadata line endings unconditionally

Summary:
Fixes T2175. Git generates patches which have "\n" line endings on every system. We currently generate patches with system-dependent line endings.

Git accepts system-dependent line endings in almost call cases, but part of the parser tests for "\n" explicitly. T2175 has an example of this.

Test Plan:
Ran `arc export --git --revision D4366 > export.git` on a Windows machine, verified "\n" line endings. Ran the same with `--unified`, verified "\r\n" line endings.

(I didn't add any unit tests for this because it's Windows-dependent and very difficult to test meaningfully right now -- i.e., test that appliable patches are generated -- since the git reconstitution test doesn't run on Windows either, because we can't yet untar things there.)

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T2175

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

13 years agoFix checking for flake8 path
vrana [Wed, 9 Jan 2013 21:37:08 +0000 (13:37 -0800)]
Fix checking for flake8 path

Test Plan:
  $ arc unit # without flake8 in path

Reviewers: zeeg

Reviewed By: zeeg

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

13 years agoNormalize Windows directory separators in SVN
epriestley [Wed, 9 Jan 2013 20:34:37 +0000 (12:34 -0800)]
Normalize Windows directory separators in SVN

Summary: Fixes T1946.

Test Plan: Ran `arc diff --only` with added paths inside directories. Saw only "/" entries in the diff.

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: aran, mbishopim3
Maniphest Tasks: T1946

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

13 years agoAllow `arc.bat` to work from paths with spaces in them
epriestley [Wed, 9 Jan 2013 20:34:30 +0000 (12:34 -0800)]
Allow `arc.bat` to work from paths with spaces in them

Summary: If you dump `arcanist/` into "Program Files" or similar, the `.bat` currently breaks. Quote the path so it doesn't. Fixes T1436.

Test Plan: Ran `arc` with `arcanist/` in a path with spaces in it.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1436

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

13 years agoFix `arc diff x y` in SVN
epriestley [Wed, 9 Jan 2013 17:11:26 +0000 (09:11 -0800)]
Fix `arc diff x y` in SVN

Summary:
D4186 added an "svn status --xml x y" form to getSVNStatus(), but the parser doesn't work for multiple files, since we get multiple <target /> elements in the XML output. So, curently, `arc diff` works (one target, all files) and `arc diff x` works (one target, x) but `arc diff x y` does not (more than one target, hits the exception).

  $ arc diff QUACK2 QUACK3
  Exception
  Expected exactly one XML status target.

Test Plan: Ran `arc diff QUACK2 QUACK3` in a working copy with modified QUACK2, QUACK3. Ran `arc diff`; `arc diff QUACK2`.

Reviewers: vrana, btrahan, codeblock, JThramer

Reviewed By: codeblock

CC: aran
Differential Revision: https://secure.phabricator.com/D4372

13 years agoFix "empty diff" error in arcanist
epriestley [Wed, 9 Jan 2013 16:15:53 +0000 (08:15 -0800)]
Fix "empty diff" error in arcanist

Summary: Ref T2296. This error is unreachable right now -- when I fixed all the "\r\n" stuff, we always end up with a nonempty first line for an empty input. Do this test earlier and more explicitly. This results in a less useful error: "expected (some junk) on line 1" instead of "can't parse an empty diff".

Test Plan: Tried to parse an empty diff, got a "you can't parse an empty diff" error.

Reviewers: btrahan, vrana, codeblock

Reviewed By: codeblock

CC: aran
Maniphest Tasks: T2296

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

13 years agoAdd a comma.
Ricky Elrod [Tue, 8 Jan 2013 23:51:32 +0000 (15:51 -0800)]
Add a comma.

Summary: Add a comma because it was going to annoy the crap out of me.

Test Plan: See the comma. :)

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4365

13 years agoPass the constructed message to the TYPE_DIFF_DIDBUILDMESSAGE event.
Roy Williams [Tue, 8 Jan 2013 23:06:46 +0000 (15:06 -0800)]
Pass the constructed message to the TYPE_DIFF_DIDBUILDMESSAGE event.

Summary: We want to use TYPE_DIFF_DIDBUILDMESSAGE to abort arc diff when a message doesn't fit some

Test Plan: Created an EventListener subscribed to TYPE_DIFF_DIDBUILDMESSAGE, validated the 'message' field was filled in

Reviewers: vrana, epriestley

Reviewed By: epriestley

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

13 years agoFix cppcheck path finding
Jack Lindamood [Mon, 7 Jan 2013 20:46:49 +0000 (12:46 -0800)]
Fix cppcheck path finding

Summary: This fix lets you run arc lint from any directory in the repository

Test Plan: Ran arc lint from any directory

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4356

13 years agoLimit `arc branch` to 16 concurrent processes
epriestley [Mon, 7 Jan 2013 16:44:55 +0000 (08:44 -0800)]
Limit `arc branch` to 16 concurrent processes

Summary:
Currently, this spawns 125 concurrent processes on my machine, which overflows some limit and gives me an error:

  PHP Warning:  proc_open(): unable to create pipe Too many open files in /INSECURE/devtools/libphutil/src/future/exec/ExecFuture.php on line 491

Instead, limit parallelism to 16. The runtime is approximately the same for me, and dominated by other concerns (conduit calls).

Test Plan: Ran `arc branch` successfully. Ran `arc branch --trace`, observed behavior.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran
Differential Revision: https://secure.phabricator.com/D4336

13 years agoCppCheck linter
Jack Lindamood [Mon, 7 Jan 2013 16:16:45 +0000 (08:16 -0800)]
CppCheck linter

Summary:
Lints cpp code using the cppcheck static linter.  This linter needs to
be downloaded and built from http://cppcheck.sourceforge.net/

Test Plan: Used it on a few files.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4353

13 years agoAdd cpplint.py engine
Jack Lindamood [Sat, 5 Jan 2013 02:59:38 +0000 (02:59 +0000)]
Add cpplint.py engine

Summary: Adds arc lint support for cpp files with Google's cpplint.py lint checking.

Test Plan: ran it on some cpp files. Added unit tests

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4344

13 years agomake arc install-certificate <uri> work if uri is specified
Bob Trahan [Thu, 3 Jan 2013 17:23:20 +0000 (09:23 -0800)]
make arc install-certificate <uri> work if uri is specified

Summary: see title

Test Plan: ran arc install-certificate <uri> in a directory without an .arcconfig and it worked! ran arc install-certificate in a directory with an .arcconfig and it worked! ran arc install-certificate <uri> in a directory with an .arcconfig and noted it correctly overrode the .arcconfig

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2251

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

13 years agoCorrect spelling for "arc" commands
epriestley [Mon, 31 Dec 2012 00:01:59 +0000 (16:01 -0800)]
Correct spelling for "arc" commands

Summary:
I type "arc brnach" about 300 times per day.

  - Allow arc commands to be specified by unique prefix ("exp" for "export", "lib" for "liberate").
  - Allow arc commands to be specified by unique levenshtein edit distance <= 2 ("brnach" for "branch", "halp" for "help", "ptach" for "patch").
  - Reorganize code out of "arcanist.php".

I think this will be uncontentious because arc commands are rarely destructive, but if people complain we can either require certain commands be typed exactly (maybe "land"?) or allow this feature to be disabled in configuration.

Test Plan:
  $ arc br
  Usage Exception: Unknown command 'br'. Try 'arc help'.

  Did you mean:
      branch
      browse

  $ arc brnachh
  Usage Exception: Unknown command 'brnachh'. Try 'arc help'.
  $ arc brnach
  (Assuming 'brnach' is the British spelling of 'branch'.)
     doc-security        No Revision      security
     sms                 Needs Revision   D319: Add SMS support to Phabricator
     phxtag              No Revision      derp
     arantag             No Revision      derp
  ...

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran
Differential Revision: https://secure.phabricator.com/D4305

13 years agoCorrect description and severity on Flake8 linter
David Cramer [Sat, 22 Dec 2012 00:13:16 +0000 (16:13 -0800)]
Correct description and severity on Flake8 linter

Test Plan: do it live

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4274

13 years agoAdd a flake8 linter
David Cramer [Fri, 21 Dec 2012 23:27:52 +0000 (15:27 -0800)]
Add a flake8 linter

Summary: flake8 is the better maintained combination of pep8 and pyflakes

Test Plan: There's a test!

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, jack
Differential Revision: https://secure.phabricator.com/D4082

13 years agoImprove `arc land` recovery from issues with the remote.
epriestley [Fri, 21 Dec 2012 22:18:07 +0000 (14:18 -0800)]
Improve `arc land` recovery from issues with the remote.

Summary:
Fixes T2138.

  - When a pull fails, restore the original branch.
  - When a push fails, complain about it really loudly.

NOTE: No test plan for push yet since I'm not sure this is the right remedy, see T2138 for discsusion.

Test Plan:
  - Tested pull by changing "git pull" to "git xxpull" and running "arc land". Saw the pull fail and my original branch restored.

Reviewers: vrana, aran

Reviewed By: vrana

Maniphest Tasks: T2138

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

13 years agoDon't require clean working copy for `arc diff path` in SVN
vrana [Fri, 14 Dec 2012 23:49:01 +0000 (15:49 -0800)]
Don't require clean working copy for `arc diff path` in SVN

Summary: If you are explicit then there is no need to ask you.

Test Plan:
  $ touch a
  $ arc diff
  $ arc diff a
  $ arc diff existing

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4186

13 years agoUpdate PEP8 to 1.3.4
vrana [Fri, 21 Dec 2012 04:43:39 +0000 (20:43 -0800)]
Update PEP8 to 1.3.4

Summary: Primarily to avoid false positives: http://pypi.python.org/pypi/pep8#id1

Test Plan:
  $ arc lint --engine ComprehensiveLintEngine externals/pep8/pep8.py # after uncommenting externals/ check

Saw 9 errors, haha.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4260

13 years agoSpeed up SVN discovery
vrana [Fri, 21 Dec 2012 02:04:59 +0000 (18:04 -0800)]
Speed up SVN discovery

Summary: `svn info` takes up to 10 seconds.

Test Plan: `arc diff` inside SVN repo and outside any repo.

Reviewers: nh, epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4256

13 years agoDon't amend commit with the same message in `arc diff`
vrana [Thu, 20 Dec 2012 20:11:57 +0000 (12:11 -0800)]
Don't amend commit with the same message in `arc diff`

Summary: It makes reflog ugly

Test Plan:
# `arc diff`, made error, saw "Message saved to".
# `arc diff`, didn't edit, didn't see "Message saved to".
# `arc diff`, edited, saw "Message saved to".

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4243

13 years agoMake caching lint default
vrana [Thu, 20 Dec 2012 19:35:50 +0000 (11:35 -0800)]
Make caching lint default

Summary: I use it couple of weeks without troubles.

Test Plan:
Added debug output and:

  $ arc lint
  $ arc lint --cache 0

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2036

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

13 years agoFix `arc diff` in SVN with paths
epriestley [Thu, 20 Dec 2012 19:12:30 +0000 (11:12 -0800)]
Fix `arc diff` in SVN with paths

Summary:
Recently, in D4097 or one of the precursors I refactored this. However, when $rev is null parseBaseCommitArgument() throws ("This VCS does not support commit ranges."). Shield the call so it only happens if if $rev is nonempty (we still want to make the call, so "arc lint --rev x" on SVN will throw and inform the user that "--rev" is incorrect usage).

(@vrana, this was reported by FB and might be worth pushing.)

Test Plan: Ran "arc diff --preview <path>". Grepped for other parseBaseCommitArgument() callsites and verified they don't have similar issues.

Reviewers: vrana, btrahan, chad

Reviewed By: chad

CC: aran
Differential Revision: https://secure.phabricator.com/D4241

13 years agoRefuse writing to undeclared properties in workflows
vrana [Wed, 3 Oct 2012 21:34:02 +0000 (14:34 -0700)]
Refuse writing to undeclared properties in workflows

Summary: I don't know how to not be strict here plus we (Arcanist developers) don't have access to user's error log.

Test Plan:
Undeclared `ArcanistDiffWorkflow::$console`, then:

  $ arc diff

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3607

13 years agoAllow checking out branches in `arc branch`
vrana [Wed, 12 Dec 2012 22:01:26 +0000 (14:01 -0800)]
Allow checking out branches in `arc branch`

Summary:
The main added value is loading the branch name from revision.
Sometimes I know the revision ID but I don't know the branch name.

The missing piece is the starting point of the branch.
I was thinking about using `arc.land.onto.default` but we also need to get 'origin'.

This is also the last step of a simple workflow where underlying VCS is not abstracted away.
In future, we can implement this for other APIs.

Test Plan:
  $ arc branch new_branch
  $ arc branch new_branch
  $ arc branch D4168

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4170

13 years agoMerge pull request #62 from bonneval/bugfixUndefinedVariable
Evan Priestley [Tue, 18 Dec 2012 13:38:05 +0000 (05:38 -0800)]
Merge pull request #62 from bonneval/bugfixUndefinedVariable

Bugfixed undefined variable $commit.

13 years agoBugfixed undefined variable $commit.
bonneval [Tue, 18 Dec 2012 13:31:48 +0000 (14:31 +0100)]
Bugfixed undefined variable $commit.

13 years agoSupport http basic auth and related configuration
Brennan Taylor [Tue, 18 Dec 2012 01:58:53 +0000 (17:58 -0800)]
Support http basic auth and related configuration

This adds the http basic auth username and password if found in the
configuration to the ConduitClient.

Reviewed by: epriestley

13 years agoAllow arc to be run in arcanist/ or libphutil/
epriestley [Tue, 18 Dec 2012 00:35:03 +0000 (16:35 -0800)]
Allow arc to be run in arcanist/ or libphutil/

Summary:
Currently, if you run `arc` in arcanist/ or libphutil/ and your PATH and on-disk configuration are set up so a different version of arc or libphutil are the ones that actually load, we fail with an exception like "running arcanist in a different copy of arcanist is not supported".

This causes problems for Harbormaster, since we'd like to be able to run 'arc' in a copy of libphutil/ and have it execute unit tests for that copy rather than failing abruptly. So, if we detect that we're in arcanist/ or libphutil/, execute 'arc' again with the same arguments but force it to load the working copy in place of either the 'arcanist/' or the 'libphutil/' that it decided to load.

This is pretty much horrible black magic.

Test Plan: Ran 'arc list --trace' inside copies of libphutil/ and arcanist/ outside of the normal include chain. Saw it detect these, emit a message, and re-execute itself correctly.

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1049

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

13 years agoStop passsing bogus 'user' parameter to differential.createrevision
epriestley [Mon, 17 Dec 2012 22:41:27 +0000 (14:41 -0800)]
Stop passsing bogus 'user' parameter to differential.createrevision

Summary: After D4191 this is a fatal.

Test Plan: Created this revision.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran
Differential Revision: https://secure.phabricator.com/D4219

13 years agoImplement --everything, --json and --ugly flags for `arc unit`
epriestley [Mon, 17 Dec 2012 20:56:41 +0000 (12:56 -0800)]
Implement --everything, --json and --ugly flags for `arc unit`

Summary: Adds "arc unit --everything", which runs every available test, provided the test engine supports it. Also add JSON output.

Test Plan: Ran `arc unit --everything` in arcanist/, libphutil/ and phabricator/. Saw all tests run.

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T2065

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

13 years agoRefactor commit ranges and base commit handling
epriestley [Mon, 17 Dec 2012 20:54:08 +0000 (12:54 -0800)]
Refactor commit ranges and base commit handling

Summary:
See D4049, D4096.

  - Move commit range storage from Mercurial and Git APIs to the base API.
  - Move caching up to the base level.
    - Store symbolic name and resolved name separately, so we can re-resolve the correct commit from the symbolic name after dirtying caches.
  - Rename `supportsRelativeLocalCommit()` to `supportsCommitRanges()` (old name wasn't very good, and not consistent with new terminology like the `--base` flag).
  - Rename `getRelativeCommit()` and `setRelativeCommit()` to `getBaseCommit()` and `setBaseCommit()`.
  - Introduce `reloadCommitRange()` and call it from `reloadWorkingCopy()`.

I think this fixes the problem in D4049, and provides a general solution for the class of problems we're running into here, with D4096. Specifically:

  - We no longer get dirty caches, as long as you call reloadWorkingCopy() after changing the working copy (or call a method which calls it for you).
  - We no longer get order-of-parsing-things problems, because setBaseCommit() reloads the appropriate caches.
  - We no longer get nasty effects from calling `requireCleanWorkingCopy()` too early.

Test Plan: This is pretty far-reaching and hard to test. Unit tests; ran various arc commands. :/

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4097

13 years agoRemove ArcanistRepositoryAPI::setDefaultBaseCommit()
epriestley [Mon, 17 Dec 2012 20:53:38 +0000 (12:53 -0800)]
Remove ArcanistRepositoryAPI::setDefaultBaseCommit()

Summary:
This method is used in three cases:

  # For unit tests, to set the range to 'HEAD^' or '.^' in an agnostic way.
  # For "amend", to set the range to the commit to be amended (also 'HEAD^' or '.^').
  # For "patch" and "upgrade" so we don't fail just because there's an invalid "base" rule somewhere in the config when doing clean-working-copy tests.

For cases (1) and (2), introduce an "arc:this" rule to mean "the current commit". For case (3), remove the call; it is no longer necessary to check the commit range in order to do tests for the working copy state after D4095.

Test Plan: Ran unit tests, "arc upgrade", "arc patch", "arc amend".

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4096

13 years agoRefactor getWorkingCopyStatus() into getUncommittedStatus() and getCommitRangeStatus()
epriestley [Mon, 17 Dec 2012 20:53:28 +0000 (12:53 -0800)]
Refactor getWorkingCopyStatus() into getUncommittedStatus() and getCommitRangeStatus()

Summary:
See discussion in D4049.

The getWorkingCopyStatus() method gets called from requireCleanWorkingCopy() in a lot of places, which triggers resolution of the base of the commit range. This is unnecessary; we do not need to examine the base commit in order to determine whether the working copy is dirty or not. This causes problems, in D4049 and elsewhere (we currently have a lot of fluff calls to setDefaultBaseCommit() in workflows which need to call requireCleanWorkingCopy() but do not ever use commit ranges, such as `arc patch`). This is mostly an artifact of SVN, where the "commit range" and "uncommitted stuff in the working copy" are always the same.

  - Split the method into two status methods: getUncommittedStatus() (uncommitted stuff in the working copy, required by requireCleanWorkingCopy()) and getCommitRangeStatus() (committed stuff in the commit range).
  - Lift caching out of the implementations into the base class.
  - Dirty the cache after we commit.

This doesn't do anything useful on its own and creates one caching problem (`commitRangeStatusCache` is not invalidated when the commit range changes because of `setBaseCommit()` or similar) but I wanted to break things apart here. I won't land it until there's a more complete picture.

This creates a minor performance regression in git and hg (we run less stuff in parallel than previously) but all the commands should be disk-bound anyway and the regression should be minor. It prevents a larger regression in `hg` in D4049, and lets us do less work to arrive at common error states (dirty working copy). We can examine perf at the end of this change sequence.

Test Plan: Ran unit tests, various `arc` commands.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4095

13 years agoSuggest upgrading Phabricator for unknown Conduit methods or parameters
vrana [Sat, 15 Dec 2012 01:40:57 +0000 (17:40 -0800)]
Suggest upgrading Phabricator for unknown Conduit methods or parameters

Summary:
This allows using new methods without the need for bumping version number.

The usage is not neccessary because we already bumped the version number for this but I wanted to have a callsite.

Test Plan:
Made a typo in method name, then:

  $ arc lint --only-new 1

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4193

13 years agoUpdate PEP8
vrana [Thu, 13 Dec 2012 02:05:48 +0000 (18:05 -0800)]
Update PEP8

Test Plan:
Linted this Python file:

  def get_mapper_sets(
          compression=4.0,  # Currently works for most tables
          **kwargs):
      pass

Didn't see:

> E225 missing whitespace around operator

Reviewers: andrewjcg, epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4172

13 years agoadd arc land hg support for landing with nested branches
durham [Thu, 6 Dec 2012 03:31:25 +0000 (19:31 -0800)]
add arc land hg support for landing with nested branches

Summary:
This changes arc land's hg support to allow you to land a branch or bookmark that has nested branches/bookmarks.  Example:

      // Initial state:
      // -a--------b  master
      //   \
      //    w--x  mybranch
      //        \--y  subbranch1
      //         \--z  subbranch2
      //
      // arc land --branch mybranch --onto master :
      // -a--b--wx  master
      //          \--y  subbranch1
      //           \--z  subbranch2

Test Plan:
Created several repos like in the summary and ran 'arc land' and 'arc land --keep-branch'. Did this with both bookmarks and named branches. Scenarios tested:

- mybranch having no child commits
- mybranch having a child branch with several commits
- mybranch having two child branches
- mybranch having a child branch which has two more child branches

No code was added outside of a "if ($this->isHg)" so I didn't run git arc land.

Reviewers: epriestley, dschleimer, bos, sid0

Reviewed By: dschleimer

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4089

13 years agoAdd an experimental "--mergeup" flag to use a less volatile merge strategy in "arc...
epriestley [Thu, 13 Dec 2012 22:11:52 +0000 (14:11 -0800)]
Add an experimental "--mergeup" flag to use a less volatile merge strategy in "arc land"

Summary:
See chatlog from https://secure.phabricator.com/chatlog/channel/%23phabricator/?at=37257

Basically, the install's developers sometimes use "git merge master" instead of "git rebase master" to pull changes from master into their branch. When we run "git rebase master" at the end, this creates a lot of conflicts.

Instead, optionally run "git merge master". This should be equivalent in our case (where we always rebase) and much better in their case (where they sometimes merge).

We're both going to use it for a bit and see if it creates problems. If it improves the "sometimes-merge" workflow without affecting the "always rebase" workflow, we can make it a default. If it improves theirs but damages ours, we can keep it a flag/option. If it's just terrible, we can figure out something else.

Test Plan:
Ran `arc land --mergeup --trace <feature> --keep-branch --hold`, see P624 for output. Observed merge update strategy and general success.

Also verified the conflict:

  $ arc land --mergeup --merge
  Usage Exception: Arguments '--mergeup' and '--merge' are mutually exclusive: The --merge strategy does not update the feature branch.

Reviewers: btrahan, vrana, DurhamGoode

Reviewed By: btrahan

CC: aran, keir
Differential Revision: https://secure.phabricator.com/D4080

13 years agoSimplify code by not passing local data to methods
vrana [Wed, 12 Dec 2012 22:21:06 +0000 (14:21 -0800)]
Simplify code by not passing local data to methods

13 years agoUse repository info from arcanist.projectinfo if available
vrana [Mon, 10 Dec 2012 23:10:31 +0000 (15:10 -0800)]
Use repository info from arcanist.projectinfo if available

Test Plan: Added a debug output there and ran.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4147

13 years agoSupport `git svn dcommit` in `arc land`
vrana [Sat, 8 Dec 2012 02:13:32 +0000 (18:13 -0800)]
Support `git svn dcommit` in `arc land`

Test Plan:
  $ arc land # in Git SVN repository

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4123

13 years agoAdd arc browse workflow
Aviv Eyal [Sun, 9 Dec 2012 22:09:35 +0000 (14:09 -0800)]
Add arc browse workflow

Summary:
arc browse will open a browser to the Diffusion view of a file. Convenient if you like
Diffusion for reading source. Naturally, it fixes relative filenames.

Combined with git-grep it can be an easy replacement for server-side search functions.

Test Plan:
use feature with and without 'browser' configured.

I've only tested this on Linux, because that's all I have right now, but the principle is sound.

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4127

13 years agoReuse code in close-revision workflow
vrana [Sat, 8 Dec 2012 02:02:09 +0000 (18:02 -0800)]
Reuse code in close-revision workflow

Test Plan: Will test it by closing this revision.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4122

13 years agoRemove ArcanistSubversionAPI::hasMergeConflicts()
epriestley [Thu, 6 Dec 2012 20:20:02 +0000 (12:20 -0800)]
Remove ArcanistSubversionAPI::hasMergeConflicts()

Summary: No callsites, redundant with getMergeConflicts().

Test Plan: Grepped for callsites.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4093

13 years agoQuote author parameter
Edward Speyer [Wed, 5 Dec 2012 23:37:14 +0000 (15:37 -0800)]
Quote author parameter

Summary:
Fixes the exception:

  Exception
  Command 'git commit -a --author=Whatever Long Name <whatever@email.com> -F -' failed with error #1

Test Plan: Tested with full git name

Reviewers: epriestley, aurelijus

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3979

13 years agoIntroduce "arc diff --plan-changes"
Xingyao Ye [Wed, 5 Dec 2012 22:04:10 +0000 (14:04 -0800)]
Introduce "arc diff --plan-changes"

Summary:
Allow authors to publish a new or updated revision to Phabricator
without requesting code reviews. The revision will have status
"Needs Revision" instead of "Needs Review".

In order to avoid a change of Conduit API, this is done by adding
a comment with the "plan changes" action immediately after the
revision is published.

Test Plan:
Using my local repository, run "./bin/arc diff --plan-changes"
Check the resulting diff in Phabricator.

Reviewers: vrana

Reviewed By: vrana

CC: aran, epriestley
Maniphest Tasks: T2024

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

13 years agoFix a fatal for git uncommitted changes in new arc projects
epriestley [Wed, 5 Dec 2012 17:20:15 +0000 (09:20 -0800)]
Fix a fatal for git uncommitted changes in new arc projects

Summary:
If you run `arc diff` in a repository which:

  - has uncommitted or untracked changes; and
  - has a .arcconfig with a never-before-seen project ID;
  - we fatal: http://pastebin.com/raw.php?i=ykpfr4MT

This patch is a bit iffy, open to alternatives. The "right" patch is probably an `arcanistproject.query` which behaves more sensibly.

I return array() directly since we'll later create the project.

Test Plan: Ran `arc diff` in a repository with untracked files or uncommitted changes and a new project ID.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4057

13 years agoBump Conduit client version number conduit-6
vrana [Tue, 4 Dec 2012 01:55:15 +0000 (17:55 -0800)]
Bump Conduit client version number

Summary: Should have been part of D3934.

Test Plan:
  $ arc diff

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4076

13 years agoAdd hg support for arc land
durham [Tue, 4 Dec 2012 01:59:12 +0000 (17:59 -0800)]
Add hg support for arc land

Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed.  For the most part all the arc land options work, but there are a few caveats:

- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default

Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches.  Also tested --hold, --revision, --onto, --remote.

See https://secure.phabricator.com/P619

Also tested git arc land with --merge and --keep-branch.

Reviewers: dschleimer, sid0, epriestley, bos

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068

13 years agoIntroduce `arc lint --only-new 1`
vrana [Tue, 4 Dec 2012 00:52:58 +0000 (16:52 -0800)]
Introduce `arc lint --only-new 1`

Test Plan:
  $ arc lint src/workflow/ArcanistLintWorkflow.php
  $ arc lint --only-new 1 src/workflow/ArcanistLintWorkflow.php

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2038

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

13 years agoRestore order of operations after D4056
epriestley [Tue, 4 Dec 2012 00:31:45 +0000 (16:31 -0800)]
Restore order of operations after D4056

Summary:
See discussion in D4056. In `findRevision()` we call `loadWorkingCopyDifferentialRevisions()`. However, this method depends upon the state of the working copy, because the end of the commit range it examines is HEAD. Prior to D4056 we checked out the target branch before calling `findRevision()`; after D4056 we call it earlier.

This isn't problematic in the `arc land` case, but in the `arc land <branch>` case it means we may fail to identify a revision, or identify the wrong revision, because HEAD isn't where we expect it to be.

Instead, unconditionally check out the target branch before finding the revision.

See <http://dl.dropbox.com/u/116385/Slingshot/Pictures/Screen%20Shot%202012-12-03%20at%203.43.45%20PM.png> for a transcript of the issue.

Test Plan: Reproduced issue as per link above. Ran `arc land --keep-branch --hold somebranch` successfully after this patch.

Reviewers: DurhamGoode, zeeg

Reviewed By: DurhamGoode

CC: aran
Differential Revision: https://secure.phabricator.com/D4072

13 years agoAllow setting lint cache granularity
vrana [Thu, 22 Nov 2012 02:38:24 +0000 (18:38 -0800)]
Allow setting lint cache granularity

Summary:
We can add `GRANULARITY_DIRECTORY` and `GRANULARITY_REPOSITORY` later.
Repository granularity may use current commit + changes.
Directory would need to use hashes of all files in dir which would be quite expensive.

Test Plan:
  $ echo '<?php class A extends B {}' > A.php
  $ arc lint --cache 1
  $ arc lint --cache 1
  $ echo '<?php class B {}' > B.php
  $ arc lint --cache 1
  $ arc lint --cache 1
  $ rm B.php
  $ arc lint --cache 1
  $ arc lint --cache 1

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4021

13 years agocanRun should return false on scala linter instead of raising an exception
David Cramer [Mon, 3 Dec 2012 23:25:16 +0000 (15:25 -0800)]
canRun should return false on scala linter instead of raising an exception

Summary:
This was causing the following error in environments that didnt have scala configured:

Some linters failed:
   - ArcanistScalaSBTLinter: ArcanistUsageException: This directory does not appear to be maintained by SBT, as we can't seem to find a working build file (project/Build.scala or build.sbt).

Test Plan: .

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4070

13 years agoBreak arc land run() into smaller functions
durham [Mon, 3 Dec 2012 21:03:13 +0000 (13:03 -0800)]
Break arc land run() into smaller functions

Summary:
Refactor the arc land code into several
functions so it's easier to maintain. This is in
preparation for adding hg support to arc land
in my next commit.

Without this refactor, adding hg support makes the run()
function too big.

Test Plan:
Set up a git repo and clone with a branch scenario.
Example: https://secure.phabricator.com/P614
Ran and verified:
arc land
arc land --keep-branch
arc land --merge
arc land --merge --keep-branch
arc land --hold
arc land --revision <another phabricator rev>

Reviewers: epriestley

Reviewed By: epriestley

CC: dschleimer, sid0, aran, Korvin
Differential Revision: https://secure.phabricator.com/D4056

13 years agoAdd a very basic Scala (SBT) linter.
Ricky Elrod [Mon, 3 Dec 2012 16:13:45 +0000 (08:13 -0800)]
Add a very basic Scala (SBT) linter.

Summary:
SBT is the most common Scala buildsystem. This adds an extremely basic and
slightly horrible linter to check SBT's output for warnings and errors.

Test Plan:
Tested this with a Scala project I've been working on for some time.
It seemed relatively sane.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4064

13 years agoImprove getting Git author
vrana [Thu, 29 Nov 2012 23:35:57 +0000 (15:35 -0800)]
Improve getting Git author

Summary:
It has one more than source, see http://www.kernel.org/pub/software/scm/git/docs/git-commit-tree.html#_commit_information.
Also 'user.name' may not be set at all.
Also `git config` returns non-zero for non-existing value.

Test Plan:
  var_dump($api->getAuthor());

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4053

13 years agoProvide a method for getting Git SVN revision
vrana [Fri, 30 Nov 2012 01:40:07 +0000 (17:40 -0800)]
Provide a method for getting Git SVN revision

Summary: I plan to use it in `save_lint.php`.

Test Plan:
  $api->getUnderlyingWorkingCopyRevision(); // In Git SVN repo

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4054

14 years agoPrefer Mercurial and Git over Subversion in discovering repository
vrana [Mon, 26 Nov 2012 22:45:50 +0000 (14:45 -0800)]
Prefer Mercurial and Git over Subversion in discovering repository

Summary: `svn info` is the slowest command for discovering repository (up to 300 ms) and Subversion is probably the least used repository type with Arcanist. Let's discover it last.

Test Plan:
  $ arc lint --trace

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4039

14 years agoParse "--help" correctly in `arc`
epriestley [Thu, 22 Nov 2012 16:36:28 +0000 (08:36 -0800)]
Parse "--help" correctly in `arc`

Summary:
We delegate parsing to `PhutilArgumentParser` but then skip the parts of the code which do something with this flag.

In particular, `arc --help list` just runs `arc list`.

See https://github.com/facebook/arcanist/issues/58

Test Plan: Ran `arc --help`, `arc list --help`, `arc --help list`, `arc --help help --help`. Got expected help in all cases.

Reviewers: vrana, chad, btrahan

Reviewed By: chad

CC: aran
Differential Revision: https://secure.phabricator.com/D4023

14 years agoSet cache version per linter
vrana [Wed, 21 Nov 2012 22:52:50 +0000 (14:52 -0800)]
Set cache version per linter

Summary: Also delete cache with `--cache 0`.

Test Plan:
  $ arc lint --lintall --cache 1
  $ cat .git/arc/lint-cache.json
  $ arc lint --lintall --cache 1 # with debug output

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2036

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

14 years agoFix some arcanist warnings
epriestley [Thu, 22 Nov 2012 01:16:52 +0000 (17:16 -0800)]
Fix some arcanist warnings

Summary:
  - Rename some very old variables.
  - Wrap some contributed lines.

Test Plan: `arc lint` / `arc unit`. Viewed a diff in an uncacheable mode to verify intraline behavior.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4018

14 years agoFix getting changed files in Git
vrana [Wed, 21 Nov 2012 23:57:06 +0000 (15:57 -0800)]
Fix getting changed files in Git

14 years agoEmit advice for TODO in Phutil linter
vrana [Wed, 21 Nov 2012 23:30:42 +0000 (15:30 -0800)]
Emit advice for TODO in Phutil linter

Summary:
Let's try this.
It may be useful to see this together in Differential overview.

Test Plan: Linted a file with TODO.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T744

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

14 years agoAllow caching lint results
vrana [Wed, 21 Nov 2012 00:43:10 +0000 (16:43 -0800)]
Allow caching lint results

Summary:
There is one big decision: How to get linters version.
I've created `getCacheVersion()` which is supposed to be bumped every time engine or any linter is changed.
This is not very nice but the other alternative (detect this automatically) seems worse:

- The engine may be outside repo and may or may not be under version control so getting its version through something like `git log` may not be even possible.
- If it is in the same repo then every rebase will obsolete the whole cache.

Even though bumping the version manually is PITA I still think it's a better solution.

Test Plan:
  $ time arc lint --cache 1
  # verified file
  $ arc arc lint --cache 1
  # added some debug output to see the cached results
  # also observed better time (.57 s instead of 2.19 s)

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2036

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

14 years agoDon't amend commits with different author
vrana [Tue, 20 Nov 2012 18:43:19 +0000 (10:43 -0800)]
Don't amend commits with different author

Summary: Also delete extra newlines.

Test Plan:
  $ arc diff # on top of my commit

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2025

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

14 years agoChange lint_engine to lint.engine
vrana [Tue, 20 Nov 2012 23:37:31 +0000 (15:37 -0800)]
Change lint_engine to lint.engine

Summary: Also unit_engine.

Test Plan: None.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, aurelijus
Differential Revision: https://secure.phabricator.com/D4001

14 years agoDon't use empty commit message in commit from `arc diff`
vrana [Mon, 19 Nov 2012 22:14:38 +0000 (14:14 -0800)]
Don't use empty commit message in commit from `arc diff`

Summary:
There was a bug in Git: https://github.com/git/git/commit/d9a935

Also fix a bug with discovering existing commits.

Test Plan:
  $ arc diff # yes
  # abort
  $ arc diff # didn't see fatal

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2025

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

14 years agomake arcanist backwards compatible with various conduit versions
Bob Trahan [Tue, 20 Nov 2012 01:32:09 +0000 (17:32 -0800)]
make arcanist backwards compatible with various conduit versions

Summary: pragmatism wins the day, though I think eventually we might want something really fancy to deal with arcanist and conduit not being up to date with respect to one another

Test Plan: php -l

Reviewers: epriestley

Reviewed By: epriestley

CC: zeeg, aran, Korvin
Maniphest Tasks: T2088

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

14 years agoReintroduce `arc diff --advice`
vrana [Mon, 19 Nov 2012 21:20:44 +0000 (13:20 -0800)]
Reintroduce `arc diff --advice`

Summary:
Some users want be stopped even if there are lint advices.

NOTE: Deleted by D3364.

Test Plan:
On diff with lint advice:

  $ arc diff --preview # advice just printed
  $ arc diff --preview --advice # excuse required

Reviewers: epriestley

Reviewed By: epriestley

CC: akramer, aran, Korvin
Differential Revision: https://secure.phabricator.com/D3982

14 years agoAllow running `arc diff` without `git commit`
vrana [Thu, 15 Nov 2012 20:33:36 +0000 (12:33 -0800)]
Allow running `arc diff` without `git commit`

Summary:
There's quite some logic in here:

- It automatically decides whether to create a new commit or amend.
- It partially respects 'default-relative-commit'.
- However if it points to a closed revision then it creates a new commit.

Resolves T2025.

Test Plan:
`arc diff` on:

- Clean committed repository.
- Dirty repository without commit since 'default-relative-commit'.
- Dirty repository with non-revision commit since 'default-relative-commit'.
- Dirty repository with revision commit since 'default-relative-commit'.
- `arc diff HEAD^` on dirty repository on top of closed revision.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2025

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

14 years agoRevert "accommodate git's diff.suppress-blank-empty=true setting (D3963)"
epriestley [Thu, 15 Nov 2012 23:47:43 +0000 (15:47 -0800)]
Revert "accommodate git's diff.suppress-blank-empty=true setting (D3963)"

Summary: Reverts D3963, which is obsoleted by D3969.

Test Plan: Straight revert.

Reviewers: vrana, jiiix, btrahan

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D3970

14 years agoAllow ArcanistDiffParser to parse `diff.suppress-blank-empty` Git diffs
epriestley [Thu, 15 Nov 2012 23:47:35 +0000 (15:47 -0800)]
Allow ArcanistDiffParser to parse `diff.suppress-blank-empty` Git diffs

Summary: See D3963. Instead, parse these diffs so they'll work with `--raw`, etc.

Test Plan:
Generated a failing diff, added it as a test case. Fixed issue. Ran test suite. Ran `arc` against it:

  $ git -c diff.suppress-blank-empty=true diff HEAD | arc diff --raw --only --conduit-uri=http://local.aphront.com:8080/
  Reading diff from stdin...
  Created a new Differential diff:
          Diff URI: http://local.aphront.com:8080/differential/diff/103/

  Included changes:
    M       things

Reviewers: vrana, jiiix, btrahan

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D3969

14 years agoaccommodate git's diff.suppress-blank-empty=true setting
Jim Meyering [Tue, 13 Nov 2012 01:34:00 +0000 (17:34 -0800)]
accommodate git's diff.suppress-blank-empty=true setting

Summary:
accommodate git's diff.suppress-blank-empty=true setting
Without this change, if you were to set diff.suppress-blank-empty=true
in your .gitconfig (as I do), then "arc diff" would always fail with the
cryptic diagnostic, "Diff Parse Exception: Found the wrong number of
hunk lines."

Test Plan:
Put this in ~/.gitconfig or .git/config
[diff]
         suppress-blank-empty = true
and run "arc lint".  It should pass.  Without this chnage,
it would fail as described above.

Reviewers: vrana, epriestley

Reviewed By: vrana

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3963

14 years agoIntroduce `arc lint --severity warning`
vrana [Fri, 9 Nov 2012 03:29:40 +0000 (19:29 -0800)]
Introduce `arc lint --severity warning`

Summary: I plan to exclude advices from our saved results.

Test Plan:
  $ arc lint src/lint/engine/PhutilLintEngine.php
  $ arc lint --severity advice src/lint/engine/PhutilLintEngine.php
  $ arc lint --severity error src/lint/engine/PhutilLintEngine.php

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2038

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

14 years agoProvide repository API method for getting changed files
vrana [Fri, 9 Nov 2012 07:26:27 +0000 (23:26 -0800)]
Provide repository API method for getting changed files

Test Plan:
  print_r($api->getChangedFiles('HEAD~36')); // Under Git.

Verified that deleted files are false.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2038

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

14 years agoProvide repository API method for getting all files
vrana [Fri, 9 Nov 2012 07:22:29 +0000 (23:22 -0800)]
Provide repository API method for getting all files

Test Plan:
  print_r(iterator_to_array($api->getAllFiles())); // Under Git.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2038

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

14 years agomake arc patch workflow preserve author commit information
Bob Trahan [Fri, 9 Nov 2012 21:36:15 +0000 (13:36 -0800)]
make arc patch workflow preserve author commit information

Summary: assumes D3917 (or something like it that populates 'author' value from conduit call) exists in production

Test Plan: stubbed out 'author' value and verified checkins as author worked

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T479

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

14 years agoArcanistBundle: fix attribution of $old_phid when building binary changes
Sergio Correia [Thu, 8 Nov 2012 19:33:28 +0000 (11:33 -0800)]
ArcanistBundle: fix attribution of $old_phid when building binary changes

Summary:
The variable $old_phid was not being set in a certain situation in
buildBinaryChange(), and that was causing the following error, during
`arc patch <revision>`:

"the patch applies to <file> (<hash>), which does not match the
current contents."

and hence it was failing to download/apply the patch.

Signed-off-by: Sergio Correia <sergio@correia.cc>
Test Plan:
I spotted the problem in a revision where I was renaming
some images, which are binary.

Reviewers: epriestley, vrana, btrahan

Reviewed By: btrahan

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3925

14 years agoPerformance improvements for linting in an HG repo.
keegancsmith [Wed, 7 Nov 2012 03:30:08 +0000 (19:30 -0800)]
Performance improvements for linting in an HG repo.

Summary:
Run `hg status` as a Future while getting the diff. Add a cache for
getRawDiffText().

Test Plan:
Run `arc lint --trace` on a HG repo and confirm that `diff` is only called once
and `status` is run in the background.

Reviewers: epriestley

Reviewed By: epriestley

CC: yliang, dpepper, aran, Korvin
Maniphest Tasks: T2016

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

14 years agoRemove getLink() from ArcanistLinterTestCase
vrana [Sat, 3 Nov 2012 01:09:38 +0000 (18:09 -0700)]
Remove getLink() from ArcanistLinterTestCase

Summary:
Installations extend this.

Another solution would be to extend `ArcanistLinterTestCase` from `ArcanistArcanistLinterTestCase` and return null in `getLink()` to avoid code duplication but I prefer clean class hierarchy.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3878