]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
14 years agoMerge pull request #8 from vrana/master
Evan Priestley [Wed, 30 Nov 2011 23:55:22 +0000 (15:55 -0800)]
Merge pull request #8 from vrana/master

Document paths parameter in arc unit

14 years agoDocument paths parameter in arc unit
Jakub Vrana [Wed, 30 Nov 2011 20:56:18 +0000 (12:56 -0800)]
Document paths parameter in arc unit

Summary:
arc unit supports paths parameter
It is not documented in arc help

Test Plan:
arc help
Search for unit

Reviewers: slawekbiel, aran

Reviewed By: aran

CC: aran, vrana
Differential Revision: 1143

14 years agoImprove git behavior in the zero- and one- commit case
epriestley [Wed, 30 Nov 2011 17:15:37 +0000 (09:15 -0800)]
Improve git behavior in the zero- and one- commit case

Summary:
Git works completely differently for commits zero and one than for 2..N so add
more special casing to handle them. See:

  - {T206}
  - {T596}

The getCommitRange() block is also fatal land, although I wasn't able to reach
it. I'll follow up with @s on T596.

Test Plan:
  - Created a new, empty repository ("mkdir x; cd x; git init").
  - Ran "arc lint", "arc unit", "arc diff" against it with no commits (the first
two work, the third fails helpfully).
  - Made an initial commit.
  - Ran "arc lint", "arc unit", "arc diff" against it (all work correctly).

Reviewers: btrahan, jungejason, aran

Reviewed By: aran

CC: s, aran
Differential Revision: 1142

15 years agoEnable override ArcanistXHPASTLinter
Jason Ge [Tue, 29 Nov 2011 06:15:06 +0000 (22:15 -0800)]
Enable override ArcanistXHPASTLinter

Summary:
add method setXHPASTTreeForPath() so that a child class of
ArcanistXHPASTLinter can set the tree easily.

Test Plan: wrote a subclass of ArcanistXHPASTLinter and it worked.

Reviewers: pad, epriestley

Reviewed By: pad

CC: aran, pad, jungejason
Differential Revision: 1134

15 years agoWhen running phutil tests from "arc unit", trigger __tests__ in all parent
epriestley [Fri, 18 Nov 2011 19:27:55 +0000 (11:27 -0800)]
When running phutil tests from "arc unit", trigger __tests__ in all parent
modules

Summary:
Right now, if you add a file to "__tests__/data/blah.testcase" it doesn't
trigger those __tests__, but it should. Trigger __tests__ in all parent modules
when a file changes.

(We could be a little more complex about choosing what to run but all the tests
are super fast so it hardly matters if we run "too many" tests.)

Test Plan: Ran "arc unit" on this, got a test trigger. Added a file to a
__tests__/data/ directory and got a test trigger. Added some var_dump() and
spot-checked things for sanity.

Reviewers: btrahan, jungejason, nh, tuomaspelkonen, aran

Reviewed By: jungejason

CC: aran, jungejason
Differential Revision: 1127

15 years agoCorrectly parse Mercurial output for "hg diff --git" when binary files are
epriestley [Fri, 18 Nov 2011 19:03:17 +0000 (11:03 -0800)]
Correctly parse Mercurial output for "hg diff --git" when binary files are
removed

Summary: Mercurial output diverges from git output when binary files are
removed. Parse the Mercurial flavor.

Test Plan:
  - Unit test fails before this change and passes afterward.
  - Removed a binary file in my hg local and successfully "arc diff --only"'d
the change.

NOTE: Git can't apply these patches, and reports:

  $ git apply < ~/Desktop/patch.txt
  error: removal patch leaves file contents
  error: level.png: patch does not apply

Reviewers: Makinde, btrahan, jungejason, nh, tuomaspelkonen, aran

Reviewed By: jungejason

CC: aran, jungejason, Makinde
Differential Revision: 1126

15 years agodon't stopAllLinters() for disabled error
Chris Piro [Thu, 17 Nov 2011 05:53:47 +0000 (21:53 -0800)]
don't stopAllLinters() for disabled error

Summary: if we don't care and don't expect it to break all other linters then
continue

Test Plan: ##arc lint --trace## on a commit with non-ascii characters, saw other
linters continue

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley, cpiro
Differential Revision: 1122

15 years agoProvide more information when unit tests fail with exceptions
epriestley [Thu, 17 Nov 2011 19:12:17 +0000 (11:12 -0800)]
Provide more information when unit tests fail with exceptions

Summary:
When a unit test throws an exception, provide more data (type, trace) in the
test failure message.

Previously, we would show only the message itself, which may not be very useful
in debugging test failures.

Test Plan: Ran "arc unit" on a test which throws, got a stack trace.

Reviewers: edward, btrahan, jungejason, nh, tuomaspelkonen, aran

Reviewed By: nh

CC: aran, nh
Differential Revision: 1123

15 years agoAllow modification of the svn commit message via an event listener
Marek Sapota [Thu, 17 Nov 2011 00:40:09 +0000 (16:40 -0800)]
Allow modification of the svn commit message via an event listener

Test Plan:
Wrote an event listener modifying the commit message and the message was
successfully changed.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, jungejason, epriestley
Differential Revision: 1103

15 years agoAdd events framework to Arcanist
Marek Sapota [Thu, 10 Nov 2011 21:47:45 +0000 (13:47 -0800)]
Add events framework to Arcanist

Test Plan:
Added a test event listener, added an event dispatch in diff workflow, run the
workflow, the listener was called.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, jungejason, epriestley
Differential Revision: 1102

15 years agoUse linear distance instead of square distance in levenshtein
Emil Hesslow [Tue, 15 Nov 2011 18:43:36 +0000 (10:43 -0800)]
Use linear distance instead of square distance in levenshtein

Summary:
We used square distance that optimized for the wrong thing. Making the same
markers spread out instead of being together

Also added a very little cost for switching type. That will make diff types
stick together a bit more

Task ID: #623

Blame Rev:

Test Plan:
Ran my new unit test. And tested a few diff in phabricator

Revert Plan:

Tags:

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1112

15 years agomake arc issue a warning if file upload fails during diff creation
Bob Trahan [Thu, 10 Nov 2011 03:44:53 +0000 (19:44 -0800)]
make arc issue a warning if file upload fails during diff creation

Summary:
just a little try / catch action in ArcanistDiffWorkflow.

