]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
14 years agoExamine only HEAD in amend workflow
vrana [Fri, 1 Jun 2012 23:39:09 +0000 (16:39 -0700)]
Examine only HEAD in amend workflow

Summary: We don't support `git rebase -i` or other magic in `arc amend` so we can examine just HEAD which we always amend.

Test Plan: `arc amend` on a branch with two commits.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2643

14 years agoRender chevrons and carets in lint output for messages without "original" text
epriestley [Fri, 1 Jun 2012 22:53:16 +0000 (15:53 -0700)]
Render chevrons and carets in lint output for messages without "original" text

Summary:
If a message has only "line", or "line" and "char", we don't point out the location in the context block.

When a message includes "line", show chevrons on the line.
When a message includes "line" and "char", show chevrons on the line and a caret on the next line.

Test Plan: Ran regex linters to capture line, line+char, and normal linters to capture everything. Output appeared sane.

Reviewers: csilvers, vrana, btrahan

Reviewed By: csilvers

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

14 years agoMove files in Arcanist one level up
vrana [Fri, 1 Jun 2012 18:41:04 +0000 (11:41 -0700)]
Move files in Arcanist one level up

Summary:
- `kill_init.php`
- Manually change library map.
- Manually rename `/data/` test dirs.
- [src/lint/linter] `git mv base/ArcanistLinterTestCase.php __tests__/`
- `arc liberate`

Test Plan: Browse around to make sure I like it better, especially `repository/api`, and `workflow`.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Maniphest Tasks: T1103

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

14 years agoFix `arc unit` when running from non-root directory
vrana [Fri, 1 Jun 2012 17:59:34 +0000 (10:59 -0700)]
Fix `arc unit` when running from non-root directory

Summary:
`$this->getPaths()` gives us paths relative to repository root.
We resolve them relative to cwd.

Test Plan: [src] `arc unit difference`

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2634

14 years agoSimplify diff excuses
vrana [Fri, 1 Jun 2012 05:57:29 +0000 (22:57 -0700)]
Simplify diff excuses

Summary:
The theory is that lint and unit errors are rare with no false positives.
Our reality is currently different.

This diff removes the question for providing explanation before actually providing it.
I hope that the wording is not confusing.

It also simplifies the code with less copy/paste errors (not me!) potential.

Test Plan:
`arc diff` on code with lint and unit errors.
Repeat with `--excuse .`.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin, meitros
Differential Revision: https://secure.phabricator.com/D2631

14 years agoPrime SVN in parallel
vrana [Fri, 1 Jun 2012 07:15:52 +0000 (00:15 -0700)]
Prime SVN in parallel

Summary: Same as D2629.

Test Plan: None.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2632

14 years agoRun xhpast in parallel
vrana [Thu, 31 May 2012 22:11:22 +0000 (15:11 -0700)]
Run xhpast in parallel

Summary: I wonder if this is not by purpose?

Test Plan: Modified two files, ran `arc lint`.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2629

14 years agoAdd "ArcanistSingleLintEngine" and "ArcanistScriptAndRegexLinter"
epriestley [Thu, 31 May 2012 19:09:01 +0000 (12:09 -0700)]
Add "ArcanistSingleLintEngine" and "ArcanistScriptAndRegexLinter"

Summary:
Request from @csilvers. Allow installs to get most linter features with regexes, configuration and external scripts if they are hesitant to write phutil libraries.

  - Add "ArcanistSingleLintEngine", which implements the smallest possible engine behavior (run one linter on every path).
  - Add "ArcanistScriptAndRegexLinter", which uses a script and a regex to parse lint output from other scripts.

Depends on D2618.

