]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
14 years ago[Arcanist] collect svn and bookmark info for Mercurial
dschleimer [Sat, 30 Jun 2012 23:00:48 +0000 (16:00 -0700)]
[Arcanist] collect svn and bookmark info for Mercurial

Summary:
This increases the amount of information arc diff collects in
Mercurial repositories.  IN particular, it collects the active
bookmark, if there is one, and svn information in hgsubversion
repositories.

The Phabricator half of this is https://secure.phabricator.com/D2897

Test Plan:
[14:06:59 Sat Jun 30 2012] dschleimer@dev4022.snc6 ~/www-hg
www-hg  2941 $ ~/devtools/arcanist/bin/arc diff --only --conduit-uri http://phabricator.dschleimer.dev4022.facebook.com
HipHop Notice:  Undefined index: 1 in /data/users/dschleimer/devtools/arcanist/src/repository/api/ArcanistMercurialAPI.php on line 708
Created a new Differential diff:
        Diff URI: http://phabricator.dschleimer.dev4022.facebook.com/differential/diff/126/

Included changes:
  A       foo
HipHop Notice:  Undefined index: 1 in /data/users/dschleimer/www-hg/lib/arcanist/arcanist/FacebookArcanistConfiguration.php on line 81
mcproxy on this server is out of date
version: , expected version:
please restart (http://fburl.com/1787362)

[14:07:46 Sat Jun 30 2012] dschleimer@dev4022.snc6 ~/www-hg
www-hg  2941 $ echo '{"diff_id": 126}' | ~/devtools/arcanist/bin/arc call-conduit differential.getdiff --conduit-uri http://phabricator.dschleimer.dev4022.facebook.com | json_pretty | egrep -i 'bookmark|sourcecontrol'
        "bookmark": "bar",
        "sourceControlBaseRevision": "svn+ssh://tubbs/svnroot/tfb/trunk/www@583442",
        "sourceControlPath": "svn+ssh://tubbs/svnroot/tfb/trunk/www",
        "sourceControlSystem": "hg",

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1331

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

14 years agoSupport "D123", not just "123", for "arc export --revision"
epriestley [Thu, 28 Jun 2012 01:33:28 +0000 (18:33 -0700)]
Support "D123", not just "123", for "arc export --revision"

Summary: We currently error if a user types "--revision D123".

Test Plan: `arc export --git --revision D123`, got a diff.

Reviewers: vrana, jungejason

Reviewed By: vrana

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

14 years agoImplement "git:branch-unique(*)" in the base commit DSL
epriestley [Wed, 27 Jun 2012 19:12:39 +0000 (12:12 -0700)]
Implement "git:branch-unique(*)" in the base commit DSL

Summary:
Add a DSL command to select the first commit between HEAD and (the merge-base of some target with HEAD) that's on more than one branch.

This is similar to @csilvers' suggestion in <https://secure.phabricator.com/T1233#comment-8>. A specific problem this address is that, currently, if you use this workflow:

  $ git checkout -b feature
  $ git commit
  $ git checkout -b subfeature
  $ git commit

..i.e., develop dependent features in sub-branches, "arc diff" will try to send up (feature + subfeature). If you use the rule 'git:branch-unique(origin/master)' instead, diffing from 'subfeature' will correctly select only the commit(s) on 'subfeature'.

Test Plan: Constructed feature/subfeature branches, verified that we select the correct base commit.

Reviewers: dschleimer, csilvers, btrahan, jungejason

Reviewed By: dschleimer

CC: aran
Maniphest Tasks: T1233

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

14 years agoAdd newline
vrana [Wed, 27 Jun 2012 18:21:19 +0000 (11:21 -0700)]
Add newline

14 years agoRemove PhutilModuleRequirements
epriestley [Wed, 27 Jun 2012 01:22:36 +0000 (18:22 -0700)]
Remove PhutilModuleRequirements

Summary: Yeah, we can nuke this.

Test Plan: Grepped for callsites.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years ago[Arcanist] add an arc:bookmark base for Mercurial
dschleimer [Tue, 26 Jun 2012 22:04:35 +0000 (15:04 -0700)]
[Arcanist] add an arc:bookmark base for Mercurial

Summary:
This adds a new base option that Does the Right Thing (or as close to
it as I can get) for someone using Mercurial bookmarks as lightweight
branches, and where each branch should be one differential revision.
Specifically, it walks backwards through the ancestors of the working
copy until it finds a revision that is either not outgoing (ie already
in the remote) or that is bookmarked.  This means that bookmarks
effectively act as delimiters, and point at the last revision that
will be included in an arc diff.

Test Plan:
[14:40:54 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1226 $ hg log -r '(first(outgoing())^)::' --template='node: {node}\nbookmark: {bookmarks}\n\n' -G
@  node: c8379ef32b0d0e6cf94fe636751ea4fe1353e157
|  bookmark:
|
| o  node: 14f03139049cbda339190b814e52f4ec8b05c431
| |  bookmark: more
| |
| o  node: 6970e9263ab8c6da428420606d1f15c9980da183
| |  bookmark: something
| |
| o  node: 433a93023f03d5f3eddaa243fa973d32a1566aee
|/   bookmark:
|
o  node: f47ccfe34267592dd2e336174a3a311b8783c024
|  bookmark:
|

[14:41:00 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1226 $ ~/devtools/arcanist/bin/arc which --show-base --base 'arc:bookmark'
f47ccfe34267592dd2e336174a3a311b8783c024

[14:41:05 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1226 $ hg up 14f03139049cbda339190b814e52f4ec8b05c431
3 files updated, 0 files merged, 1 files removed, 0 files unresolved

[14:41:10 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1226 $ ~/devtools/arcanist/bin/arc which --show-base --base 'arc:bookmark'
6970e9263ab8c6da428420606d1f15c9980da183

[14:41:14 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1226 $ hg up 6970e9263ab8c6da428420606d1f15c9980da183
0 files updated, 0 files merged, 1 files removed, 0 files unresolved

[14:41:44 Tue Jun 26 2012] dschleimer@dev4022.snc6 ~/hg-dummy
hg-dummy  1227 $ ~/devtools/arcanist/bin/arc which --show-base --base 'arc:bookmark'
f47ccfe34267592dd2e336174a3a311b8783c024

Reviewers: epriestley, bos

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1331

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

14 years agoRequire space after `//`
vrana [Thu, 21 Jun 2012 23:21:04 +0000 (16:21 -0700)]
Require space after `//`

Summary:
I use `//~` for marking places which shouldn't be committed.
It also looks ugly.
Maybe it can be just a warning but we provide a patch so error is OK?

Test Plan: New test.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoMinor, always show the current branch in "arc branch"
epriestley [Tue, 26 Jun 2012 19:45:47 +0000 (12:45 -0700)]
Minor, always show the current branch in "arc branch"

14 years agoRemove all libphutil v1 support
epriestley [Tue, 26 Jun 2012 19:40:42 +0000 (12:40 -0700)]
Remove all libphutil v1 support

Summary:
Delete all code related to v1 libraries in arcanist.

When users liberate a v1 library, prompt them to upgrade.

Test Plan: Reverted phabricator/ to a couple of months ago and liberated it. Got prompted to upgrade. Upgraded.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1103

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

14 years agoAdd various flags to the HgProxy daemons
epriestley [Tue, 26 Jun 2012 18:00:26 +0000 (11:00 -0700)]
Add various flags to the HgProxy daemons

Summary:
  - Add flags to exit after an idle time or client count.
  - Add flags to control daemonization.
  - Add flags to control output.
  - Add flags to skip the "hello" frame of the protocol.
  - Make the client launch a server if one does not exist.

The one-time overhead to launch a server and run a command through it looks to be ~130% of the overhead to run the command directly with "hg", so even if we never run a second command we're not paying too much.

The incremental overhead to run subsequent command appears to be less than 3% of the overhead to run the command directly with "hg" (and maybe less than 1%, I'm not sure how long the computation part of a command like 'hg log' "actually" takes).

The overhead to launch a PHP client, connect to an existing server, run a command, and then print it and exit is roughly 50% of the overhead to run the command directly with "hg". So theoretically a user can achieve an amortized 2x performance increase for all 'hg' commands by aliasing 'hg' to the PHP client in their shell.

Test Plan:
  - Ran servers with idle and client count limits, let them idle and/or hit their connection limits, saw them exit.
  - Ran foreground and background servers.
  - Ran a daemon server with redirected stdout/stderr. Verified logs appeared.
  - Ran with --quiet.
  - Ran clients and servers with and without --skip-hello, things work if they agree and break if they disagree. The throughput gain on this is fairly small (maybe 5%?) but it seems simple enough to keep for the moment.
  - Ran serverless clients and verified that servers launched the first time, were available subsequently, and relaunched after 15 seconds idle.

Reviewers: csilvers, vrana, btrahan

Reviewed By: csilvers

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

14 years agoSimplify "arc branch" and make it work in immutable history repositories
epriestley [Tue, 26 Jun 2012 17:50:43 +0000 (10:50 -0700)]
Simplify "arc branch" and make it work in immutable history repositories

Summary:
  - Move "arc branch"-specific code to the branch workflow.
  - Instead of doing "git rev-parse", just do "git branch --verbose --abbrev=40".
  - Use revision owners to identify ownership, not working copy identity. Particularly with the advent of "Commandeer", you might not own commits you made.
  - Do a batch lookup for commits by hash (depends on D2859, but doesn't break without it).
  - Use PhutilConsole for console stuff.
  - Removed color from "arc list" for the moment.
  - The "--by-status" flag has a slightly different output format now.

Test Plan: Ran "arc branch" in various circumstances, verified it identifies branches in immutable history repositories.

Reviewers: btrahan, vrana, jungejason, nh, slawekbiel

Reviewed By: slawekbiel

CC: aran
Maniphest Tasks: T693

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

14 years ago[Arcanist] fix scratch dir for svn >= 1.7
dschleimer [Tue, 26 Jun 2012 00:13:29 +0000 (17:13 -0700)]
[Arcanist] fix scratch dir for svn >= 1.7

Summary:
svn 1.7 got rid of the per-direcotry .svn dirs in favor of a single
.svn directory under the root of the working copy.  Unfortunately, we
relied on ther being a .svn directory at the same level as .arcconfig,
which may or may not be at the root of the working copy.  We now walk
up the directory tree until we find a .svn directory that we can use
for scratch files.

Test Plan:
[16:27:52 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/data/admin/facebook/scripts/db
db  21298 $ ls -la .arcconfig .svn ../../../.svn/arc/config
ls: .svn: No such file or directory
ls: ../../../.svn/arc/config: No such file or directory
-rw-r--r-- 1 dschleimer users 239 Jun 25 16:15 .arcconfig

[16:27:54 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/data/admin/facebook/scripts/db
db  21298 $ ~/devtools/arcanist/bin/arc set-config --local foo bar
Set key 'foo' = 'bar' in local config.

[16:29:40 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/data/admin/facebook/scripts/db
db  21298 $ ls -la .arcconfig .svn ../../../.svn/arc/config
ls: .svn: No such file or directory
-rw-r--r-- 1 dschleimer users 239 Jun 25 16:15 .arcconfig
-rw-r--r-- 1 dschleimer users  20 Jun 25 16:29 ../../../.svn/arc/config

[16:29:43 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/data/admin/facebook/scripts/db
db  21298 $ cat ../../../.svn/arc/config
{
  "foo" : "bar"
}

[16:29:48 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/data/admin/facebook/scripts/db
db  21299 $ ~/devtools/arcanist/bin/arc get-config foo
(global) foo =
(local) foo = bar

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1411

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

14 years ago[arcanist] add system arc config file
dschleimer [Mon, 25 Jun 2012 22:14:11 +0000 (15:14 -0700)]
[arcanist] add system arc config file

Summary:
Adds a system arc config file with precedence below the user config
file, both to ArcanistWorkingCopyIdentity::readConfigFromAnySource()
and to base commit resolution.

Test Plan:
[14:48:45 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist system_config 21245 $ cat /etc/arcconfig
{
    "base": "literal:foobar"
}
[14:52:31 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist system_config 21246 $ ./bin/arc get-config base
(system) base = literal:foobar
(global) base =

[14:52:39 Mon Jun 25 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist system_config 21247 $ ./bin/arc which --show-base --base 'arc:system'
foobar

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1233

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

14 years agoMerge pull request #40 from phleet/patch-2
Evan Priestley [Mon, 25 Jun 2012 20:53:00 +0000 (13:53 -0700)]
Merge pull request #40 from phleet/patch-2

Fix help message for arc tasks --status

14 years agoFix help message for arc tasks --status
Jamie Wong [Mon, 25 Jun 2012 20:46:51 +0000 (17:46 -0300)]
Fix help message for arc tasks --status

14 years agoIntroduce `arc inlines`
vrana [Sat, 23 Jun 2012 06:08:25 +0000 (23:08 -0700)]
Introduce `arc inlines`

Summary: This displays all inline comments attached to a revision in a format consumable by editors.

Test Plan: Ran it, opened the file on the line.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoWarn about PHP 5.3 only functions and parameters
vrana [Fri, 22 Jun 2012 20:47:18 +0000 (13:47 -0700)]
Warn about PHP 5.3 only functions and parameters

Test Plan:
Linted:

  json_decode('{}', true, 1, 1);
  gethostname();

Also linted all Phabricator repositories and found no occurrence.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1158

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

14 years agoSimplify handling errors in PHPCS linter
vrana [Thu, 21 Jun 2012 17:42:17 +0000 (10:42 -0700)]
Simplify handling errors in PHPCS linter

Test Plan:
  libxml_use_internal_errors(true);
  $report_dom = new DOMDocument();
  $report_dom->loadXML('<a</a>');
  $report_dom = new DOMDocument();
  $report_dom->loadXML('<a></a>');
  $report_dom = new DOMDocument();
  $report_dom->loadXML('');
  print_r(libxml_get_errors());

Reviewers: aurelijus

Reviewed By: aurelijus

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

14 years agoMerge pull request #38 from phleet/patch-1
dschleimer-fb [Fri, 22 Jun 2012 19:31:15 +0000 (12:31 -0700)]
Merge pull request #38 from phleet/patch-1

Fix mixing parens on getWorkingCopyIdentity in ArcanistMercurialAPI

14 years agoFix mixing parens on getWorkingCopyIdentity in ArcanistMercurialAPI
Jamie Wong [Fri, 22 Jun 2012 19:25:49 +0000 (16:25 -0300)]
Fix mixing parens on getWorkingCopyIdentity in ArcanistMercurialAPI

14 years agoSave files with path to phutil cache
vrana [Thu, 21 Jun 2012 18:48:23 +0000 (11:48 -0700)]
Save files with path to phutil cache

Test Plan:
  $ arc liberate
  $ mv a.php b.php
  $ arc liberate

Previously, it didn't update the map.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoSupport 'arc:exec(command)' in base-commit DSL
epriestley [Fri, 22 Jun 2012 15:13:06 +0000 (08:13 -0700)]
Support 'arc:exec(command)' in base-commit DSL

Summary: Allow users to run a command to determine the base revision of the commit range.

Test Plan: Ran stuff like `arc which --show-base --base 'arc:exec(ls)'` and got the expected results.

Reviewers: dschleimer, csilvers, btrahan, vrana

Reviewed By: csilvers

CC: aran
Maniphest Tasks: T1233

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

14 years ago[Arcanist] mercurial base commit DSL support
dschleimer [Fri, 22 Jun 2012 01:12:09 +0000 (18:12 -0700)]
[Arcanist] mercurial base commit DSL support

Summary:
This adds Mercurial support to the base commit DSL that's equivalent
to git's, though not identical.  Specifically, Mercurial has
arc:outgoing instead of arc:upstream, and hg:gca(commit) instead of
git:merge-base(commit), though they have similar behaviors.

Test Plan:
  [13:37:13 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20536 $ hg log -G -r master::
  @  changeset:   11:6970e9263ab8
  |  bookmark:    something
  |  tag:         tip
  |  user:        David Schleimer <dschleimer@fb.com>
  |  date:        Thu Jun 21 13:03:46 2012 -0700
  |  summary:     thing
  |
  o  changeset:   10:433a93023f03
  |  parent:      8:f47ccfe34267
  |  user:        David Schleimer <dschleimer@fb.com>
  |  date:        Thu Jun 21 13:03:34 2012 -0700
  |  summary:     some
  |
  | o  changeset:   9:c8379ef32b0d
  |/   bookmark:    other
  |    user:        David Schleimer <dschleimer@fb.com>
  |    date:        Thu Jun 21 13:01:04 2012 -0700
  |    summary:     other
  |
  o  changeset:   8:f47ccfe34267
  |  bookmark:    master
  |  user:        David Schleimer <dschleimer@fb.com>
  |  date:        Mon Jun 04 14:30:47 2012 -0700
  |  summary:     typo-fix
  |

  [13:38:00 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20536 $ ~/devtools/arcanist/bin/arc which --show-base --base hg:.^
  .^

  [13:38:11 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20536 $ ~/devtools/arcanist/bin/arc which --show-base --base 'hg:gca(other)'
  f47ccfe34267592dd2e336174a3a311b8783c024

  [13:38:21 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20536 $ hg id -r f47ccfe34267592dd2e336174a3a311b8783c024
  f47ccfe34267 master

  [13:38:31 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20537 $ ~/devtools/arcanist/bin/arc which --show-base --base 'arc:empty'
  null

  [13:38:44 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20538 $ hg id -r null
  000000000000

  [13:38:48 Thu Jun 21 2012] dschleimer@dev4022.snc6 ~/hg-dummy
  hg-dummy  20538 $ ~/devtools/arcanist/bin/arc which --show-base --base 'arc:outgoing'
  f47ccfe34267592dd2e336174a3a311b8783c024

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1233

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

14 years agoWarn about pht() with non constant string
vrana [Fri, 22 Jun 2012 00:41:26 +0000 (17:41 -0700)]
Warn about pht() with non constant string

Summary: We will extract them at some point, lint before it's too late.

Test Plan:
New test.
Linted all callsites.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoRemove bogus warning in liberate
vrana [Thu, 21 Jun 2012 18:52:16 +0000 (11:52 -0700)]
Remove bogus warning in liberate

14 years agoAdd example to --ansi
vrana [Thu, 21 Jun 2012 17:32:28 +0000 (10:32 -0700)]
Add example to --ansi

14 years agoMove line to a better place
vrana [Wed, 20 Jun 2012 20:03:03 +0000 (13:03 -0700)]
Move line to a better place

14 years agoAllow the "arc land --onto" default to be read from user config
epriestley [Wed, 20 Jun 2012 19:29:07 +0000 (12:29 -0700)]
Allow the "arc land --onto" default to be read from user config

Summary: Allow the default to be set in global config, not just project config.

Test Plan: `arc set-config arc.land.onto.default derp; arc land`

Reviewers: btrahan, vrana

Reviewed By: btrahan

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

14 years agoDocument --ansi
vrana [Wed, 20 Jun 2012 19:23:45 +0000 (12:23 -0700)]
Document --ansi

14 years agoWrap and simplify diff error excuse
vrana [Wed, 20 Jun 2012 01:14:26 +0000 (18:14 -0700)]
Wrap and simplify diff error excuse

Test Plan: Performed a lint error.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoUse pht() for plural
vrana [Tue, 19 Jun 2012 22:16:52 +0000 (15:16 -0700)]
Use pht() for plural

14 years agoUse new SVN format for all property changes
vrana [Tue, 19 Jun 2012 21:16:18 +0000 (14:16 -0700)]
Use new SVN format for all property changes

Test Plan: `svn diff`

Reviewers: nh

Reviewed By: nh

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

14 years agoDisplay number of assertions in unit test details
vrana [Sun, 17 Jun 2012 15:13:40 +0000 (08:13 -0700)]
Display number of assertions in unit test details

Test Plan: Show Full Unit Results on this diff.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoAdd test for "static::" to the PHP 5.3 linter
epriestley [Sun, 17 Jun 2012 16:01:47 +0000 (09:01 -0700)]
Add test for "static::" to the PHP 5.3 linter

Summary: See https://github.com/facebook/phabricator/issues/133.

Test Plan: Unit tests.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1158

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

14 years agoAdd a DSL for selecting base commits
epriestley [Fri, 15 Jun 2012 21:01:28 +0000 (14:01 -0700)]
Add a DSL for selecting base commits

Summary:
New optional mode. If you set 'base' in local, project or global config or pass '--base' to 'arc diff' or 'arc which', it switches to DSL mode.

In DSL mode, lists of rules from args, local, project and global config are resolved, in that order. Rules can manipulate the rule machine or resolve into actual commits. Provides support for some 'arc' rules (mostly machine manipulation) and 'git' rules (symbolic ref and merge-base).

Test Plan:
Ran unit tests. Also:

```$ arc which --show-base --base 'arc:prompt'

    Against which commit? HEAD
HEAD
$ arc which --show-base --base 'git:HEAD'
HEAD
$ arc which --show-base --base 'git:fake'
Usage Exception: None of the rules in your 'base' configuration matched a valid commit. Adjust rules or specify which commit you want to use explicitly.
$ arc which --show-base --base 'git:origin/master'
origin/master
$ arc which --show-base --base 'git:upstream'
Usage Exception: None of the rules in your 'base' configuration matched a valid commit. Adjust rules or specify which commit you want to use explicitly.
$ arc which --show-base --base 'literal:derp'
derp
$ arc which --show-base --base 'arc:halt'
Usage Exception: None of the rules in your 'base' configuration matched a valid commit. Adjust rules or specify which commit you want to use explicitly.
$ arc set-config --local base git:origin/master
Set key 'base' = 'git:origin/master' in local config.
$ arc which --show-base
origin/master
$ arc which --show-base --base 'git:HEAD^'
HEAD^
$ arc which --show-base --base 'arc:yield, git:HEAD^'
origin/master
$ arc which --show-base --base 'arc:global, git:HEAD^'
HEAD^
$ arc which --show-base --base 'arc:global, git:merge-base(origin/master)'
3f4f8992fba8d1f142974da36a82bae900e247c0```

Reviewers: dschleimer, vrana

Reviewed By: dschleimer

CC: aran
Maniphest Tasks: T1233

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

14 years agoUse pht()
vrana [Tue, 12 Jun 2012 01:33:19 +0000 (18:33 -0700)]
Use pht()

Test Plan: `arc cover`

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1139

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

14 years agoCall clearstatcache() after changing ~/.arcrc permissions
epriestley [Thu, 14 Jun 2012 19:30:21 +0000 (12:30 -0700)]
Call clearstatcache() after changing ~/.arcrc permissions

Summary: Otherwise we'll get a cached result from fileperms() if we end up here again.

Test Plan: `chmod 644 ~/.arcrc ; arc help` no longer double prompts when run from outside of a .arcconfig working copy.

Reviewers: csilvers

Reviewed By: csilvers

CC: aran
Maniphest Tasks: T1359

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

14 years agoMinor, fix relative path in PhutilLibraryMapBuilder
epriestley [Thu, 14 Jun 2012 19:15:00 +0000 (12:15 -0700)]
Minor, fix relative path in PhutilLibraryMapBuilder

14 years agoMove "relativeExplanation" to ArcanistRepositoryAPI with getters/setters
epriestley [Thu, 14 Jun 2012 19:02:41 +0000 (12:02 -0700)]
Move "relativeExplanation" to ArcanistRepositoryAPI with getters/setters

Summary:
We currently use the language "relative commit" or "relative local commit" to refer to the head of a commit range. I want to move toward callign this a "base commit", since I think that makes more sense. This moves us a small step in that direction.

The DSL stuff in T1233 also needs access to this stuff, so move it up to the base. This is mostly a bite-sized piece of the change in that diff.

Test Plan: Ran "arc which" in a couple of circumstances, read explanations.

Reviewers: dschleimer, vrana

Reviewed By: dschleimer

CC: aran
Maniphest Tasks: T1233

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

14 years agoBump symbol cache version from v2 -> v3
epriestley [Thu, 14 Jun 2012 19:02:27 +0000 (12:02 -0700)]
Bump symbol cache version from v2 -> v3

Summary: D2728 added some extensions as builtin functions to the symbol map, but users may have old caches which still list these dependencies. Bump the symbol cache version; @nodren reported that dropping caches fixed the issue for him.

Test Plan: Ran "arc lint", got cache rebuilds.

Reviewers: vrana, nodren

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1347

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

14 years agoExit with an error code if the workflow returned one.
Alan Huang [Wed, 13 Jun 2012 23:01:29 +0000 (16:01 -0700)]
Exit with an error code if the workflow returned one.

Summary:
PHP thinks this thing is an integer... and also thinks it's not an
integer... I'm so confused... Anyway, this seems to persuade it to
use the correct overload.

Test Plan:
Ran arc patch with the incant provided in the bug report. It
successfully returned 1, where it didn't before. I didn't test the
perflab stuff; hopefully that aborts when it detects nonzero return.

Reviewers: nh

Reviewed By: nh

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

14 years ago[Arcanist] add a local (per working copy) config file
dschleimer [Wed, 13 Jun 2012 23:02:29 +0000 (16:02 -0700)]
[Arcanist] add a local (per working copy) config file

Summary:
This adds the concept of a local (i.e. working copy local) config file
to arc.  This config file has the highest precedence for config
settings that may come from any config file.  The config is stored in
.(git|hg|sv)/arc/config, and is read ahead of the project config by
getConfigFromAnySource().

Test Plan:
#Testing arc set-config and arc get-config

[16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19410 $ ./bin/arc get-config
(global) default = https://phabricator.fb.com/conduit

[16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19410 $ ./bin/arc set-config foo bar
Set key 'foo' = 'bar' in global config.

[16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19411 $ ./bin/arc get-config
(global) default = https://phabricator.fb.com/conduit
(global) foo = bar

[16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19411 $ ./bin/arc set-config --local foo baz
Set key 'foo' = 'baz' in local config.

[16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19412 $ ./bin/arc get-config
(global) default = https://phabricator.fb.com/conduit
(global) foo = bar
(local) foo = baz

[16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19412 $ ./bin/arc set-config foo ''
Deleted key 'foo' from global config (was 'bar').

[16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19413 $ ./bin/arc get-config
(global) default = https://phabricator.fb.com/conduit
(global) foo =
(local) foo = baz

[16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19413 $ ./bin/arc set-config --local foo ''
Deleted key 'foo' from local config (was 'baz').

[16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19414 $ ./bin/arc get-config
(global) default = https://phabricator.fb.com/conduit

#testing getConfigFromAnySource by means of lint

[11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine
Set key 'lint.engine' = 'BogusLintEngine' in global config.

[11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine
Set key 'lint.engine' = 'DummyLintEngine' in local config.

[11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19587 $ ./bin/arc lint
Exception
Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html
(Run with --trace for a full exception trace.)

[11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine ''
Deleted key 'lint.engine' from local config (was 'DummyLintEngine').

[11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist
arcanist local_config 19587 $ ./bin/arc lint
 OKAY  No lint warnings.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1233

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

14 years agoDon't blast if cache couldn't be saved
vrana [Wed, 13 Jun 2012 00:37:30 +0000 (17:37 -0700)]
Don't blast if cache couldn't be saved

Summary:
It is currently causing us some pain because we use libraries in read-only directories.
Not saving the cache is still pretty bad because analysis is quite slow.
But it is better than exploding.

I considered other solutions like not .gitignoring the cache file but it would require committing it with each and every change.

I plan to resolve the note https://secure.phabricator.com/diffusion/ARC/browse/master/src/lint/linter/ArcanistPhutilLibraryLinter.php;d93bb5abd4935bc8$56-59 in longer term.

Test Plan: `arc liberate` without writable cache.

Reviewers: epriestley, nh

Reviewed By: epriestley

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

14 years agoUse verbatim commit message if it couldn't be parsed
vrana [Tue, 12 Jun 2012 20:29:05 +0000 (13:29 -0700)]
Use verbatim commit message if it couldn't be parsed

Summary:
We currently remove an invalid user from Reviewers and similar fields and print a note in the template. There are several problems:

# If I only made a typo in the name then it takes some effort to fix this typo and put the name on the original place (this information is lost).
# The notice is almost invisible and most users will just confirm the message without noticing it.
# If I fill the data in the commit message (and not in the template) then I probably want to treat that as authoritative so I want it to be correct.

Test Plan:
`arc diff` with invalid reviewer in commit message.
`arc diff` on empty commit message.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoInclude common extensions in symbol mapper
epriestley [Tue, 12 Jun 2012 19:54:26 +0000 (12:54 -0700)]
Include common extensions in symbol mapper

Summary:
Spamming everyone who got bitten by this. We upgraded the libphutil library system recently, but the "use of undeclared function" lint check used to run only on files you touched and now runs on every file in every library you use. This means that if you don't have pcntl or ldap installed, you'll get errors about use of functions from them on every change.

Instead, ship with a list of functions which are provided by extensions that we'll ignore when calculating dependencies, so not having pcntl doesn't mean you have to excuse through irrelevant errrors every time.

Test Plan: Ran script with an unknown function, got it in the map; added it to the extension list, it vanished from the map.

Reviewers: vrana, btrahan, allenjohnashton, ddfisher, keebuhm, phleet, nodren

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1347

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

14 years ago[Arcanist] move scratch directory into the vcs metadata directory
dschleimer [Tue, 12 Jun 2012 19:39:15 +0000 (12:39 -0700)]
[Arcanist] move scratch directory into the vcs metadata directory

Summary:
Using .arc as the scratch and per-repository configuration directory
has some unfortunate consequenses in the real world.  Among other
things, people forget to .gitignore it so it gets checked in.

Test Plan:
the only thing that seems to use this is the relative commit setting
for git.  This diff consists of 2 commits, one for the .gitignore and
one for everything else.

Comment out the portion of my .git/config that defines the upstream
for the branch.  Run arc diff --only with HEAD^ in
.arc/default-relative-commit.  See that .gitignore is not included in
the resultant diff, that .arc no longer exists, and that .git/arc
exists and has HEAD^ in .git/arc/default-relative-commit.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1233

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

14 years agoWrap errors in `arc diff`
vrana [Tue, 12 Jun 2012 19:10:51 +0000 (12:10 -0700)]
Wrap errors in `arc diff`

Test Plan: Add invalid reviewer in `arc diff`.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoFix lint errors found by Nemo
vrana [Mon, 11 Jun 2012 22:11:53 +0000 (15:11 -0700)]
Fix lint errors found by Nemo

Test Plan: Ran a script analyzing sources by HPHP.

Reviewers: epriestley, jungejason

Reviewed By: epriestley

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

14 years agoMerge pull request #37 from phleet/immutable-history-config-from-any-source
Evan Priestley [Mon, 11 Jun 2012 14:20:18 +0000 (07:20 -0700)]
Merge pull request #37 from phleet/immutable-history-config-from-any-source

Use getConfigFromAnySource when checking for immutable_history

14 years agoUse getConfigFromAnySource when checking for immutable_history
Jamie Wong [Mon, 11 Jun 2012 14:15:28 +0000 (10:15 -0400)]
Use getConfigFromAnySource when checking for immutable_history

14 years agoMerge pull request #36 from phleet/hg-head-pull
Evan Priestley [Mon, 11 Jun 2012 14:12:16 +0000 (07:12 -0700)]
Merge pull request #36 from phleet/hg-head-pull

Use .^ instead of HEAD^ for mercurial

14 years agoUse .^ instead of HEAD^ for mercurial
Jamie Wong [Fri, 8 Jun 2012 20:57:50 +0000 (16:57 -0400)]
Use .^ instead of HEAD^ for mercurial

Summary:
##arc amend## in a mercurial repo was failing with this message

    Usage Exception: Commit 'HEAD^' is not a valid Mercurial commit identifier.

mercurial's .^ is about the same thing as git's HEAD^

Test Plan:
##arc amend## in a mercurial repo with ##"immutable_history" : "false"## in the
##.arcconfig##.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoPass for phutil test that was expected to fail and skip
vrana [Fri, 8 Jun 2012 21:22:23 +0000 (14:22 -0700)]
Pass for phutil test that was expected to fail and skip

Summary:
I just hope that we will not create `ArcanistPhutilTestCaseTestCaseTestCase`.

Also fix a copy/paste error (@edward's this time).

Test Plan: `arc unit`

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoRemove support for skipping tests
vrana [Fri, 8 Jun 2012 20:35:52 +0000 (13:35 -0700)]
Remove support for skipping tests

Summary: Almost revert D2673 but leave the support for 'repeat'.

Test Plan: `arc help unit`.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoMinor, make amendCommit() prototypes match up to avoid E_STRICT.
epriestley [Fri, 8 Jun 2012 02:36:30 +0000 (19:36 -0700)]
Minor, make amendCommit() prototypes match up to avoid E_STRICT.

14 years agoRough cut of hgdaemon
epriestley [Fri, 8 Jun 2012 01:23:57 +0000 (18:23 -0700)]
Rough cut of hgdaemon

Summary:
This need a bunch of work, but is a sort of minimum viable product for the hgdaemon.

The two ProtocolChannels implement the client and server halves of the protocol.

The Server implements the server logic, the Client implements the client logic.

Test Plan: Launched a server and client on the same repo, got hg output in ~2-3ms instead of 100ms+.

Reviewers: csilvers, btrahan, vrana

Reviewed By: csilvers

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

14 years agoAllow skipping unit tests and support 'repeat' workflow arguments
vrana [Fri, 8 Jun 2012 00:02:56 +0000 (17:02 -0700)]
Allow skipping unit tests and support 'repeat' workflow arguments

Summary:
We run all tests before deploy but some of them are expected to fail.
We need to skip them.
It can be useful also for someone else.

I don't propagate this to `arc diff` as that would be much more complicated - we would need a new state 'partially skipped'.

The 'path' argument needs to be a file, skipping whole dirs is not supported.
The 'path' argument is in fact engine specific and engines can support format like 'Class::testMethod' but I didn't bother to document it to not confuse people.

Test Plan:
`arc unit --skip test.php`
`arc unit --skip ../src/test.php`

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoMerge pull request #35 from phleet/hg-mutable
Evan Priestley [Thu, 7 Jun 2012 19:35:43 +0000 (12:35 -0700)]
Merge pull request #35 from phleet/hg-mutable

Support mutable history in mercurial for arc diff and arc amend

14 years agoSupport mutable history in mercurial for arc diff and arc amend
Jamie Wong [Mon, 4 Jun 2012 19:30:50 +0000 (15:30 -0400)]
Support mutable history in mercurial for arc diff and arc amend

Summary:
This adds basic support for mutable history for arc diff and arc amend for
mercurial. This is purely opt-in (so it shouldn't affect anyone who doesn't want
this feature) by explicitly setting

    "immutable_history" : false

in arc configuration.

This also fixes another instance of weird behaviour for multiple heads - the
first instance was fixed here:
https://github.com/facebook/arcanist/pull/28

Test Plan:
without "immutable_history" turned on)>

When ##arc diff## produces an update diff, it should list only commits that are
ancestors of the current revision - not ones from other heads.

Reviewers: epriestley

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

14 years agoImprove syntax error output from "arc liberate"
epriestley [Wed, 6 Jun 2012 17:53:02 +0000 (10:53 -0700)]
Improve syntax error output from "arc liberate"

Summary:
Currently, when a file has a syntax error and you run "arc liberate", the symbol analyzer will fail and throw, which will make the mapper fail and throw, which will make arc fail and throw. This gives you a stack trace pile three scripts deep which is a giant pain to analyze visually.

Instead, raise a clear message.

Test Plan: Ran "arc liberate" with a syntax error. Got useful diagnostic output instead of 30 pages of stack mess.

Reviewers: vrana, btrahan

Reviewed By: vrana

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

14 years agoUse project root instead of library root in unit engine
vrana [Wed, 6 Jun 2012 04:08:52 +0000 (21:08 -0700)]
Use project root instead of library root in unit engine

14 years agoAdd "--conduit-timeout" to `arc` and modernize argument parsing
epriestley [Sun, 3 Jun 2012 15:31:49 +0000 (08:31 -0700)]
Add "--conduit-timeout" to `arc` and modernize argument parsing

Summary:
We added "repeat" to PhutilArgumentParser a while ago, so we can modernize the rest of the argument parsing (allow multiple --load-phutil-library flags).

Add a "--conduit-timeout" flag to allow users to set the timeout. See D2602.

Test Plan:
  $ arc diff --conduit-timeout=0.01
  Exception
  [cURL/28] <CURLE_OPERATION_TIMEOUTED> The request took too long to complete.
  (Run with --trace for a full exception trace.)
  $ arc diff --conduit-version 33
  Exception
  ERR-BAD-VERSION: Your 'arc' client version is '33', which is newer than the server version, '5'. Upgrade your Phabricator install.
  (Run with --trace for a full exception trace.)
  $ arc diff --conduit-uri http://derp.derp/
  Usage Exception: YOU NEED TO INSTALL A CERTIFICATE TO LOGIN TO PHABRICATOR

  You are trying to connect to 'http://derp.derp/api/' but do not have a certificate installed for this host. Run:

        $ arc install-certificate

  ...to install one.
  $ arc diff --load-phutil-library src --load-phutil-library ../phabricator/src --trace
  Loading phutil library '0' from '/INSECURE/devtools/arcanist/src'...
  Loading phutil library '1' from '/INSECURE/devtools/phabricator/src'...

Reviewers: phleet, vrana, btrahan

Reviewed By: btrahan

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

14 years agoFix comment
vrana [Sat, 2 Jun 2012 17:09:23 +0000 (10:09 -0700)]
Fix comment

14 years agoFix context for lint errors at top of file in JSON renderer
vrana [Sat, 2 Jun 2012 06:43:21 +0000 (23:43 -0700)]
Fix context for lint errors at top of file in JSON renderer

14 years agoRemove unused variable
vrana [Sat, 2 Jun 2012 06:33:58 +0000 (23:33 -0700)]
Remove unused variable

14 years agoDefine interface for lint renderers
vrana [Sat, 2 Jun 2012 00:32:35 +0000 (17:32 -0700)]
Define interface for lint renderers

Summary:
It makes me nervous.

Also move them to the dir.

Test Plan:
`arc lint`
`arc lint --output json`

Reviewers: epriestley

Reviewed By: epriestley

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

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