"Ideally, it would be good to flag these changes somehow so that "arc patch" can
issue the inverse warning (e.g., "This patch could not be completely applied
because some binary data was not uploaded.") but that hasn't come up in a real
use case yet."

I think a change w/ filetype of FILE_IMAGE || FILE_BINARY *and* no phid means
that the upload failed so there's no additional flag needed.  (True?)  however,
it would be easy enough to store metadata that explicilty stated whether or not
the file upload succeeded.

(also / related - i looked through the arc patch workflow a bit and i don't
understand how the svn codepath loads up the actual binary files...  for git,
toGitPatch => buildBinaryChange => getBlob is the right path )

Test Plan:
 - set 'storage.mysql-engine.max-size' to 0 in my conf, uploaded diffs with
files
 - noted in differential that it correctly detected images versus binary despite
file upload failing
 - noted in differential that images had some empty UI
 - reverted conf change, uploaded diffs with files
 - noted in differential file showed up
 - ran arc patch with DX, where DX had broken files
 - noted "Downloading binary data...

Exception:
ERR-BAD-PHID: No such file exists."

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1100

15 years agoCheck that rev is accepted in arc mark-committed --finalize
Nick Harper [Fri, 11 Nov 2011 00:02:40 +0000 (16:02 -0800)]
Check that rev is accepted in arc mark-committed --finalize

Summary:
If arc amend is run on a rev that isn't accepted, it runs arc mark-committed
--finalize. The rev shouldn't be marked as committed if it hasn't been accepted,
so this diff adds in that check.

Test Plan:
Ran arc amend on a rev that hasn't been accepted, checked that it didn't get
marked as completed.

Reviewers: jungejason, epriestley

Reviewed By: epriestley

CC: aran, epriestley, nh
Differential Revision: 1104

15 years agoFix ArcanistBundle to generate disjoint, minimal hunks
epriestley [Thu, 10 Nov 2011 01:55:04 +0000 (17:55 -0800)]
Fix ArcanistBundle to generate disjoint, minimal hunks

Summary: 'patch' chokes on hunks with too much trailing stuff. 'git apply'
chokes on overlapping hunks. Make them both happy. Write some test cases so I
stop breaking this stuff.

Test Plan:
  - Applied a previously-failing patch via SVN.
  - Applied a previously-failing-then-succeeding patch via Git.
  - Ran unit tests.

Reviewers: jungejason, btrahan, nh, tuomaspelkonen, aran

Reviewed By: jungejason

CC: aran, jungejason
Differential Revision: 1099

15 years agobash completion: work around PHP CLI readline in command substitution
Chris Piro [Thu, 10 Nov 2011 00:37:32 +0000 (16:37 -0800)]
bash completion: work around PHP CLI readline in command substitution

Summary: (At least my build of) PHP tries to do readline magic on the terminal
when invoked from the shell, even inside bash's command substitution operator.
Work around it by piping the output of ##echo## to ##php##, so the input isn't a
terminal.

Test Plan: ##bash$ arc li<TAB>## now gives me possible completions rather than
breaking and inserting a literal tab

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1096

15 years agoDisable "color" extension in Mercurial in an extension-agnostic way
epriestley [Wed, 9 Nov 2011 02:21:19 +0000 (18:21 -0800)]
Disable "color" extension in Mercurial in an extension-agnostic way

Summary:
In D1079, I added "--color never", but this flag is provided by the "color"
extension, which is why I missed it originally, because it doesn't show up until
you enable that extension. Providing it causes installs which don't have it
enabled (disabled is the default) to fail.

Use "--config" to disable color instead. This sets a configuration setting and
works regardless of whether the color extension is present.

Test Plan: Ran "arc diff" in a mercurial working copy with the color extension
enabled and disabled.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: nh

CC: aran, nh
Differential Revision: 1092

15 years agoThere's an off-by-one derp issue with this.
epriestley [Tue, 8 Nov 2011 01:19:23 +0000 (17:19 -0800)]
There's an off-by-one derp issue with this.

15 years agoUpdate Arcanist README text
epriestley [Mon, 7 Nov 2011 02:07:04 +0000 (18:07 -0800)]
Update Arcanist README text

Summary: Make this text a little more informative, this stuff is fairly stable
now and has actual documentation available.

Test Plan: Read the document.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 1086

15 years agoRemove "mercurial support is imaginary" warning from Arcanist
epriestley [Mon, 7 Nov 2011 01:56:13 +0000 (17:56 -0800)]
Remove "mercurial support is imaginary" warning from Arcanist

Summary: We ostensibly now support Mercurial at least mostly, so don't
underpromise quite so much.

Test Plan: Ran "arc diff" in a Mercurial working copy without being warned.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 1085

15 years agoPrevent ArcanistBundle from generating patches with overlapping hunks
epriestley [Mon, 7 Nov 2011 01:48:43 +0000 (17:48 -0800)]
Prevent ArcanistBundle from generating patches with overlapping hunks

Summary: We currently may generate patches which have hunks that include overlapping context. Git was okay with this until at least 1.7.3.4, but started rejecting these patches some time later.

We already attempt to detect and prevent this condition, we just don't do a very good job of it. Fix the check so that we avoid generating overlapping hunks.

Test Plan:

  - Cleanly applied troublesome patches under Git 1.7.7.2.
  - Used "arc export --git" to verify patches generate without overlapping sections.
  - Locally changed $context to 2 and 1, verified patch behavior was reasonable.

Reviewers: kdeggelman, bizrad6, jonathanhester, jungejason, nh, tuomaspelkonen, aran

CC:

Differential Revision: 1084

15 years agoDisable color extensions in Mercurial
epriestley [Fri, 4 Nov 2011 20:33:08 +0000 (13:33 -0700)]
Disable color extensions in Mercurial

Summary: Mercurial has a --color flag which disables the use of ANSI colors. Use
it to prevent "hg diff" from giving us colorized diff output.

Test Plan: Ran "hg diff --color never", verified it disabled ANSI color in diff
output.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: aran

CC: aran
Differential Revision: 1079

15 years agoAdd very hacky encoding transformation support for arc
epriestley [Mon, 15 Aug 2011 16:10:22 +0000 (09:10 -0700)]
Add very hacky encoding transformation support for arc

Summary:
Adds a secret, undoucmented "encoding" key to ".arcconfig" which makes a very
half-hearted effort to convert encodings. This is probably good enough that
Differential can be used for code review, but there will be issues with 'arc
patch', 'arc export', paste, maybe conduit stuff, Diffusion, and whatever else I
haven't thought of.

This also doesn't store the original encoding so anything converted like this
won't reasonably be able to be made to work with all that stuff in the future.

See T452 for a broader discussion of the issues involved.

Test Plan:
Short circuited the UTF-8 detection to always fail, had my files "converted"
from ISO-8859-1 to UTF-8.

@davidreuss: you can test this by applying this patch to arcanist/, adding
'"encoding" : "ISO-8859-1"' to your .arcconfig, touching some non-ASCII file,
and then running "arc diff".

Reviewers: davidreuss, jungejason, tuomaspelkonen, aran

Reviewed By: davidreuss

CC: aran, davidreuss, epriestley, nshamg123
Differential Revision: 812

15 years agoSave committed revision id in workflow.
Marek Sapota [Fri, 4 Nov 2011 19:12:14 +0000 (12:12 -0700)]
Save committed revision id in workflow.

Summary:
Save commited revision id in workflow, so it can be used in Arcanist
didRunWorkflow hook.

Test Plan:
Running getRevisionID on the workflow should return id of the committed
revision.

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, epriestley, mareksapota
Differential Revision: 1078

15 years agoFix "arc lint" exploding on new directories
epriestley [Thu, 3 Nov 2011 20:42:19 +0000 (13:42 -0700)]
Fix "arc lint" exploding on new directories

Summary:
D1061 introduced a 'text file' check, but it fails under SVN for new
directories.

  - Revert D1061 (This reverts commit b2cd18252701be2093b52652fb3d1d94c5df571e.)
  - Make getChangedLines() return null to indicate that the operation doesn't
make sense. I think this was the intent of the code in the lint engine.
  - Fix a bug where running "arc lint" on a change in an SVN working copy from a
subdirectory would fail.
  - Fix a bug where warnings with no line information were incorrectly
discarded.

Test Plan:
  - Ran "arc lint" in an SVN working copy with a new directory (no failure).
  - Forced FilenameLinter to always raise a warning. Added a binary file and ran
"arc lint". The warning was reported for the new binary file, a new text file,
and a new directory.

Reviewers: jungejason, andrewjcg, nh, tuomaspelkonen, aran

Reviewed By: andrewjcg

CC: aran, andrewjcg, epriestley
Differential Revision: 1076

15 years agoCorrectly implement getFileDataAtRevision()
epriestley [Wed, 2 Nov 2011 00:21:39 +0000 (17:21 -0700)]
Correctly implement getFileDataAtRevision()

Summary: Apparently I just never tested this or something. Make it work
correctly.

Test Plan: Ran "arc diff" in a Mercurial working copy with a binary file in
outgoing.

Reviewers: Makinde

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 1074

15 years agoDon't flag "Untracked" files in Mercurial as "Uncommitted"
epriestley [Wed, 2 Nov 2011 00:10:48 +0000 (17:10 -0700)]
Don't flag "Untracked" files in Mercurial as "Uncommitted"

Summary: We incorrectly add the "Uncommitted" flag to untracked files, which
causes them to raise various prompts and not respect "--allow-untracked".

Test Plan: Ran "arc diff --allow-untracked" in a clean working copy with
untracked files, was not fatally error'd.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: Makinde

CC: aran, Makinde, epriestley
Differential Revision: 1073

15 years agoAllow running `arc patch` without authentication.
Marek Sapota [Tue, 1 Nov 2011 19:34:27 +0000 (12:34 -0700)]
Allow running `arc patch` without authentication.

Summary:
Allow `arc patch` without authentication if Phabricator instance has
'differential.anonymous-access' set to true.

Test Plan:
Set 'differential.anonymous-access' in Phabricator to true and run `arc patch`
without installing a certificate.  `arc patch` should work as expected.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1069

15 years agoFix "arc diff" under Mercurial with a dirty working copy
epriestley [Tue, 1 Nov 2011 22:07:39 +0000 (15:07 -0700)]
Fix "arc diff" under Mercurial with a dirty working copy

Summary:
In D962, I switched us from using "hg summary" to "hg id" to find the working
copy revision. However, "hg id" reports the revision with a trailing "+" if the
working copy is dirty, so we fail before hitting the explicit check for this
later.

Trim off the trailing '+' if it is present.

Test Plan:
Ran "arc diff" in a dirty Mercurial working copy and got a good error message
about uncommitted changes.

  ~/repos/hg-working-copy $ arc diff
  WARNING: Mercurial support is largely imaginary right now.
  Usage Exception: You have uncommitted changes in this branch. Commit (or
revert) them before proceeding.

    Working copy: /INSECURE/repos/hg-working-copy/

    Uncommitted changes in working copy
      hello.c

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 1070

15 years agosupport newer PyLint column numbers
Chris Piro [Thu, 27 Oct 2011 22:37:45 +0000 (15:37 -0700)]
support newer PyLint column numbers

Summary: newer PyLint includes commas and a column number for every message
after the line number. ignore that if it's present.

Test Plan: ##arc lint --trace --lintall## a file with messages with the old and
new pylint (2.5), works fine with both

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1062

15 years agoShow lint warnings for non-"line-able" files
Andrew Gallagher [Thu, 27 Oct 2011 22:26:23 +0000 (15:26 -0700)]
Show lint warnings for non-"line-able" files

Summary:
Currently, lint messages are only included if they are errors or
if they affect lines which the diff changed.  The implementation
of this caused issues for non-text files (e.g. binaries), as line
change information is not available, and the corresponding lint
messages were dropped (for non-errors).

In this diff, only lint messages concerning text files are dropped
based on this line filtering.

Test Plan: arc lint with binary file

Reviewers: jungejason, epriestley

Reviewed By: epriestley

CC: aran, aravindn, andrewjcg, liat, epriestley
Differential Revision: 1061

15 years agoMerge pull request #7 from mareksapota-fb/master
Evan Priestley [Fri, 28 Oct 2011 16:26:14 +0000 (09:26 -0700)]
Merge pull request #7 from mareksapota-fb/master

Pull request for differential revision D1055

15 years agoAllow anyone to run `arc commit` on an accepted revision
Marek Sapota [Wed, 26 Oct 2011 03:03:41 +0000 (20:03 -0700)]
Allow anyone to run `arc commit` on an accepted revision

Test Plan:
Using SVN make some changes to the repo, run `arc diff`.  As other user accept
the revision, add the changes to your repo using `arc patch` and then run `arc
commit --revision revisionID` to commit them.  Arcanist should ask if you are
sure that you want to commit this revision and if you answer `Y` it should
commit to SNV repo.

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, mareksapota, epriestley
Differential Revision: 1055

15 years agoSupport other encodings in ArcanistDiffParser
David Reuss [Fri, 28 Oct 2011 15:01:21 +0000 (08:01 -0700)]
Support other encodings in ArcanistDiffParser

Test Plan:
Tried viewing a diff detected as binary in diffusion with and without
setting my desired encoding. Worked as expected.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1008

15 years agoadd lint.pylint.pythonpath option for ArcanistPyLintLinter
Chris Piro [Tue, 25 Oct 2011 22:23:08 +0000 (15:23 -0700)]
add lint.pylint.pythonpath option for ArcanistPyLintLinter

Summary: allow adding PYTHONPATHs directly in addition to the hardcoded few
already allowed.

Test Plan: ##arc lint## successfully picks up the paths listed in my .arcconfig,
and no longer errors on modules not found from those directories

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1050

15 years agoMerge pull request #6 from mareksapota-fb/master
Evan Priestley [Wed, 26 Oct 2011 00:29:09 +0000 (17:29 -0700)]
Merge pull request #6 from mareksapota-fb/master

Pull request for differential revision D1052

15 years agoAllow anyone to mark Differential revisions as commited.
Marek Sapota [Tue, 25 Oct 2011 23:34:15 +0000 (16:34 -0700)]
Allow anyone to mark Differential revisions as commited.

Test Plan:
Run `arc mark-committed` on a revision that you don't own, you should see a
prompt asking you if you really want to do that and if you answer `Y` it should
mark the revision as committed.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley, mareksapota
Differential Revision: 1052

15 years agoRefine whitespace and end-of-block detection for git binary literal patches in
epriestley [Tue, 25 Oct 2011 23:55:32 +0000 (16:55 -0700)]
Refine whitespace and end-of-block detection for git binary literal patches in
mercurial changesets

Summary: Makes the parsing slightly more liberal so a test case from @Makinde
passes.

Test Plan: Ran unit tests.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 1054

15 years agoadd 'lint.pylint.rcfile' option for ArcanistPyLintLinter
Chris Piro [Tue, 25 Oct 2011 20:47:03 +0000 (13:47 -0700)]
add 'lint.pylint.rcfile' option for ArcanistPyLintLinter

Summary: add the ability to specify an rcfile path either absolute or relative
to the project root.

Test Plan: added one for a project, ran ##arc lint --trace## to see the expected
result

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1046

15 years agofix bugs and documentation for ArcanistPyLintLinter
Chris Piro [Tue, 25 Oct 2011 20:46:13 +0000 (13:46 -0700)]
fix bugs and documentation for ArcanistPyLintLinter

Summary:
- The top documentation is more readable, and the details about the severity
mapping regexps is moved to the top from inline -- they're important.
- array_merge() is used when appending command line args from
##lint.pylint.options## instead of '+'. The latter merges by key instead of
appending the two lists as intended.
- rely on the exit code instead of magic text that may or may not be there
depending on how ##pylint## is invoked.

These bugs were introduced in d762311a9de9ae331949743e7b37fc920b7c6dff.

Test Plan: ##arc lint --trace##'d a bunch of Python source files in a project,
with and without PyLint messages. Added some ##lint.pylint.options## to see
proper appending behavior.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley, cpiro
Differential Revision: 1045

15 years agoImprove representation of replaced symlinks in Git
epriestley [Fri, 21 Oct 2011 19:37:40 +0000 (12:37 -0700)]
Improve representation of replaced symlinks in Git

Summary:
See T584. Git renders these types of changes somewhat unusually. Ensure they are
rendered as changes.

The fact that a symlink was replaced is not explicitly rendered (e.g., "This
path was changed from a symlink to a regular file."), but can be inferred from
the 'unix:filemode' property change that will accompany the changeset. We could
also make it explicit but this type of change is rare enough that it's probably
good enough as-is.

Test Plan:
  - Ran unit test, which previously failed and now passes.
  - Created a diff which replaces a file with a symlink, verified it rendered a
little more sensibly.

Reviewers: aravindn, dschleimer, jungejason, nh, tuomaspelkonen

Reviewed By: nh

CC: aran, goldshlager, nh
Differential Revision: 1030

15 years agoDon't do working copy checks for "arc amend --show"
epriestley [Sun, 23 Oct 2011 19:55:43 +0000 (12:55 -0700)]
Don't do working copy checks for "arc amend --show"

Summary: See T587. Reduce the strictness of working copy checks when using
"--show", since there's a reasonable workflow where you 'arc patch' and then
'arc amend --revision X --show | git commit -a -F -' that currently won't work.
There are other ways to accomplish the same thing but this increases flexibility
overall.

Test Plan: Ran 'arc amend --show' with a dirty working copy, didn't get yelled
at.

Reviewers: jungejason, nh, tuomaspelkonen, aran

Reviewed By: nh

CC: aran, nh
Differential Revision: 1033

15 years agoAllow Arcanist to parse "git diff --binary" and "hg diff --git" format for
epriestley [Tue, 25 Oct 2011 06:33:50 +0000 (23:33 -0700)]
Allow Arcanist to parse "git diff --binary" and "hg diff --git" format for
changes which add or alter binary files

Summary: See test cases, derived from "hg diff --git" and "git diff --binary".

Test Plan: Test cases work now.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 1047

15 years agoAdd isHeuristicBinaryFile(), a git-like check for binariness of fiels
epriestley [Mon, 24 Oct 2011 17:33:34 +0000 (10:33 -0700)]
Add isHeuristicBinaryFile(), a git-like check for binariness of fiels

Summary:
This is separated from D812. See D812, D1008, D1009. Separation allows us to
land these patches safely.

See T452 for a broader discussion of the issues involved.

Test Plan: See D812.

Reviewers: davidreuss, jungejason, nh, tuomaspelkonen, aran

Reviewed By: davidreuss

CC: aran, davidreuss
Differential Revision: 1040

15 years ago@include_once libphutil, not @require_once
epriestley [Thu, 20 Oct 2011 21:34:42 +0000 (14:34 -0700)]
@include_once libphutil, not @require_once

(Committing on behalf of @cpiro)

Summary: there's a check beneath to see if it worked, but @require_once will
fail silently if libphutil isn't available

Test Plan: tried it with libphutil findable and not findable, got expected
behavior

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1018

15 years agoMerge pull request #5 from mareksapota-fb/master
Evan Priestley [Thu, 20 Oct 2011 00:32:33 +0000 (17:32 -0700)]
Merge pull request #5 from mareksapota-fb/master

Pull request for differential revision D1022

15 years agoFix parsing of `git diff` when diff.mnemonicprefix=true
Marek Sapota [Wed, 19 Oct 2011 22:27:42 +0000 (15:27 -0700)]
Fix parsing of `git diff` when diff.mnemonicprefix=true

Test Plan:
Go to /differential/diff/create and try to upload a patch that was created with
`git diff` when diff.mnemonicprefix was set to true.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: 1022

15 years agoFix breaking because of D935
Jason Ge [Tue, 18 Oct 2011 02:22:48 +0000 (19:22 -0700)]
Fix breaking because of D935

Summary:
D935 missed one place of parseGitRelativeCommit() in
ArcanistExportWorkflow.

Test Plan: ran arc export and verify that it worked.

Reviewers: epriestley, tuomaspelkonen, aran

Reviewed By: aran

CC: aran
Differential Revision: 1015

15 years agoCorrectly parse git diffs with an empty file at the end
epriestley [Mon, 10 Oct 2011 19:34:28 +0000 (12:34 -0700)]
Correctly parse git diffs with an empty file at the end

Summary: A minor bug in the parser prevented it from handling git diffs where an
empty file appears at the end of the diff. Since git appends an extra newline,
we failed to jump into the '$line === null' block.

Test Plan: Ran unit tests. Generated a revision which only deleted an empty
file.

Reviewers: jungejason, nh, tuomaspelkonen, aran

Reviewed By: nh

CC: aran, nh, epriestley
Differential Revision: 998

15 years agoAutomatically detect when to mark revisions committed
epriestley [Tue, 27 Sep 2011 16:37:11 +0000 (09:37 -0700)]
Automatically detect when to mark revisions committed

Summary:
See D945. We have this kludgy "remote_hooks_installed" mess right now, but we
have enough information on the server nowadays to figure this out without it.

Also reduce code duplication by sharing the "mark-committed" workflow.

This causes "arc merge" to effect commit marks.

Test Plan:
In Git, Mercurial and SVN working copies ran like a million
amend/merge/commit/mark-committed commands with and without --finalize in
various states of revision completion.

This change is really hard to exhaustively test because of the number of
combinations of VCS, revision state, command, command flags, repository state
and tracking state. All the reasonable tests I could come up with worked
correctly, though.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: jungejason

CC: aran, jungejason
Differential Revision: 967

15 years agoUse full-length hashes in Mercurial local commit information
epriestley [Mon, 26 Sep 2011 21:35:42 +0000 (14:35 -0700)]
Use full-length hashes in Mercurial local commit information

Summary:
Expand 12-character hashes to 40-character hashes so other things will work
properly.

Also use "hg id" instead of "hg summary" to figure out where the working copy
is, since it's substantially simpler.

Test Plan: Ran "arc diff" and got properly 40-character hashes.

Reviewers: Makinde, aran

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 962

15 years agoParse 'hg status -C' to show file move/copy sources
epriestley [Sun, 25 Sep 2011 16:59:41 +0000 (09:59 -0700)]
Parse 'hg status -C' to show file move/copy sources

Summary: For Mercurial parsing in Diffusion, it looks like the only command we
can use to get move/copy information is "hg status -C --rev <rev>", so add a
parser for it.

Test Plan: Ran unit tests.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 958

15 years agoFix supportsRelativeLocalCommits() misspelling
epriestley [Sun, 25 Sep 2011 23:48:18 +0000 (16:48 -0700)]
Fix supportsRelativeLocalCommits() misspelling

Summary: I renamed this at some point but missed a callsite. See T519.

Test Plan: Ran "arc patch" in an SVN working copy.

Reviewers: Girish, jungejason

Reviewed By: Girish

CC: aran, Girish
Differential Revision: 959

15 years agoSplit mercurial parsing and API
epriestley [Fri, 16 Sep 2011 10:53:52 +0000 (03:53 -0700)]
Split mercurial parsing and API

Summary: Move code to actually parse "hg" output into a separate class with some
tests, so I can reuse it in the import scripts. We should probably do this for
Git/SVN at some point, too.

Test Plan: Ran unit tests, used this class in Phabricator importers, grepped for
calls to removed private methods.

Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 942

15 years agoSupport "immutable_history" doctrine in arc
epriestley [Fri, 26 Aug 2011 00:53:59 +0000 (17:53 -0700)]
Support "immutable_history" doctrine in arc

Summary: When a project uses a conservative history mutability doctrine, never
try to amend history.

Test Plan: Ran "arc amend" in an "immutable_history" working copy.

Reviewers: fratrik, Makinde, aran, jungejason, tuomaspelkonen

Reviewed By: Makinde

CC: aran, Makinde, epriestley
Differential Revision: 862

15 years agoAdd an "arc merge" workflow
epriestley [Thu, 25 Aug 2011 23:02:03 +0000 (16:02 -0700)]
Add an "arc merge" workflow

Summary:
This should support conservative rewrite policies in git fairly well, under an
assumed workflow of:

  - Develop in local branches, never rewrite history.
  - Commit with "-m" or by typing a brief, non-template commit message
describing the checkpoint.
  - Provide rich information in the web console (reviewers, etc.)
  - Finalize with "git checkout master && arc merge branch && git push" or some
flavor thereof.

This supports Mercurial somewhat. The major problem is that "hg merge" fails if
the local is a fastforward of the remote, at which point there's nowhere we can
throw the commit message. Oh well. Just push it and we'll do our best to link
them up based on local commit info.

I am increasingly forming an opinion that Mercurial is "saftey-scissors git".
But also maybe I have no clue what I'm doing. I just don't understand why anyone
would think it's a good idea to have a trunk consisting of ~50% known-broken
revisions, random checkpoint parts, whitespace changes, typo fixes, etc. If you
use git with branching you can avoid this by making a trunk out of merges or
with rebase/amend, but there seems to be no way to have "one commit = one idea"
in any real sense in Mercurial.

Test Plan: Execute "arc merge" in git and mercurial.

Reviewers: fratrik, Makinde, aran, jungejason, tuomaspelkonen

Reviewed By: Makinde

CC: aran, epriestley, Makinde
Differential Revision: 860

15 years agoMove some VCS-specific logic into VCS APIs
epriestley [Thu, 15 Sep 2011 01:44:54 +0000 (18:44 -0700)]
Move some VCS-specific logic into VCS APIs

Summary:
We have some git-specific logic on main pathways which should be in the API
class, move it around so "arc lint" with an engine works under Mercurial. This
resovles the error @makinde reported:

> PHP Catchable fatal error:  Argument 1 passed to
ArcanistBaseWorkflow::parseGitRelativeCommit() must be an instance of
ArcanistGitAPI, instance of ArcanistMercurialAPI given, called in
/home/makinde/.arc_install/arcanist/src/workflow/lint/ArcanistLintWorkflow.php
on line 131 and defined in
/home/makinde/.arc_install/arcanist/src/workflow/base/ArcanistBaseWorkflow.php
on line 830

Test Plan: Ran "arc diff" in git and hg working copies, plus "arc lint" with a
configured "lint_engine".

Reviewers: Makinde, aran, jungejason, nh, tuomaspelkonen

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 935

15 years agoImprove Arcanist Mercurial compatibility
epriestley [Thu, 15 Sep 2011 01:11:00 +0000 (18:11 -0700)]
Improve Arcanist Mercurial compatibility

Summary:
  - Use "hg parents" to figure out where outgoing changes originate from, not
"~1", since that's a new feature in Mercurial.
  - Add "--style default" all over the place since hg config can override this
(similar to the date config issues we saw in git).
  - Cache working copy status so we don't run full hg diffs like 30 times
(similar to git/svn APIs).
  - Use full "--git" flag instead of rather cryptic "-g".

Test Plan: Ran "arc diff" in my hg working copy, got the diff I expected.

Reviewers: Makinde, aran, jungejason, nh, tuomaspelkonen

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 934

15 years agoFix commit range selection in Mercurial
epriestley [Thu, 15 Sep 2011 02:08:16 +0000 (19:08 -0700)]
Fix commit range selection in Mercurial

Summary:
  - Noncontentious Mercurial stuff from D863.
  - Use "hg outgoing --branch" to make sure we aren't including outgoing
revisions on other branches.
  - Use "hg summary" to figure out where the working copy is, so "hg up <older
rev> && arc diff" works like expected.

Test Plan: Ran "arc diff" from multiple branches with the working copy in
various states.

Reviewers: Makinde, aran, jungejason, nh, tuomaspelkonen

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 936

15 years agoSome mercurial parsing fixes
epriestley [Wed, 31 Aug 2011 18:51:56 +0000 (11:51 -0700)]
Some mercurial parsing fixes

Summary: Parse some other fields which I hadn't seen yet from "hg log". Select
the right "hg log" range for local commit info.

Test Plan: Ran "arc diff" in my test mercurial repository from a branch with
tags. Looked at "local commits" in Differential.

Reviewers: Makinde, aran, jungejason, tuomaspelkonen

Reviewed By: Makinde

CC: aran, Makinde
Differential Revision: 880

15 years agoMerge branch 'master' of github.com:facebook/arcanist into get_engine
mgummelt [Fri, 9 Sep 2011 01:26:07 +0000 (18:26 -0700)]
Merge branch 'master' of github.com:facebook/arcanist into get_engine

15 years agotwo small changes for "arc unit" post hook
mgummelt [Fri, 9 Sep 2011 00:36:20 +0000 (17:36 -0700)]
two small changes for "arc unit" post hook

Summary:
1) unit engine getter method in the unit workflow

   we store some information (unit test results) in the engine that we
   need to access in the "arc unit" post hook

2) make requireCleanWorkingCopy() public

   "arc unit" doesn't need to be clean in general, but we'd like the
   option to upgrade the workflow to require it if necessary.  We use
   this for ensuring a repo is clean before updating unit test
   results.