Test Plan:
Basics:

  $ arc set-config lint.engine ArcanistSingleLintEngine
  Set key 'lint.engine' = 'ArcanistSingleLintEngine'.
  $ arc set-config lint.engine.single.linter ArcanistScriptAndRegexLinter
  Set key 'lint.engine.single.linter' = 'ArcanistScriptAndRegexLinter'.
  $ arc set-config linter.scriptandregex.script 'echo derp #'
  Set key 'linter.scriptandregex.script' = 'echo derp #'.
  $ arc set-config linter.scriptandregex.regex '/^(?P<message>.*)$/m'
  Set key 'linter.scriptandregex.regex' = '/^(?P<message>.*)$/m'.
  $ arc lint
  >>> Lint for .arcconfig:

     Error  (S&RX) Lint
      derp

                 1 {
                 2   "project_id" : "arcanist",
                 3   "conduit_uri" : "https://secure.phabricator.com/",

Throw:

  $ arc set-config linter.scriptandregex.regex '/^(?P<throw>.*)$/m'
  Set key 'linter.scriptandregex.regex' = '/^(?P<throw>.*)$/m' (was '/^(?P<message>.*)$/m').
  $ arc lint
  Usage Exception: ArcanistScriptAndRegexLinter: configuration captured a 'throw' named capturing group, 'derp'. Script output:
  derp

Ignore:

  $ arc set-config linter.scriptandregex.regex '/^(?P<ignore>.*)$/m'
  Set key 'linter.scriptandregex.regex' = '/^(?P<ignore>.*)$/m' (was '/^(?P<throw>.*)$/m').
  $ arc lint
   OKAY  No lint warnings.

Severity:

  $ arc set-config linter.scriptandregex.regex '/^(?P<warning>.)(?P<message>.*)$/m'
  Set key 'linter.scriptandregex.regex' = '/^(?P<warning>.)(?P<message>.*)$/m' (was '/^(?P<ignore>.*)$/m').
  $ arc lint
  >>> Lint for src/lint/engine/single/ArcanistSingleLintEngine.php:

     Warning  (S&RX) Lint
      erp

                 1 <?php
                 2
                 3 /*

Reviewers: csilvers, btrahan, vrana

Reviewed By: csilvers

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

14 years agoAllow global config to load libraries and set test engines
epriestley [Thu, 31 May 2012 18:41:39 +0000 (11:41 -0700)]
Allow global config to load libraries and set test engines

Summary:
Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs.

  - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well.
  - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines.
  - Add some type checking to "arc set-config".
  - Add "arc set-config --show".

Test Plan:
  - **load**
    - Ran `arc set-config load xxx`, got error about format.
    - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it.
    - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked.
    - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries.
    - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded.
    - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library.
    - Set `.arcconfig` to point at a bad library, verified hard error.
  - **lint.engine** / **unit.engine**
    - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine.
    - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine.
  - **--show**
    - Ran `arc set-config --show`.
  - **misc**
    - Ran `arc get-config`.

Reviewers: csilvers, btrahan, vrana

Reviewed By: csilvers

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

14 years agoRun phutil unit tests in v2 libraries
epriestley [Thu, 31 May 2012 17:40:35 +0000 (10:40 -0700)]
Run phutil unit tests in v2 libraries

Summary:
Move away from setModule(), to setPathPrefix(). Also simplify test location/selection.

Depends on D2621.

Test Plan: Ran "arc unit".

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years agoUse ArcanistPhutilLibraryLinter, not ArcanistPhutilModuleLinter
epriestley [Thu, 31 May 2012 17:36:00 +0000 (10:36 -0700)]
Use ArcanistPhutilLibraryLinter, not ArcanistPhutilModuleLinter

Summary:
  - The library linter works fine on v1 or v2 libraries, so switch to it for all libraries.
  - "arc liberate" on v1 libraries will still invoke the Module linter, and thus generate __init__.php files.

Test Plan: Ran "arc lint". Grepped for module linter.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years agoRemove unnecessary usages of newv()
vrana [Wed, 30 May 2012 23:04:45 +0000 (16:04 -0700)]
Remove unnecessary usages of newv()

Test Plan:
  arc lint

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2611

14 years agoDepend on autoloading
vrana [Wed, 30 May 2012 22:47:16 +0000 (15:47 -0700)]
Depend on autoloading

Test Plan:
  arc lint

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2609

14 years agoRevert D2306
vrana [Wed, 30 May 2012 22:14:22 +0000 (15:14 -0700)]
Revert D2306

Summary: We don't use this concept.

Test Plan:
  arc lint

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Maniphest Tasks: T1103

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

14 years agoUpgrade arcanist to libphutil v2
epriestley [Wed, 30 May 2012 21:22:59 +0000 (14:22 -0700)]
Upgrade arcanist to libphutil v2

Summary: Mechanical changes from D2588. No "Class.php" moves yet because they aren't necessary for libraries to function.

Test Plan: See D2588.

Reviewers: vrana, btrahan, jungejason

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years agoAllow "arc liberate" to liberate v2 libraries and upgrade v1 -> v2
epriestley [Wed, 30 May 2012 21:18:11 +0000 (14:18 -0700)]
Allow "arc liberate" to liberate v2 libraries and upgrade v1 -> v2

Summary:
  - "arc liberate" now works for v1 or v2 libraries.
  - "arc liberate --upgrade" converts a v1 to a v2.
  - We delete __init__.php files but do not move Class.php files, since this is vastly simpler. Authors can do this on their own if they want. We'll do it separately.
  - v2 has less lint support than v1, but I think we can move first and migrate lint support later. Much of the v1 lint is bad anyway.

Test Plan: Upgraded libphutil, arcanist and phabricator to v2

Reviewers: vrana, btrahan, jungejason

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years agoRecover from all file upload exceptions; add "--skip-binaries" flag
epriestley [Wed, 30 May 2012 21:11:07 +0000 (14:11 -0700)]
Recover from all file upload exceptions; add "--skip-binaries" flag

Summary: We recover from Conduit exceptions, but not from transport exceptions or other general classes of error here. Recover from everything, and add an explicit flag to skip uploads.

Test Plan: Added a "throw", created a diff, skiped upload. Removed throw, created a diff with --skip-binaries. Created a diff normally.

Reviewers: btrahan, vrana

Reviewed By: vrana

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

14 years agoMinor, address feedback from @vrana on D2585.
epriestley [Wed, 30 May 2012 14:33:42 +0000 (07:33 -0700)]
Minor, address feedback from @vrana on D2585.

Auditors: vrana

14 years agoAdd "ArcanistPhutilLibraryLinter" to replace "ArcanistPhutilModuleLinter"
epriestley [Wed, 30 May 2012 14:25:09 +0000 (07:25 -0700)]
Add "ArcanistPhutilLibraryLinter" to replace "ArcanistPhutilModuleLinter"

Summary:
Adds a linter for v2 libraries which raises the relevant errors.

NOTE: Not hooked up anywhere yet, so this diff has no effect.

Test Plan:
Switched the ModuleLinter to LibraryLinter and ran it with a junk block to trigger errors:

  >>> Lint for src/lint/linter/phutillibrary/ArcanistPhutilLibraryLinter.php:

     Error  (PHL3) One Class Per File
      File 'lint/linter/phutillibrary/ArcanistPhutilLibraryLinter.php' mixes
      function (id) and class/interface (ArcanistPhutilLibraryLinter)
      definitions in the same file. A file which declares a class or an
      interface MUST declare nothing else.

               190 }
               191
               192 if (false) {
               193   function id() { }
               194   new XYZ();
               195 }

     Error  (PHL2) Duplicate Symbol
      Definition of function 'id' in
      'lint/linter/phutillibrary/ArcanistPhutilLibraryLinter.php' in library
      'arcanist' duplicates prior definition in 'utils/utils.php' in library
      'phutil'.

               190 }
               191
               192 if (false) {
               193   function id() { }
               194   new XYZ();
               195 }

     Error  (PHL1) Unknown Symbol
      Use of unknown class 'XYZ'. This symbol is not defined in any loaded
      libphutil library.

               191
               192 if (false) {
               193   function id() { }
               194   new XYZ();
               195 }

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years agoShorten excuse prompt in `arc diff`
vrana [Tue, 29 May 2012 19:48:31 +0000 (12:48 -0700)]
Shorten excuse prompt in `arc diff`

Test Plan: `arc diff` on a commit with lint error.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2595

14 years agoExport extends/implements information in the new libphutil library map
epriestley [Tue, 29 May 2012 18:17:34 +0000 (11:17 -0700)]
Export extends/implements information in the new libphutil library map

Summary:
For `PhutilSymbolLoader` queries which include `setAncestorClass()`, we need the map of which classes/interfaces things extend/implement to issue the query efficiently.

Without this map, we need to load //every// class/interface and then do `is_subclass_of()`. This is doable, but not very performant if we don't have php-fpm warmup. There are a few performance-sensitive interfaces where we run queries like this, including some in Arcanist, where we'll never have warmup.

This map isn't particularly difficult to generate or maintain, so just include it in symbol generation and in the library map.

Also set parallelism with a flag, since it was arbitrarily hard-coded and adding flags is easy. 8 actually seems approximately optimal on my machine at least, though.

Test Plan: Ran "phutil_rebuild_map.php", opened library map, got a reasonable extension map.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years agoProvide a simpler library map rebuild script
epriestley [Sun, 27 May 2012 19:57:27 +0000 (12:57 -0700)]
Provide a simpler library map rebuild script

Summary:
Modernize `phutil_mapper.php` to prepare for killing `__init__.php`.

The current mapper is module-oriented and complex. Instead, make the mapper file-oriented and simpler.

We build a one-to-one cache of file content to symbols (built with `phutil_symbols.php`) and then write a simpler map. See some discussion in D2561.

Also make the script less messy/bad in general. It may be useful to compare this to phutil_mapper.php.

(Additionally, we now write versions into the library map and cache.)

NOTE: Nothing can read this new map right now, of course.

Test Plan: Ran "phutil_rebuild_map.php src/" in phabricator/ with --quiet, --drop-caches, etc. Verified cache file, cache behavior, and generated map output.

Reviewers: vrana, nh, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years agoProvide api to get committed data in a hook
Nick Harper [Fri, 25 May 2012 22:28:45 +0000 (15:28 -0700)]
Provide api to get committed data in a hook

Summary:
We have a linter that needs to read data from the repo that isn't in the commit,
so that data isn't part of the svn transaction, thus not available in svnlook
cat --transaction. This change provides a method to get data from a committed
file.

Test Plan:
Successfully ran arc svn-hook-pre-commit with a linter that needs something
not in the transaction.

Reviewers: epriestley, jungejason, vrana

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2582

14 years agoUse phutil_console_prompt() instead of PhutilInteractiveEditor for excuses
vrana [Fri, 25 May 2012 17:52:26 +0000 (10:52 -0700)]
Use phutil_console_prompt() instead of PhutilInteractiveEditor for excuses

Summary:
One line is usually more than enough for these excuses.
The excuse is quite often the same as in past so history is very useful.
Prompting user right below the errors is better than writing them below prompt.

Test Plan:
Produce a lint error.
Provide an empty explanation.
Provide a non-empty explanation.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2580

14 years agoChange order of include_path
Nick Harper [Fri, 25 May 2012 17:08:28 +0000 (10:08 -0700)]
Change order of include_path

Summary:
With the current order of the include_path (checking in the parent dir of
arcanist last), it is possible to load the wrong libphutil which can have
bad side effects. Instead, the first place we check in include_path should
be the parent dir of arcanist.

(The issue I ran into is that I had a checkout of libphutil in my homedir,
and I was running arc from my homedir with --load-phutil-library to load
the libraries, and since ./ is the default value for include_path, we were
loading libphutil from my homedir instead of from alongside the copy of arc
that I was running. The libphutil alongside that copy of arc worked, but my
checkout of libphutil had D2545 in it, so it was broken.)

Test Plan:
ran arc (not in my homedir) with a broken libphutil in my homedir in my homedir
and it worked (before this change it didn't)

Reviewers: jungejason, vrana, epriestley

Reviewed By: vrana

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2576

14 years agoMerge pull request #34 from aurelijus/phpcs-linter
Evan Priestley [Fri, 25 May 2012 13:36:23 +0000 (06:36 -0700)]
Merge pull request #34 from aurelijus/phpcs-linter

PHPCS Linter

14 years agoFix whitespace
vrana [Fri, 25 May 2012 08:59:43 +0000 (01:59 -0700)]
Fix whitespace

I guess that the option does not have 'supports' to allow creating aliases working in all repos.

Auditors: beng

14 years agoInform user about current branch in diff
vrana [Fri, 25 May 2012 00:48:56 +0000 (17:48 -0700)]
Inform user about current branch in diff

Summary: I am trying to stop using `--verbatim` and miss this information.

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2575

14 years agoDon't trim spaces in diff template
vrana [Thu, 24 May 2012 18:48:59 +0000 (11:48 -0700)]
Don't trim spaces in diff template

Summary:
`arc diff` adds a space after each field in template.
It is later removed for the last field.

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2564

14 years agoProvide a simpler analyzer script for killing __init__.php
epriestley [Thu, 24 May 2012 17:56:56 +0000 (10:56 -0700)]
Provide a simpler analyzer script for killing __init__.php

Summary:
The `phutil_analyzer.php` script currently analyzes entire modules and is fairly complex. We don't need or want this in a post-__init__.php world.

This is basically a simplified version of `phutil_analyzer.php`, which takes one file and emits symbols.

Test Plan:
```$ ./scripts/phutil_symbols.php resources/test/diverse_symbols.php
{
  "have" : {
    "function"  : {
      "f" : 348
    },
    "class"     : {
      "L"      : 308,
      "A"      : 497,
      "C"      : 509,
      "D"      : 531,
      "CLocal" : 627
    },
    "interface" : {
      "ILocal" : 593
    }
  },
  "need" : {
    "function"  : {
      "g" : 402,
      "h" : 462
    },
    "class"     : {
      "B"         : 519,
      "INonlocal" : 642,
      "U"         : 552,
      "X"         : 421,
      "V"         : 557,
      "W"         : 565,
      "P"         : 572
    },
    "interface" : {
      "IForeign" : 608
    }
  }
}```

Reviewers: vrana, nh, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years agoMerge pull request #32 from aurelijus/phpunit-simplify-names
Evan Priestley [Thu, 24 May 2012 14:09:09 +0000 (07:09 -0700)]
Merge pull request #32 from aurelijus/phpunit-simplify-names

Simplify phpunit test names

14 years agoMerge pull request #31 from aurelijus/filename-linter-windows
Evan Priestley [Thu, 24 May 2012 14:05:08 +0000 (07:05 -0700)]
Merge pull request #31 from aurelijus/filename-linter-windows

Filename linter fix for Windows

14 years agoPHPCS Linter
Aurelijus [Thu, 24 May 2012 08:51:44 +0000 (10:51 +0200)]
PHPCS Linter

Summary:
Simple wrapper for PHP_CodeSniffer.
You need to have PHP_CodeSniffer and it's dependencies installed.

Test Plan: - Try running it with your custom lint engine

Reviewers: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2560

14 years agoFilename linter fix for Windows
Aurelijus [Thu, 24 May 2012 08:13:20 +0000 (10:13 +0200)]
Filename linter fix for Windows

Summary: On windows paths are separated with \.

Test Plan: - Run filename linter on windows (or some path with \)

Reviewers: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2559

14 years agoAllow users to define shell aliases in arc with "!"
epriestley [Thu, 24 May 2012 00:52:37 +0000 (17:52 -0700)]
Allow users to define shell aliases in arc with "!"

Summary: Git supports this feature (https://git.wiki.kernel.org/index.php/Aliases), it's fairly simple to implement, and gives us a little more ammunition to dissuade users with unusual workflow requirements from actually requesting features.

Test Plan: Defined the alias described in the documentation. Ran "arc ls", "arc ls -alh", etc.

Reviewers: btrahan, csilvers

Reviewed By: csilvers

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

14 years agoFix arc ArcanistSvnHookPreCommitWorkflow
Jason Ge [Wed, 23 May 2012 23:26:20 +0000 (16:26 -0700)]
Fix arc ArcanistSvnHookPreCommitWorkflow

Summary:
there are two problems making the ArcanistSvnHookPreCommitWorkflow not working.

  - pathExists($path) will always return false because it hasn't loaded the path yet. Because of this, PhutilLintEngine will unset the path at https://secure.phabricator.com/diffusion/ARC/browse/master/src/lint/engine/phutil/PhutilLintEngine.php;032b9b30b0721c3f$46, so ArcanistSvnHookPreCommitWorkflow will have no path to lint against and never detects a problem.
  - In ArcanistSubversionHookAPI::getCurrentFileData(), the $path is already the full path in svnroot (path got from https://secure.phabricator.com/diffusion/ARC/browse/master/src/workflow/svn-hook-pre-commit/ArcanistSvnHookPreCommitWorkflow.php;032b9b30b0721c3f$72). Prepending the project root to it will make the file path to be wrong so that the file content is empty. Again, ArcanistSvnHookPreCommitWorkflow never detects a problem.

Test Plan:
changed --transaction to --revision in related code and manually ran the following command. It detected the syntaxt error correctly. 558937 is a revision with syntax error.

/usr/local/bin/php -f /home/jungejason/nfs_devtools/arcanist/bin/arc svn-hook-pre-commit     --load-phutil-library=/tmp/testwww/www/lib/arcanist --load-phutil-library=/home/jungejason/nfs_devtools/facebook/src /svnroot 558937 2>&1

Reviewers: epriestley, nh

Reviewed By: nh

CC: aran, Girish, Koolvin
Differential Revision: https://secure.phabricator.com/D2485

14 years agoImprove example linter to not lint deleted paths
Nick Harper [Wed, 23 May 2012 21:53:37 +0000 (14:53 -0700)]
Improve example linter to not lint deleted paths

Summary:
It's easy to forget to do this when writing a new lint engine (like I recently
just did), so I added it to the example to improve documentation on how to write
a lint engine. This code is copied from PhutilLintEngine (as well as many
others).

Test Plan: php -l

Reviewers: jungejason, vrana, epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2553

14 years agoRemind user about 'arc amend' when they try to land a branch onto itself
epriestley [Wed, 23 May 2012 18:40:20 +0000 (11:40 -0700)]
Remind user about 'arc amend' when they try to land a branch onto itself

Summary: If you develop in "master" and try to "arc land", you get an error. You can reasonably "arc amend" in this situation, most of the time. Give the user an explicit pointer.

Test Plan:
  $ arc land master
  Usage Exception: You can not land a branch onto itself -- you are trying to
  land 'master' onto 'master'. For more information on how to push changes, see
  'Pushing and Closing Revisions' in 'Arcanist User Guide: arc diff' in the
  documentation. You may be able to 'arc amend' instead.

Reviewers: csilvers, btrahan

Reviewed By: csilvers

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

14 years agoSimplify phpunit test names
Aurelijus [Wed, 23 May 2012 09:53:17 +0000 (11:53 +0200)]
Simplify phpunit test names

Summary:
More & more use cases come up with empty suite names, guessing
and making test names nice is mess. Will leave it as it is, except
data set part, as it could be super long.

Test Plan: - Try running some phpunit tests with & without data sets

Reviewers: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2544

14 years agoAdd "--reviewers" and "--ccs" flags to arc diff
epriestley [Tue, 22 May 2012 21:38:53 +0000 (14:38 -0700)]
Add "--reviewers" and "--ccs" flags to arc diff

Summary: Request from @csilvers, whose team is alergic to $EDITOR.

Test Plan:
Adding reviewers and CCs to this diff via CLI. The initial commit message for this diff is:

  Add "--reviewers" and "--ccs" flags to arc diff

  Request from @csilvers, whose team is alergic to $EDITOR.

  Tested: Adding reviewers and CCs to this diff via CLI. The initial commit message for this diff is:
  (...infinite recursion omitted...)

Reviewers: csilvers, btrahan

Reviewed By: csilvers

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

14 years agoImprove default fill of Differential messages from commits
epriestley [Tue, 22 May 2012 18:08:57 +0000 (11:08 -0700)]
Improve default fill of Differential messages from commits

Summary:
  - When you run "arc diff" in Mercurial, we currently give you an empty template. Instead, prefill a likely template by parsing messages, as we do for Git.
  - Unify Git and Mercurial logic for acquiring messages, since `getLocalCommitInformation()` now provides this information. This should improve Git performance, and allows us to delete some code.
  - Merge messages more intelligently. Currently, we just overwrite fields. Instead, merge arrays (like ccs, reviewers, tasks) and concatenate strings (like summary and test plan). We need to special case "title", see inline.
  - @csilvers: this is a precursor to implementing "--reviewers", etc.

Test Plan: See next post, test plan includes giant output.

Reviewers: btrahan, csilvers, Makinde, jungejason, vrana

Reviewed By: csilvers

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

14 years agoPHPUnit test name handling improvements
Aurelijus [Tue, 22 May 2012 15:24:01 +0000 (17:24 +0200)]
PHPUnit test name handling improvements

Summary:
Better test name handling for tests with data sets.
Instead of showing test name with full data set, show it's id/name,
e.g. `testConstructor with data set #1`

Test Plan: - Try running tests with data sets

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2535

14 years agoPHPUnit test engine
Aurelijus [Tue, 15 May 2012 13:12:10 +0000 (15:12 +0200)]
PHPUnit test engine

Summary:
PHPUnit wrapper for arc.
The idea here is simple - find the test case which is related to the updated
class file. Generate tmp files for json & clover reports, run phpunit
with provided arguments.
It supports phpunit configuration file setting in `.arcconfig`: `phpunit_config`.
Path should be relative to project root.

Test Plan:
- Set `unit_engine` to `PhpunitTestEngine`
- Try running tests with & without `phpunit_config` option.

Reviewers: epriestley, davidreuss

Reviewed By: epriestley

CC: aran, Koolvin, jungejason
Differential Revision: https://secure.phabricator.com/D2472

14 years agoBump Conduit client version conduit-5
epriestley [Mon, 21 May 2012 23:45:03 +0000 (16:45 -0700)]
Bump Conduit client version

Summary:
Several related changes:

  - Add a "--conduit-version" flag, so you can actually diff conduit version bumps. Otherwise, the server rejects you.
  - Make "arc upgrade" upgrade both libphutil and arcanist, not just arcanist.
  - Bump the version number to 5. See D2527.

Test Plan:
  - Ran "arc upgrade".
  - Ran "arc diff". Got told there was a version issue.
  - Ran "arc diff --conduit-version=4" to create this diff.

Reviewers: indiefan, nh, vrana, btrahan, jungejason, Makinde

Reviewed By: vrana

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

14 years agoDispatch a "diff.willBuildMessage" event from Arcanist conduit-4
epriestley [Sun, 20 May 2012 23:39:38 +0000 (16:39 -0700)]
Dispatch a "diff.willBuildMessage" event from Arcanist

Summary:
Hive has custom integration which relies on prefilling a bunch of information from JIRA. This is currently broken and accomplished in a roundabout way. Instead, add an event that the integration can listen for. See next diff.

@Girish, I guess you're official Phabricator/Hive support now?

Test Plan: Ran the Hive/JIRA workflows in Git and SVN, see next diff.

Reviewers: Girish, btrahan, ashutoshc

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T1206

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

14 years agoSay until when the reviewers are away
vrana [Fri, 18 May 2012 17:27:44 +0000 (10:27 -0700)]
Say until when the reviewers are away

Test Plan: `arc diff` with reviewers away.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

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

14 years agoWarn user about specifying reviewers that are away
vrana [Fri, 18 May 2012 02:27:24 +0000 (19:27 -0700)]
Warn user about specifying reviewers that are away

Summary:
There are different options how to implement this:
We can also generate the warning in `validateField()` and handle it in all callsites.
This is sufficient for me and simple enough.

Test Plan: `arc diff` revision with reviewer away/not away.

Reviewers: btrahan, jungejason

Reviewed By: jungejason

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

14 years agoMerge pull request #28 from phleet/hg-multiple-heads
Evan Priestley [Thu, 17 May 2012 17:42:17 +0000 (10:42 -0700)]
Merge pull request #28 from phleet/hg-multiple-heads

Make arc diff work with multiple heads in hg

14 years agoMake arc diff work with multiple heads in hg
Jamie Wong [Thu, 17 May 2012 15:55:55 +0000 (11:55 -0400)]
Make arc diff work with multiple heads in hg

14 years agoMerge pull request #27 from phleet/hg-bookmark
Evan Priestley [Thu, 17 May 2012 16:52:56 +0000 (09:52 -0700)]
Merge pull request #27 from phleet/hg-bookmark

Make arc diff not crash on hg bookmarks

14 years agoMake arc diff not crash on hg bookmarks
Jamie Wong [Wed, 16 May 2012 17:24:30 +0000 (13:24 -0400)]
Make arc diff not crash on hg bookmarks

14 years agoProvide user-friendly error in arc diff --update
Nick Harper [Sat, 12 May 2012 01:40:02 +0000 (18:40 -0700)]
Provide user-friendly error in arc diff --update

Summary:
If you forget to provide an argument for --update and have another argument
following it (e.g. HEAD^), we should provide a nice error message instead
of passing that argument through to a conduit call and then printing the
conduit error.

Test Plan: ran 'arc diff --update HEAD^' and got a nice error message

Reviewers: epriestley, jungejason, vrana

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2468

14 years agoFix "local commits" for Git and Mercurial to align with user expectations, and fix...
epriestley [Fri, 11 May 2012 20:52:14 +0000 (13:52 -0700)]
Fix "local commits" for Git and Mercurial to align with user expectations, and fix a parsing bug

Summary:
  - "git log" still includes "\n", so we're currently generating nonsense hashes like "\nabd9879bab86ad78ab...".
  - Correct the log range we use in Git. See comment. When users perform merges, their expectations about what the "included commits" and what the included changes are are different. Represent them with two different ranges.
  - Same deal for Mercurial

Test Plan: Ran "arc which" in various contexts.

Reviewers: btrahan, aurelijus, Makinde

Reviewed By: Makinde

CC: aran, nh, jungejason
Maniphest Tasks: T873

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

14 years agoMake "arc which" really really really verbose
epriestley [Fri, 11 May 2012 13:07:33 +0000 (06:07 -0700)]
Make "arc which" really really really verbose

Summary: Provide far more information about what "arc diff" intends to do.

Test Plan: Ran "arc which" in a variety of circumstances.

Reviewers: btrahan, Makinde

Reviewed By: Makinde

CC: aran
Maniphest Tasks: T1183

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

14 years agoRemove arc export's dependency on a working copy when using --diff
Nick Harper [Fri, 11 May 2012 00:24:59 +0000 (17:24 -0700)]
Remove arc export's dependency on a working copy when using --diff

Summary:
When getting an encoding, we should query the server for the encoding of the
project that we're exporting from, not the project that we're running arc in
(arc might not be in a working copy).

Test Plan: ran arc export with --diff and didn't get a workflow exception

Reviewers: epriestley, jungejason, vrana, davidreuss

Reviewed By: jungejason

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2455

14 years agoarc land: add --delete-remote, raise an error for landing a branch onto itself
epriestley [Thu, 10 May 2012 19:14:53 +0000 (12:14 -0700)]
arc land: add --delete-remote, raise an error for landing a branch onto itself

Summary:
  - Allow users to delete the remote copy of a feature branch as well as the local one, for workflows that push feature branches. We test if the remote exists before trying to delete it.
  - Raise a better warning when you misuse "arc land".
  - I also wrote some documentation about this, see next diff.

Test Plan:
  - Tried to land a branch onto itself.
  - Ran "arc land --delete-remote" on feature branches with and without remote feature branches.

Reviewers: aurelijus, btrahan

Reviewed By: aurelijus

CC: aran
Maniphest Tasks: T1204

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

14 years agoFix 'rev' index error for Mercurial
epriestley [Thu, 10 May 2012 18:43:21 +0000 (11:43 -0700)]
Fix 'rev' index error for Mercurial

Summary: I renamed this in D2437 for greater consistency with everything else, but missed this use of the old key.

Test Plan: idk lmk?

Reviewers: Makinde

Reviewed By: Makinde

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

14 years agoShip complete commit messages to Phabricator from Arcanist
epriestley [Wed, 9 May 2012 22:56:16 +0000 (15:56 -0700)]
Ship complete commit messages to Phabricator from Arcanist

Summary: Currently, we ship only the summary, but we need to ship the whole thing for T1189.

Test Plan: Added var_dump() + die, ran in git and hg working copies, verified 'message' included the whole message.

Reviewers: csilvers, btrahan, Makinde

Reviewed By: csilvers

CC: aran
Maniphest Tasks: T1189

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

14 years ago"arc upgrade", to automatically upgrade arc (client changes)
epriestley [Wed, 9 May 2012 17:01:31 +0000 (10:01 -0700)]
"arc upgrade", to automatically upgrade arc (client changes)

Summary:
  - Try to limit the pain of //future// version bumps by making arc self-updating.
  - When the server needs a newer version, prompt the user to update.
  - (We need them to reissue their command because we may already have loaded classes which have changed in the update.)
  - Make the message sound exciting!

Test Plan: Artifically bumped server forward, ran "arc list", got to upgrade!

Reviewers: Makinde, nh, jungejason, btrahan

Reviewed By: nh

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

14 years agoCatch ArcanistUsageException when getting git parent log info
Nick Harper [Tue, 8 May 2012 23:31:26 +0000 (16:31 -0700)]
Catch ArcanistUsageException when getting git parent log info

Summary:
ArcanistDiffWorkflow::getGitParentLogInfo() calls
ArcanistDifferentialCommitMessage::newFromRawCorpus() which may throw a
ArcanistUsageException if the parent commit message is malformed (specifically,
a bad "Differential Revision:" line); this should not stop arc diff.

Test Plan: successfully ran arc diff where the parent commit message was malformed.

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2434

14 years agoAllow --verbatim and -m in arc diff
Nick Harper [Mon, 7 May 2012 23:11:15 +0000 (16:11 -0700)]
Allow --verbatim and -m in arc diff

Summary:
There's no reason these should be exclusive: -m is used only on update for the
update message, and --verbatim doesn't affect the udpate message. It's also
useful to allow both of these, if say I want to update my test plan by editing
my git commit message and also provide a message for the update from the
command line.

Test Plan:
ran arc diff with --verbatim and -m and saw my message from -m was used, as
well as my updates in the commit message went through.

Reviewers: jungejason, epriestley, vrana

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2426

14 years agoAllow 'arc' to run without '.arcconfig'
epriestley [Mon, 7 May 2012 22:24:58 +0000 (15:24 -0700)]
Allow 'arc' to run without '.arcconfig'

Summary:
This is mostly an onboarding thing, but also allows "arc upload", "arc download", and "arc paste" to work anywhere on the system.

  - Try to read the Phabricator install URI from arc global config if we can't find ".arcconfig".
  - Build a WorkingCopy anyway if we can't find ".arcconfig", as long as we can find ".svn", ".git", or ".hg".
  - Make all the workflows handle "no project ID" at least somewhat gracefully.

Test Plan:
  - Ran "arc diff" in .arcconfig-less Mercurial, Git, and Subversion working copies.
  - Ran "arc upload" and "arc download" from my desktop.
  - Ran "arc paste" from somewhere random.
  - Cleared my config and hit the error, got useful instructions.

Reviewers: btrahan, csilvers

Reviewed By: csilvers

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

14 years agoProvide more context in "arc diff" messages in Git
epriestley [Mon, 7 May 2012 20:18:16 +0000 (13:18 -0700)]
Provide more context in "arc diff" messages in Git

Summary: These are the unambiguously-good changes from D2388. Show commits included in a revision in the editor in "arc diff".

Test Plan: Ran "arc diff", saw which commits were being included.

Reviewers: nh, jungejason, vrana, btrahan

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T1183

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

14 years agoAlways use git.default-relative-commit, if present
Nick Harper [Mon, 7 May 2012 00:03:32 +0000 (17:03 -0700)]
Always use git.default-relative-commit, if present

Summary:
Always use the value in git.default-relative-commit when getting the relative
commit in git.

Test Plan:
Ran arc diff in a repo with git.default-relative-commit set to HEAD^ on a
branch tracking a remote (that is different from HEAD^), and checked that
the diff against HEAD^, not the remote, was published.

Reviewers: jungejason, epriestley, vrana

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2409

14 years agoWith `--verbatim`, update some fields automatically when updating revisions
epriestley [Mon, 7 May 2012 15:16:29 +0000 (08:16 -0700)]
With `--verbatim`, update some fields automatically when updating revisions

Summary:
Essentially D2391, but with, uh, more comments?

  - I forgot that we already implemented shouldOverwriteWhenCommitMessageIsEdited(). This patch already behaves nearly correctly.
  - Requires changes in D2412.
  - Use `'edit' => 'edit'`, which does the same thing as `'edit' => true`, but is more correct after the "edit" / "create" split.
  - Under "--verbatim", always get the message "from the user", which means "from the working copy" because verbtatim disables the editor part.

Test Plan:
      - Created and updated revisions with `arc diff`.
      - Created and updated revisions with `arc diff --verbatim`.
      - Updated revisions with `arc diff --edit`.

Reviewers: jungejason, btrahan

Reviewed By: jungejason

CC: vrana, aran
Differential Revision: https://secure.phabricator.com/D2411

14 years agoFinish "Committed" -> "Closed" changes
epriestley [Mon, 7 May 2012 15:16:14 +0000 (08:16 -0700)]
Finish "Committed" -> "Closed" changes

Summary:
Clean up the remaining odds-and-ends here -- move to "differential.close", get rid of the old constant, etc.

I'll wait a week or two to land this since "differential.close" just landed and all the other stuff is trivial.

Test Plan: Grepped for "committed".

Reviewers: btrahan, vrana, Makinde

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T909, T1182

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

14 years agoAdd "arc get-config" and "arc set-config" for managing ~/.arcrc values
epriestley [Mon, 7 May 2012 13:07:23 +0000 (06:07 -0700)]
Add "arc get-config" and "arc set-config" for managing ~/.arcrc values

Summary:
The major thing I want to do here is allow you to set a default Phabricator URI, so we can make "arc paste", and "arc upload", "arc download" work anywhere.

We can also relax the .arcconfig requirements (request from @csilvers).

Test Plan:
Get/set some values?

iiam

Reviewers: btrahan, vrana, jungejason

Reviewed By: btrahan

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

14 years agoRemove git commit template from Arcanist
epriestley [Mon, 7 May 2012 13:06:53 +0000 (06:06 -0700)]
Remove git commit template from Arcanist

Summary: Out of date an no longer referenced.

Test Plan: Grepped for references.

Reviewers: btrahan, vrana

Reviewed By: btrahan

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

14 years agoExplicitly check for cURL in "arc"
epriestley [Mon, 7 May 2012 13:06:38 +0000 (06:06 -0700)]
Explicitly check for cURL in "arc"

Summary: We do this in Windows, but it's not available by default in Ubuntu

Test Plan: Ran "arc" after faking the function name, got a reasonable error.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

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

14 years agoClean up some "arc" edge cases in Mercurial
epriestley [Fri, 4 May 2012 22:46:10 +0000 (15:46 -0700)]
Clean up some "arc" edge cases in Mercurial

Summary:
  - We no longer need color options since we fake our way through parsing ANSI colorized diffs and use HGPLAIN (on Windows, too!). Drop 'em.
  - In the case where you have nothing outgoing, we don't cache the relative commit and thus run "hg outgoing" too many times, which is fairly slow (even if you have nothing outgoing). Cache it.

Test Plan: Ran "arc diff --trace" in a mercurial working copy with nothing outgoing; verified we run "hg outgoing" only once.

Reviewers: Makinde, csilvers, btrahan

Reviewed By: Makinde

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

14 years agoDocument first line behavior in update message
vrana [Fri, 4 May 2012 06:29:00 +0000 (23:29 -0700)]
Document first line behavior in update message

Test Plan: (This diff)

Reviewers: epriestley, jungejason

Reviewed By: jungejason

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2389

14 years agoDon't ask user to use saved message in `arc diff --verbatim`
vrana [Fri, 4 May 2012 07:08:42 +0000 (00:08 -0700)]
Don't ask user to use saved message in `arc diff --verbatim`

Test Plan:
Cancel `arc diff`.
Verify that the message is created.
Run `arc diff --verbatim` and see no reuse message question.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2390

14 years agoWarn before parse errors in `arc diff --verbatim`
vrana [Fri, 4 May 2012 19:22:47 +0000 (12:22 -0700)]
Warn before parse errors in `arc diff --verbatim`

Summary: With `--verbatim` flag, notes created from parse errors are never displayed to user resulting in blank fields.

Test Plan:
- `arc diff --verbatim` with invalid Cc
- `arc diff --verbatim` with all fields correct

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2395

14 years agoUpdated arc land workflow to use temp file approach for messages to avoid newline...
Marke Hallowell [Wed, 2 May 2012 23:48:44 +0000 (16:48 -0700)]
Updated arc land workflow to use temp file approach for messages to avoid newline escaping issue in windows.

Test Plan: Ran arc land locally with both the mutable default option and with the --merge flag to ensure that messages are set properly.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2372

14 years agoFix "HGPLAIN" environmental variable in Windows
epriestley [Wed, 2 May 2012 19:40:02 +0000 (12:40 -0700)]
Fix "HGPLAIN" environmental variable in Windows

Summary: In Windows, you can't use `X=y cmd` syntax to set variables. Use "set X=y & cmd" instead.

Test Plan:
  - Ran "arc diff" in a Mercurial repo in Windows, created D2367.
  - Verified this does //not// cause 'HGPLAIN' to be set in the outer shell (where you type "arc diff").

Reviewers: Makinde, tido, indiefan, btrahan

Reviewed By: tido

CC: aran
Maniphest Tasks: T1179

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

14 years agoUsing a temp file for git commit --amend instead of passing multi-line message to...
Marke Hallowell [Wed, 2 May 2012 19:39:12 +0000 (12:39 -0700)]
Using a temp file for git commit --amend instead of passing multi-line message to the shell. Avoids escaping issue on windows.

Test Plan: Run arc diff locally, verify via git log that the commit is amended afterwards (using the mutable history paradigm)

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2369

14 years agoHelp the analyzer find phutil_is_hiphop_runtime
Edward Speyer [Wed, 2 May 2012 01:12:15 +0000 (18:12 -0700)]
Help the analyzer find phutil_is_hiphop_runtime

Summary:
rPHUf9ba25d188c1dcf39e4454b2c6bb058e0beeaa3e adds
global function phutil_is_hiphop_runtime() to
__phutil_library_init__.php.  This diff helps lint files that call that
function.

Test Plan: Lint D2365.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2366

14 years agoDon't check working copy status for "arc commit --show"
epriestley [Tue, 1 May 2012 17:35:14 +0000 (10:35 -0700)]
Don't check working copy status for "arc commit --show"

Summary:
We do unnecessary working copy checks under "--show", even though the working copy isn't relevant.

Also, 'sourcePath' may not be set (e.g., "arc commit --show --revision X" where X is some "--only" revision).

Test Plan: Ran "arc commit --show --revision 1" against some test data, got clean output.

Reviewers: vrana, btrahan, jungejason

Reviewed By: vrana

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

14 years agoRemove "--no-decorate"
epriestley [Tue, 1 May 2012 00:28:04 +0000 (17:28 -0700)]
Remove "--no-decorate"

Summary: Apparently my advice here was terrible, and `--no-decorate` and `--decorate=no` are both very recent additions to Git which a bunch of users don't have. Get rid of them since D2344 allows us to parse all decorate levels anyway.

Test Plan: Tried to google "git changelog", got a bunch of pages about managing changelogs with git.

Reviewers: zeeg, ehren

Reviewed By: ehren

CC: ehren, aran, NorthIsUp
Differential Revision: https://secure.phabricator.com/D2354

14 years agoShow text of moved files in Differential
epriestley [Mon, 30 Apr 2012 23:47:12 +0000 (16:47 -0700)]
Show text of moved files in Differential

Summary:
"git diff -M -C" generates useful metadata (moves/copies) but (for a pure move) no diff text. Synthetically build the diff text after the fact so this information is available in Differential.

This patch is kind of nasty but I couldn't see a cleaner way to do it. :/

This also needs some UI changes in Differential: we get a full-green new file right now, but it would be better to default-hide it with "This file was moved. Show More" or similar.

Test Plan: Moved a file, ran "arc diff", got textual diff.

Reviewers: aran, tuomaspelkonen, jungejason, btrahan, vrana

Reviewed By: vrana

CC: aran, epriestley, vrana
Maniphest Tasks: T230

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

14 years agoadd support for using Arcanist with git's log.decorate setting enabled
Ehren Kret [Mon, 30 Apr 2012 21:14:23 +0000 (14:14 -0700)]
add support for using Arcanist with git's log.decorate setting enabled

Summary:
Arcanist fails to find git's 'commit <hash>' header when log.decorate is
set in one of git's config files. git adds the named refs that point to
the commit in parentheses following the hash. This changes the regex
used by arcanist to match git commit headers to optionally match the
branch names in parentheses following the hash.

Test Plan:
Run `git config --global log.decorate short` and check that `arc diff`
runs successfully.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2344

14 years agoUse Filesystem::getMimeType() in Arcanist
epriestley [Fri, 27 Apr 2012 19:48:47 +0000 (12:48 -0700)]
Use Filesystem::getMimeType() in Arcanist

Summary: Missed this when getting rid of all the 'file' calls.

Test Plan: Meta.

Reviewers: btrahan, vrana, jungejason

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1159

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

14 years agoWrapper for 'nose' unittest and code coverage tools.
Julius Seporaitis [Fri, 27 Apr 2012 19:11:41 +0000 (12:11 -0700)]
Wrapper for 'nose' unittest and code coverage tools.

Summary:
Wrapper for Python 'nose' (http://readthedocs.org/docs/nose/en/latest/)
testing tool.

Test Plan:
Install latest 'nose' v1.1.3. Currently it is available through
Github only (``pep install git+https://github.com/nose-devs/nose.git``).

Create a Python project with following structure:

  /package_name/module_name.py
  /tests/package_name/test_module_name.py

Write some tests

Run ``arc unit``

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin, zeeg
Differential Revision: https://secure.phabricator.com/D2322

14 years agoFix PhutilUnitTest issue with symlinks that point into a libphutil library
epriestley [Wed, 25 Apr 2012 23:13:04 +0000 (16:13 -0700)]
Fix PhutilUnitTest issue with symlinks that point into a libphutil library

Summary: Currently, if you change a symlink outside a libphutil library and the link target is something inside a libphutil library, we may enter an inifite loop in the "do { ... } while(...)" later. Just bail if the loop won't resolve.

Test Plan: Ran arc unit, Airtime reported the issue resolved by a similar fix.

Reviewers: cpiro, btrahan

Reviewed By: cpiro

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

14 years agoAllow tests to be skipped
Edward Speyer [Wed, 25 Apr 2012 02:16:45 +0000 (19:16 -0700)]
Allow tests to be skipped

Summary:
Allow tests to be skipped by calling assertSkipped().  It's not really
an assertion of anything tangible; more like "assert that we can't
really assert anything right now".

Test Plan: Added a new test to the PhutilUnitTestEngineTestCase.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2312

14 years agoLint libraries without __init__
vrana [Mon, 23 Apr 2012 17:49:23 +0000 (10:49 -0700)]
Lint libraries without __init__

Summary: After D2207.

Test Plan:
`arc lint` on D2208.
`arc lint` on mistyped class name.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Maniphest Tasks: T1103

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

14 years agoAutocomplete branches to "arc land"
epriestley [Mon, 23 Apr 2012 21:09:29 +0000 (14:09 -0700)]
Autocomplete branches to "arc land"

Summary:
  - Add branch name tab completion to "arc land".
  - Default to landing the current branch.
  - This is a little bit hacky but not too terrible. I'm planning to move the whole thing to PhutilArgumentParser at some point so that'll be an opportunity for a big refactor.

Test Plan: Hit tab, landed this branch.

Reviewers: zeeg, btrahan, vrana, jungejason

Reviewed By: btrahan

CC: aran, kdeggelman
Differential Revision: https://secure.phabricator.com/D2293

14 years ago[Tests] Only use concrete TestCases
Edward Speyer [Sun, 22 Apr 2012 20:06:32 +0000 (13:06 -0700)]
[Tests] Only use concrete TestCases

Summary:
Don't use abstract subclasses of ArcanistPhutilTestCase, only use
concrete ones.

This lets you put common functionality in an abstract BaseTestCase
(which itself is a subclass of ArcanistPhutilTestCase), then implement
concrete subclasses of the BaseTestCase.

Test Plan: Tested with a simple Base -> {Case1, Case2} setup.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2300

14 years agoRemove only trailing "#" and empty lines as comments from CLI editors
epriestley [Wed, 18 Apr 2012 13:08:41 +0000 (06:08 -0700)]
Remove only trailing "#" and empty lines as comments from CLI editors

Summary: Don't strip numbered lists in comment bodies, etc.

Test Plan: Unit tests, meta-testing this diff.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1124

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

14 years agoRename "arc mark-committed" to "arc close-revision"
epriestley [Tue, 17 Apr 2012 20:51:10 +0000 (13:51 -0700)]
Rename "arc mark-committed" to "arc close-revision"

Summary:
  - Replace SVN-specific language with VCS-agnostic language.
  - Add new "arc close-revision", works exactly like "arc mark-committed" but with agnostic language.
  - Use status constants, not status strings.
  - Mark "arc mark-committed" deprecated.
  - Remove deprecated "arc merge".

Test Plan: Ran "arc mark-committed", "arc close-revision".

Reviewers: btrahan, vrana, jungejason

Reviewed By: btrahan

CC: aran, Makinde
Maniphest Tasks: T909

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

14 years agoDon't advice using --less-context if already used
vrana [Fri, 13 Apr 2012 23:21:23 +0000 (16:21 -0700)]
Don't advice using --less-context if already used

Test Plan:
  arc diff
  arc diff --less-context

Reviewers: blair

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

14 years agoDrop <project + branch> herusitic from Git
epriestley [Fri, 13 Apr 2012 17:55:28 +0000 (10:55 -0700)]
Drop <project + branch> herusitic from Git

Summary: See rage in T1117. Don't use the <project + branch> heuristic anymore..

Test Plan: Ran "arc diff --strict HEAD^" on a commit stacked on top of this one, got no matches.

Reviewers: btrahan, vrana, simpkins, beng

Reviewed By: btrahan

CC: aran, avive
Maniphest Tasks: T1117

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

14 years agoFix some --only / --preview / SVN issues with Arcanist
epriestley [Thu, 12 Apr 2012 17:32:54 +0000 (10:32 -0700)]
Fix some --only / --preview / SVN issues with Arcanist

Summary:
  - Historically, "--preview" was forbidden under SVN. No reason for that now.
  - The "--auto" patch moved the "--preview" / "--only" checks later than they should be.
  - Fix an issue with Conduit query construction in SVN.

Test Plan: Ran "arc diff --preview" in an SVN working copy. Ran "arc diff" in an SVN working copy.

Reviewers: svemir, btrahan, vrana, jungejason

Reviewed By: svemir

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

14 years agoRead default relative commit from scratch file with newline
Git user [Thu, 12 Apr 2012 00:22:07 +0000 (17:22 -0700)]
Read default relative commit from scratch file with newline

Summary:
When people create the .arc/default-relative-commit scratchfile with $EDITOR of
choice, their editor usually puts a newline at the end, which breaks arc diff.
We should trim the newline before using the contents of the scratchfile.

Test Plan:
ran arc diff in a working copy that contained a .arc/default-relative-commit
with a newline

Reviewers: epriestley, jungejason

Reviewed By: epriestley

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

14 years agoDon't let "arc which" identify the working copy as belonging to a different project
epriestley [Tue, 10 Apr 2012 23:06:57 +0000 (16:06 -0700)]
Don't let "arc which" identify the working copy as belonging to a different project

Summary: If you have two projects (say, libphutil and arcanist) and you prepare a patch for one of them on branch "master", run "arc diff", and then prepare a patch for the other one on the same branch, "arc diff" will try to update the first revision when you run it. Instead, make it smart enough to stay within arc projects.

Test Plan: Ran "arc which" in circumstances where it previously generated a false positive, no false positive.

Reviewers: btrahan, vrana, jungejason

Reviewed By: jungejason

CC: aran
Maniphest Tasks: T1100

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

14 years agoIf a Git upstream is configured for the current branch, always use that as the defaul...
epriestley [Tue, 10 Apr 2012 22:33:31 +0000 (15:33 -0700)]
If a Git upstream is configured for the current branch, always use that as the default relative commit

Summary: See discussion in D1861.

Test Plan: Ran "arc diff" on master, got an upstream-based relative commit. Ran "arc diff" on a feature branch, got a config-based relative commit. Ran "arc diff x", got an argument-based relative commit.

Reviewers: btrahan, vrana, davidreuss, elgenie

Reviewed By: davidreuss

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

14 years agoAllow defining aliases in .arcconfig.
Ben Gertzfield [Tue, 10 Apr 2012 18:29:25 +0000 (11:29 -0700)]
Allow defining aliases in .arcconfig.

Summary:
For Objective-C repositories, we want to provide aliases to
arc diff --amend-autofixes by default.

This adds the ability to define aliases in .arcconfig (overridden
by any specified in the user config, of course).

Test Plan:
Tested defining alias with nothing in .arcconfig, with
an alias in .arcconfig.  Tested arc alias outside of working
repository.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoAdd ArcanistLintSeverity::SEVERITY_AUTOFIX.
Ben Gertzfield [Fri, 6 Apr 2012 19:23:19 +0000 (12:23 -0700)]
Add ArcanistLintSeverity::SEVERITY_AUTOFIX.

Summary:
Xcode (a popular code editor on Mac OS X) has no facility
to trim trailing whitespace automatically.

This adds a new lint severity "AUTOFIX" that's between
WARNING and ERROR. When running the linter, any lint message
whose severity is AUTOFIX will automatically be patched.

Furthermore, if all lint messages returned from the engine are
AUTOFIX, we'll automatically amend HEAD with the patch.

Test Plan:
arc lint on files with and without trailing whitespace,
with and without UTF-8 contents to confirm those still error

Reviewers: epriestley, jungejason

Reviewed By: epriestley

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

14 years agoMake --auto creates actually work in SVN and HG
epriestley [Tue, 10 Apr 2012 19:06:41 +0000 (12:06 -0700)]
Make --auto creates actually work in SVN and HG

Summary:
--auto doesn't work right now on the implicit --create pathway in SVN and HG because we hit these conditions.

Also improve a message.

Test Plan: Ran "arc diff" in unaffiliated working copies in HG and SVN.

Reviewers: svemir, btrahan, vrana, jungejason

Reviewed By: svemir

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

14 years agoFix docs links after D2181 and D2182
vrana [Tue, 10 Apr 2012 17:18:48 +0000 (10:18 -0700)]
Fix docs links after D2181 and D2182

Test Plan:
  diviner .

Reviewers: epriestley

Reviewed By: epriestley

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