Test Plan: Used both features in a custom post hook in arc unit

Reviewers: epriestley

Reviewed By: epriestley

CC: dpepper, aran, epriestley
Differential Revision: 917

15 years agoAllow XHPAST lint name rules to be overridden through configuration
epriestley [Tue, 30 Aug 2011 20:07:01 +0000 (13:07 -0700)]
Allow XHPAST lint name rules to be overridden through configuration

Summary:
See T326. Allow lint rules to be selectively overridden, e.g. for Conduit
methods.

Since FB has a long history of suggesting crazy patches for this stuff I think
we're safer just adding a hook class than trying to do some kind of regexp
magic.

Test Plan: Wrote a hook for Phabricator and linted some Conduit files without
issues. Ran unit tests.

Reviewers: nh, jungejason, tuomaspelkonen, aran

Reviewed By: nh

CC: aran, nh
Differential Revision: 874

15 years agoAttach local commit information to DVCS revisions
epriestley [Wed, 24 Aug 2011 01:48:55 +0000 (18:48 -0700)]
Attach local commit information to DVCS revisions

Summary: When a revision is created, attach relevant information about the local
commits which it came from if applicable. This supports T473, for DCVSes and
DCVS workflows with immutable history where we can't just amend commit messages.
It will also allow us to enrich the web interface.

Test Plan: Will verify this info shows up for this very diff.

Reviewers: fratrik, aran, jungejason, tuomaspelkonen

Reviewed By: fratrik

CC: aran, epriestley, fratrik
Differential Revision: 857

15 years agoChange patch generation for moving a file
Nicholas Harper [Mon, 15 Aug 2011 19:25:05 +0000 (12:25 -0700)]
Change patch generation for moving a file

Summary:
The unix utility `patch` will not move a file (unless it is in or out of
/dev/null). If a diff copies or moves a file and also makes changes to the file,
the generated patch needs to list the new filename as the path to both the
original and new files so the changes get written to the new file.

(When arc applies this patch, it copies or moves the original as needed before
running `patch`.)

(This only matters for svn repos, since arc uses git commands for git repos
instead of using `patch`.)

Test Plan:
Created an arc bundle of a diff that copied a file to a new location and made
changes in both locations, and then ran arc patch with this bundle (in an svn
repo) to see that it correctly patches.

Reviewed By: epriestley
Reviewers: epriestley, jungejason, tuomaspelkonen
CC: aran, epriestley, nh
Differential Revision: 813

15 years agoBe slightly less dumb about detecting "binary" files
epriestley [Wed, 10 Aug 2011 18:57:07 +0000 (11:57 -0700)]
Be slightly less dumb about detecting "binary" files

Summary:
A better definition of "binary" is "not utf-8", instead of "has some characters
not in this arbitrary regexp". Principally, this makes files with windows
newlines not autodetect as binary.

This might fix some of the issues in T365.

Test Plan: @egillth applied this patch and verified that Diffusion now shows
file content instead of detecting everything as binary in his repo full of
Windows newlines.
Reviewed By: jungejason
Reviewers: egillth, tuomaspelkonen, jungejason, aran
CC: aran, jungejason
Differential Revision: 799

15 years agoMerge pull request #3 from philix/ifacedeps
Evan Priestley [Wed, 10 Aug 2011 18:54:05 +0000 (11:54 -0700)]
Merge pull request #3 from philix/ifacedeps

Fix phutil_analyzer bug on interface dependency creation

15 years agoFix phutil_analyzer bug on interface dependency creation
Felipe Oliveira Carvalho [Wed, 10 Aug 2011 14:50:10 +0000 (11:50 -0300)]
Fix phutil_analyzer bug on interface dependency creation

Summary:
Use $interface_name instead of $class_name when dealing with
interfaces. Problem happens when you extend an interface:

    interface SubIface extends SuperIface { ...

    Notice: Undefined variable: class_name in ...
Fatal error: Call to a member function getConcreteString() on a
non-object in ...

Test Plan: phutil_mapper.php works!

15 years agoImprove Arcanist Mercurial support
epriestley [Wed, 10 Aug 2011 01:54:10 +0000 (18:54 -0700)]
Improve Arcanist Mercurial support

Summary:
  - Build the manifest of file changes so unit and lint workflows work.
  - Default to creating a diff between the parent of the first outgoing change
and the tip.

Test Plan:
  - Ran "arc diff" in a dirty mercurial repo, got warned about
untracked/uncommitted changes.
  - Ran "arc diff" in a clean mercurial repo, got a diff of everything I'd done
locally.

Reviewed By: aran
Reviewers: Makinde, aran, jungejason, tuomaspelkonen
CC: aran, epriestley
Differential Revision: 796

15 years agoBasic Mercurial support for Arcanist
epriestley [Tue, 9 Aug 2011 16:00:29 +0000 (09:00 -0700)]
Basic Mercurial support for Arcanist

Summary:
There's a lot of ground left to cover but this makes "arc diff" work (on one
trivial diff) in my sandbox, at least, and supports parsing of Mercurial native
diffs (which are unified + a custom header). Piles of missing features, still.
Some of this is blocked by me not understanding the mercurial model well yet.

This is also a really good opportunity for cleanup (especially, reducing the
level of "instanceof" in the diff workflow), I'll try to do a bunch of that in
followup diffs.

Test Plan: Ran "arc diff" in a mercurial repository, got a diff out of it.
Reviewed By: aran
Reviewers: Makinde, jungejason, tuomaspelkonen, aran, codeblock
CC: aran, epriestley, codeblock, fratrik
Differential Revision: 792

15 years agoFix a variable usage
epriestley [Sun, 7 Aug 2011 21:54:32 +0000 (14:54 -0700)]
Fix a variable usage

Summary: This stopped being available in scope when I refactored this
recentlyish.
Test Plan: Got error, saw useful message.
Reviewed By: jungejason
Reviewers: mgummelt, jungejason, tuomaspelkonen, aran
CC: aran, epriestley, jungejason
Differential Revision: 787

15 years agoFix documentation: stop __init__ rendering in bold
Edward Speyer [Tue, 2 Aug 2011 17:12:36 +0000 (18:12 +0100)]
Fix documentation: stop __init__ rendering in bold

Summary:
Requires
https://secure.phabricator.com/rPHU0acf708b9b0fdbf59e4399f14dd8295b6a96972c
from libphutil, which allows a backslash prefix to control escape
sequences such as bold, underline, and invert.

Test Plan: "arc help liberate"
Reviewed By: epriestley
Reviewers: epriestley
CC: aran, epriestley
Differential Revision: 767

15 years agoFix an obscure dependency issue in Arcanist + libphutil
epriestley [Fri, 29 Jul 2011 16:12:24 +0000 (09:12 -0700)]
Fix an obscure dependency issue in Arcanist + libphutil

Summary:
The module analyzer reads "phutil_require_module" in the source of a module as a
dependency, and tries to regenerate __init__.php if symbols from that module
aren't actually used. This creates patches which don't actually resolve the
problem, since changing __init__.php won't change the dependency.

Instead, trust that anyone using phutil_require_module in the source of a module
knows what they're doing and don't mark it as a dependency.

We currently have an issue with this in phabricator's Setup process since I load
some other libraries' modules just to test if they can be loaded

@lesha, this might be the issue you reported a while ago.

Test Plan: Ran "arc lint" on a module which pulls in another module explicitly
in the source, didn't get a no-op lint error.
Reviewed By: jungejason
Reviewers: jungejason, tuomaspelkonen, aran, lesha
CC: aran, epriestley, jungejason
Differential Revision: 770

15 years agoAdd an XHPAST lint rule for brace formatting
epriestley [Mon, 1 Aug 2011 20:18:53 +0000 (13:18 -0700)]
Add an XHPAST lint rule for brace formatting

Summary: See D753. Let's just have lint fix this. Depends on D754 (it fails to
detect all the blocks without that patch, but doesn't do anything bad).
Test Plan: Ran unit tests.
Reviewed By: jungejason
Reviewers: jungejason, tuomaspelkonen, aran
CC: hunterbridges, aran, epriestley, jungejason
Differential Revision: 755

15 years agoProvide "arc upload --json"
epriestley [Sat, 30 Jul 2011 03:17:49 +0000 (20:17 -0700)]
Provide "arc upload --json"

Summary:
  - Provide a "--json" flag for "arc upload"
  - Unify some of the stderr stuff across upload/download/paste.

Test Plan:
  - Ran "arc upload" and "arc upload --json", piped stderr away with 2>/dev/null
to verify only JSON got emitted to stdout
  - Ran "arc paste"

Reviewed By: codeblock
Reviewers: codeblock, jungejason, tuomaspelkonen, aran
CC: aran, codeblock
Differential Revision: 749

15 years agoAdd an "arc paste" workflow
epriestley [Sat, 30 Jul 2011 01:55:01 +0000 (18:55 -0700)]
Add an "arc paste" workflow

Summary: Read and write in the same workflow! Dogs and cats living together!
Test Plan:   - Performed a bunch of paste reads and writes and they looked ok?
Reviewed By: aran
Reviewers: codeblock, jungejason, tuomaspelkonen, aran
CC: aran
Differential Revision: 748

15 years agoSpecify date format in git blame
Jason Ge [Fri, 29 Jul 2011 22:22:37 +0000 (15:22 -0700)]
Specify date format in git blame

Summary:
right now 'arc blame' uses the user's blame.date setting, but
it will only work when the format is iso. So it will fail for user who
has customized it.

Test Plan:
run arc cover with 'blame.date' set to relative and verified
that 'arc cover' still works

Reviewed By: epriestley
Reviewers: epriestley, codeblock
CC: hwang, aran, epriestley
Differential Revision: 745

15 years agoAdd 'arc upload' and 'arc download'
epriestley [Fri, 29 Jul 2011 17:05:07 +0000 (10:05 -0700)]
Add 'arc upload' and 'arc download'

Summary: Mechanisms for interacting with Files via Arcanist.
Test Plan:
  - Ran 'arc upload x', 'arc upload x y z'
  - Ran 'arc download' with --as and --show.

Reviewed By: codeblock
Reviewers: codeblock, jungejason, tuomaspelkonen, aran
CC: aran, codeblock, epriestley
Differential Revision: 742

15 years agoMerge pull request #2 from tenorviol/master
Evan Priestley [Tue, 26 Jul 2011 19:22:33 +0000 (12:22 -0700)]
Merge pull request #2 from tenorviol/master

static function ArcanistDifferentialRevisionRef::newFromDictionary

15 years agoMarked ArcanistDifferentialRevisionRef::newFromDictionary as a static method to stati...
Chris Johnson [Tue, 26 Jul 2011 18:58:33 +0000 (11:58 -0700)]
Marked ArcanistDifferentialRevisionRef::newFromDictionary as a static method to statisfy E_STRICT standard

15 years agoRemove the size limit on arc side
Jason Ge [Mon, 25 Jul 2011 23:24:23 +0000 (16:24 -0700)]
Remove the size limit on arc side

Summary:
remove the size check. The conduit call will fail later if the
size is too large, and we will get better error message.

Test Plan:
run arc diff with files smaller and larger than the size
limit.

Reviewed By: epriestley
Reviewers: epriestley
CC: aran, epriestley
Differential Revision: 729

15 years agoMunge XHP class names when generating phutil dependency maps
James Ide [Sat, 23 Jul 2011 23:48:21 +0000 (16:48 -0700)]
Munge XHP class names when generating phutil dependency maps

Summary:
When phutil_analyzer builds the dependency graph I convert all class names w.r.t
XHP's internal naming scheme. It actually wouldn't be a terrible idea to do this
munging when phutil loads the symbols. I guess it doesn't really matter at the
moment since only Arcanist generates phutil maps and only libphutil reads them,
but it'd be nice to do this munging in as few places as possible in the future.

The XHP grammar does not allow elements to be interfaces
(https://github.com/facebook/xhp/blob/dafff2cc1844d1138c3388509c9560b87167a3bb/xhp/parser.y#L1688)
so I've only applied this to classes.

Test Plan:
Created a sample project:

  ./__phutil_library_init__.php
    hopping/__init__.php
           /hophophop.php

where that last file contains

  <?php
  class :bunny:hop-hop-hop extends :x:element {
    protected function render() {
      return <p>bunny goes hop hop hop</p>;
    }
  }

Ran phutil_mapper.php and generated __phutil_library_map__.php:

  <?php

  /**
   * This file is automatically generated. Use 'phutil_mapper.php' to rebuild i\
t.
   * @generated
   */

  phutil_register_library_map(array(
    'class' =>
    array(
      'xhp_bunny__hop_hop_hop' => 'hopping',
    ),
    'function' =>
    array(
    ),
    'requires_class' =>
    array(
      'xhp_bunny__hop_hop_hop' => 'xhp_x__element',
    ),
    'requires_interface' =>
    array(
    ),
  ));

Reviewed By: epriestley
Reviewers: epriestley
Commenters: aran
CC: aran, ide, epriestley
Differential Revision: 715

15 years agoSetting default minimumSeverity to zero from null
Jason Ge [Wed, 13 Jul 2011 23:33:18 +0000 (16:33 -0700)]
Setting default minimumSeverity to zero from null

Summary:
In hphp's version of idx, it uses debug_rlog() which is not
available in phabricator's code. It will be executed if null is passed
as the second value to idx.

Test Plan:
ran arc lint which still report error message, and php
./scripts/arcanist.php unit src/lint/linter/xhpast/__test__ doesn't
throw.

Reviewed By: epriestley
Reviewers: tuomaspelkonen, epriestley
CC: aran, jungejason, epriestley
Differential Revision: 666

15 years agoFlush output buffers before running 'arc'
epriestley [Sat, 16 Jul 2011 15:09:47 +0000 (08:09 -0700)]
Flush output buffers before running 'arc'

Summary: See D589. Some environments configure output buffering with a prepend script. This is rather silly, but we can at least recover from it.

Test Plan: Started multiple output buffers with ob_start() and then used phutil_console_confirm() to create a prompt. Verified that 'arc' was broken under output buffering prior to the patch, but now works correctly.

Reviewed By: dreuss

15 years agoDeprecate ArcanistBaseWorkflow::getUserGUID in favor of "PHID"
epriestley [Fri, 15 Jul 2011 19:44:03 +0000 (12:44 -0700)]
Deprecate ArcanistBaseWorkflow::getUserGUID in favor of "PHID"

Summary: One day all "GUID" references will be gone, maybe.
Test Plan: grep, ran workflow before changing and got a warning about
deprecation
Reviewed By: aran
Reviewers: mgummelt, tuomaspelkonen, aran, jungejason
CC: aran
Differential Revision: 671

15 years agoMove Conduit management into Workflow
epriestley [Wed, 13 Jul 2011 22:03:40 +0000 (15:03 -0700)]
Move Conduit management into Workflow

Summary:
The primary goal of this is to allow pre/post workflow hooks to upgrade a
workflow which doesn't require conduit into one which does, or one which doesn't
require authentication into one which does. They do this by calling
$workflow->establishConduit() or $workflow->authenticateConduit() respectively.

It also removes a bunch of dead code and a bunch of now-unnecessary public
interfaces.

Test Plan:
Broke my certificate and ran "arc list", "arc unit", "arc help", "arc
call-conduit".
Restored my certificate and re-ran the commands.

Reviewed By: mgummelt
Reviewers: mgummelt, jungejason, tuomaspelkonen, aran
CC: aran, epriestley, mgummelt
Differential Revision: 664

15 years agoRun post hook regardless of error code
mgummelt [Tue, 12 Jul 2011 21:34:27 +0000 (14:34 -0700)]
Run post hook regardless of error code

Summary:
In order to support more flexible post hooks.  Also send the
error code to the hook for use by client code.

Test Plan: None
Reviewed By: epriestley
Reviewers: epriestley
CC: dpepper, aran, epriestley
Differential Revision: 656

15 years agoUse phid instead of guid for image diff
Jason Ge [Sat, 9 Jul 2011 03:46:00 +0000 (20:46 -0700)]
Use phid instead of guid for image diff

Summary:
in https://secure.phabricator.com/rARC36de84ee, we changed to
use 'binary-phid' from 'binary-guid'. Several places are still using
'binary-guid'. Fix them.

Test Plan:
run 'arc patch' against a revision which was throwing
exception because of this issue and it worked.

Reviewed By: epriestley
Reviewers: epriestley, sgrimm
CC: aran, epriestley
Differential Revision: 624

15 years agoParallelize calls for ArcanistGitAPI::getWorkingCopyStatus
Yiding Jia [Tue, 5 Jul 2011 18:06:46 +0000 (11:06 -0700)]
Parallelize calls for ArcanistGitAPI::getWorkingCopyStatus

Summary:
executes the calls to git in parallel to improve startup performance of
arc lint and possibly other commands

Gets about a 2~3x speedup when repo is in buffer cache, with 4 cores.

Test Plan:
arc linted a repo with unstaged, untracked, staged, and committed
changes, see that the same files were linted.

Reviewed By: jungejason
Reviewers: jungejason, epriestley
Commenters: epriestley
CC: aran, jungejason, epriestley
Differential Revision: 594

15 years agoFrom Arcanist, send 'host' to server for validation on setup workflows
epriestley [Tue, 5 Jul 2011 14:19:30 +0000 (07:19 -0700)]
From Arcanist, send 'host' to server for validation on setup workflows

Summary: This allows us to detect and complain about mismatched client and
server host identities. It causes some subtle and not-so-subtle problems if the
client and server don't agree on the install's primary URI.
Test Plan: Ran "arc install-certificate" and "arc list" against my local host
with intentionally bogus configs and was warned. Ran with normal configs and
everything worked.
Reviewed By: tuomaspelkonen
Reviewers: jungejason, llorca, tuomaspelkonen, aran
CC: aran, tuomaspelkonen
Differential Revision: 591

15 years agoHave Arcanist record how much of my life was spent running each unit test
James Ide [Mon, 4 Jul 2011 06:31:14 +0000 (23:31 -0700)]
Have Arcanist record how much of my life was spent running each unit test

Summary:
Keeping unit tests speedy keeps them useful since people actually won't mind
running them. This diff records the time taken by each test and displays it nice
and colorized. Really, I just want to discourage non-unit tests from making
their way into ##__tests__##.

Some thoughts:

 - The "acceptableness" times are subjective but if dependencies are properly
mocked the times seem to be ok. Integration tests that make network requests to
third-party endpoints and pull in megabytes of data will not survive. This is a
good thing.
 - Fast tests get a gold star, encouraging small tests. I am sorry that the star
does not sparkle.
 - There is no way for a programmer to admit that their test is going to be slow
in some cases. They will be shamed with red text for the life of their test.
 - It might be confusing that fast but failing tests get green text and maybe a
gold star.

Test Plan: Ran some of the unit tests within Arcanist and libphutil. See
https://secure.phabricator.com/file/view/PHID-FILE-cdd3c94c219e0fd7470b/ for
sample output.
Reviewed By: epriestley
Reviewers: epriestley
CC: aran, epriestley
Differential Revision: 588

15 years agoProhibit creation of command-line revisions with yourself as the reviewer
epriestley [Thu, 30 Jun 2011 20:51:24 +0000 (13:51 -0700)]
Prohibit creation of command-line revisions with yourself as the reviewer

Summary:
We do this check on the web interface but not from the CLI.

Also clean up some GUID/PHID stuff (eventually all GUID references should be
replaced with PHID, although they mean the same thing).

Test Plan: Tried to create a revision with myself on the reviewer line, got
called out.
Reviewed By: jungejason
Reviewers: moskov, jungejason, tuomaspelkonen, aran
CC: aran, jungejason
Differential Revision: 564

15 years agoImprove library resolution chain for 'arc'
epriestley [Fri, 1 Jul 2011 02:20:41 +0000 (19:20 -0700)]
Improve library resolution chain for 'arc'

Summary:
We currently look:

  - In the working copy
  - Alongside libphutil/
  - In PHP include_path

Before checking next to libphutil/, check next to the working copy. The problem
right now is that javelin/ references diviner/, but it won't find it next to
javelin/, only next to the libphutil/ instance which is loaded off
/home/engshare/devtools.

Test Plan: Moved javelin to tmp/javelin and diviner to tmp/divinerx. Ran 'arc
list' and got a library load error. Moved 'divinerx' to 'diviner' and ran 'arc
list'. It loaded correctly. Ran '--trace' to verify load location.
Reviewed By: cpojer
Reviewers: cpojer, jungejason
CC: aran, cpojer
Differential Revision: 568

15 years agoProvide better documentation for lint engines, linters, and the PyLint linter
epriestley [Thu, 30 Jun 2011 02:32:03 +0000 (19:32 -0700)]
Provide better documentation for lint engines, linters, and the PyLint linter

Summary:
Document the relationship between lint engines and linters. Provide an example
linter. Improve the documentation of PyLintLinter, which has a bunch of
configuration stuff which you had to dig into the code to get.

Test Plan:
Ran "arc lint --engine ExampleLintEngine --lintall derp.py" on a file with a
Python syntax error in it. Read documentation.

Reviewed By: j3kuntz
Reviewers: j3kuntz, andrewjcg
CC: aran, j3kuntz
Differential Revision: 557

15 years agoFix "arc branch" to work if you are on "(no branch)" add revision IDs
epriestley [Wed, 29 Jun 2011 20:21:30 +0000 (13:21 -0700)]
Fix "arc branch" to work if you are on "(no branch)" add revision IDs

Summary:
If you checkout some commit you end up on "(no branch)" which currently breaks
the parser. Ignore that, and add revision IDs to the output. They aren't very
big and I hate flags so I didn't add a flag for this. You can add a flag to turn
them off if you really want.

Test Plan:
Ran "arc branch" and "arc branch --by-status" from a "(no branch)" working copy.

Reviewed By: slawekbiel
Reviewers: slawekbiel, ahupp, jungejason, tuomaspelkonen, aran, schrockn
CC: aran, slawekbiel
Differential Revision: 555

15 years agoAllow 'arc' to parse copies or added files
epriestley [Tue, 28 Jun 2011 23:19:47 +0000 (16:19 -0700)]
Allow 'arc' to parse copies or added files

Summary:
See task. This is a bizarre edge case which we incorrectly reject but should do
our best with.

Test Plan:
Created an added copy of a file and diffed it successfully.

Reviewed By: alex
Reviewers: alex, jungejason, tuomaspelkonen, aran
CC: aran, alex
Differential Revision: 547

15 years agoAdd by-status option to 'arc branch'
Adam Hupp [Fri, 24 Jun 2011 16:16:49 +0000 (09:16 -0700)]
Add by-status option to 'arc branch'

Summary:
This diff adds a '--by-status' argument to arc branch that sorts the
output by status.  Example output:

    Accepted
      my-branch                         Amazing change
    Needs Revision
      nah-nah                           Not so good change
    Needs Review
      in-progress-change                I have no idea
    No Revision
      etc                               etc

Blame Rev:

Task ID:  #

Reviewers: epriestley, slawekbiel

Test Plan:
Ran it with and without --by-status, saw expected output in both cases.

DiffCamp Revision:

Revert Plan:

Database Impact:

Memcache Impact:

Other Notes:

EImportant:

- begin *PUBLIC* platform impact section -
Bugzilla: #
- end platform impact -

Differential Revision: 512

15 years agoarc lint: include lint errors in unresolved messages
Andrew Gallagher [Mon, 27 Jun 2011 20:29:36 +0000 (13:29 -0700)]
arc lint: include lint errors in unresolved messages

Summary:
Currently, when arc-lint processes lint warnings and errors, it
accumulates the warnings into an "unresolvedMessages" array.  As
soon as it sees an errors, it breaks out of the loop that does the
collection and returns, causing individual lint errors messages to
not show up in differential.

This diff collects all lint warning and error messages into the
unresolved array.

Test Plan:
arc-diff on patch that had lint errors.  Verified that,
after this change, linte errors messages showed in differential.

Reviewed By: epriestley
Reviewers: jungejason, epriestley
Commenters: jungejason
CC: aran, epriestley, jungejason
Differential Revision: 543

15 years agoGive users meaningful error messages for missing 'arc' credentials
epriestley [Mon, 27 Jun 2011 03:43:24 +0000 (20:43 -0700)]
Give users meaningful error messages for missing 'arc' credentials

Summary:
We give you a worthless message that doesn't point at "arc install-certificate"
if you don't have an .arcrc right now. Instead, tell the user to run "arc
install-certificate".

Test Plan:
Nuked my ~/.arcrc and tried to run "arc list".

Reviewed By: llorca
Reviewers: codeblock, llorca, jungejason, aran, tuomaspelkonen
CC: aran, llorca
Differential Revision: 538

15 years agoVerify that ~/.arcrc is 600 before reading from it
epriestley [Sun, 26 Jun 2011 18:09:13 +0000 (11:09 -0700)]
Verify that ~/.arcrc is 600 before reading from it

Summary:
Since this has auth information in it now, we should prevent other users on the
system from reading it. Detect readable files and prompt the user to fix them.

Test Plan:
Did "o+r" on my ~/.arcrc, ran "arc list", got prompted, hit "Y", verified it set
perms to 600, ran "arc list" again and wasn't prompted.

Reviewed By: jungejason
Reviewers: fratrik, jungejason, aran, tuomaspelkonen
CC: aran, jungejason, epriestley
Differential Revision: 532

15 years agoDisable intraline diff highlighting algorithm for lines which contain UTF-8 text
epriestley [Fri, 24 Jun 2011 17:11:43 +0000 (10:11 -0700)]
Disable intraline diff highlighting algorithm for lines which contain UTF-8 text

Summary: This is sort of cheating, but just have this feature disable itself if the input contains multibyte UTF-8 characters. We can clean it up in the future, maybe when we have better utf8 tools.

This means that all the algorithms are safe to pass utf8 to, so we can get rid of all the "<?>" silliness.

Test Plan: Added a UTF8 character to a line, diffed it out, and got the entire line highlighted as changed. See: https://secure.phabricator.com/file/view/PHID-FILE-70fb54eb3f88dc057ab3/

Reviewers: jungejason, aran, tuomaspelkonen

CC:

Differential Revision: 514