]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
13 years agoFix hg amend during arc diff
durham [Tue, 16 Apr 2013 17:22:00 +0000 (10:22 -0700)]
Fix hg amend during arc diff

Summary:
When doing an arc diff with pending changes in your working copy
it was creating a new commit with the pending changes instead of amending
the existing one.  The problem was the author comparison was comparing
values like "John Smith <john@foo.com>" with "John Smith". The fix changes
$api->getAuthor() to return "John Smith" instead of the full string. This
matches the behavior (and implementation) found in the git api.

Test Plan:
hg book foo
touch a && hg commit -Ama
touch b && hg add b
arc diff
When prompted, amend the pending changes to the existing commit.

Verified that the changes were amended instead of making a new commit.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoConstruct a diganostic parser in BaseWorkflow::getChange()
epriestley [Mon, 15 Apr 2013 19:30:56 +0000 (12:30 -0700)]
Construct a diganostic parser in BaseWorkflow::getChange()

Summary:
@ender is reporting a parsing issue in SVN, but we don't build a parser with setWriteDiffOnFailure() set in this workflow right now so I can't get the raw file to fix the issue.

Use the onboard mechanism to build a parser with `setWriteDiffOnFailure()` set, so it will write the diff, so I can get a copy so I can fix the problem.

Test Plan: Ran `arc diff --preview` in an SVN repo with a linter.

Reviewers: ender, btrahan

Reviewed By: ender

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

13 years agoLint `TRUE`, `nUlL`, etc., for Phabricator conventions
epriestley [Mon, 15 Apr 2013 17:22:56 +0000 (10:22 -0700)]
Lint `TRUE`, `nUlL`, etc., for Phabricator conventions

Summary: Detect and fix unconventional spellings of `true`, `false`, `null` and `array` (these are the only keywords I've seen spelled unconventionally in the wild).

Test Plan: Unit tests.

Reviewers: DurhamGoode, btrahan, vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T2985

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

13 years agoAdd arc.land.update.default config for setting the default strategy
durham [Sun, 14 Apr 2013 18:48:22 +0000 (11:48 -0700)]
Add arc.land.update.default config for setting the default strategy

Summary:
This adds a arcconfig setting to allow specifying whether to use the merge
or rebase strategy when doing the feature branch update.
arc.land.update.default can be set to either 'rebase' or 'merge'.  The command
line flags will override this setting.

We have had trouble with arc land producing merge commits (introduced
with D4080) in git. They usually appear when arc land fails, and our users
are confused by the presence of a merge commit afterwards. Today it got even
worse since a user managed to get arc land to push the merge commit to the
server. This setting will allow us to turn it off for our uses.

Test Plan:
Verified the following combinations:
update.default not set + arc land (saw git merge in the trace)
update.default = 'rebase' + arc land (saw git rebase)
update.default = 'merge' + arc land (saw git merge)
update.default = 'rebase' + arc land --update-with-merge (saw git merge)
update.default = 'merge' + arc land --update-with-rebase (saw git rebase)

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoChange hg arc diff to detect up to the nearest parent with a diff
durham [Fri, 12 Apr 2013 21:11:51 +0000 (14:11 -0700)]
Change hg arc diff to detect up to the nearest parent with a diff

Summary:
Changes arc diff to choose the base commit as the first ancestor
that has a diff.  So if your tree looks like master->A->B->C->D, if you
have a diff on B (which will include A), when you run arc diff on D it will
only include C and D.

This makes the scenario for stacked diffs nicer.  A user can commit A, commit B,
arc diff, commit C, commit D, arc diff, arc land B, arc land D.

Test Plan:
Commit A on top of master
Commit B on top of A
arc diff
Commit C on top of B
Commit D on top of C
arc diff

Verify the second diff contains the changes in C and D, but not A and B.

hg up B
arc land --preview
Verify that arc land shows A and B

hg up D
arc land --preview
Verify that arc land shows A, B, C, and D
(arc land should be unaffected by this change.
It always tries to land the entire branch)

Reviewers: epriestley

Reviewed By: epriestley

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

13 years ago[svn] Fix removing a binary file without svn:mime-type set
Nick Harper [Wed, 10 Apr 2013 22:22:58 +0000 (15:22 -0700)]
[svn] Fix removing a binary file without svn:mime-type set

Summary:
If we're removing a binary file that didn't have svn:mime-type set properly,
we can't propset it (because the file doesn't exist locally). Instead, just
return a synthetic diff for the removed file.

Test Plan:
run arc diff in an svn working copy where I ran svn rm on a binary file that
doesn't have svn:mime-type set, and the diff correctly gets uploaded to
phabricator instead of erroring when trying to set properties.

Reviewers: epriestley, wez

Reviewed By: epriestley

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

13 years agoAllow 'arc diff .^' for hg repos
durham [Wed, 10 Apr 2013 00:00:34 +0000 (17:00 -0700)]
Allow 'arc diff .^' for hg repos

Summary:
Previously arc diff for hg only allowed bookmark names, rev numbers,
and commit hashes as the input base commit. This was because it escaped all
inputs and treated them as raw identifiers.

This change makes it treat the input as a revset if the escaped version fails.
This allows users to do things like "arc diff .^" when they only want to diff
the top commit.

Test Plan:
Created a stack of commits, master->A->B.
hg up B
arc diff .^
Verified the diff message only showed B as part of the diff.

arc diff .^~
Verified an error occurred ("Commit '.^~' is not a valid Mercurial commit id.")

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2888

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

13 years agoAdd py/pl files to $text_paths (remove l/y files?!)
Shayne Sweeney [Tue, 9 Apr 2013 22:06:55 +0000 (15:06 -0700)]
Add py/pl files to $text_paths (remove l/y files?!)

Summary:
I'm guessing this was refactored somewhere down the line and it meant
that Python and Perl files were no longer considered text files.

I'm imagining the old regex was: p(hp|y|l). Therefore I blame CSS.

Test Plan:
Perform an arc lint on a Python or Perl file that has trailing whitespace
on a line. It should prompt you for an autocorrecting lint.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoInvalidate SVN status cache after adding files
Jakub Vrana [Sat, 6 Apr 2013 16:25:35 +0000 (09:25 -0700)]
Invalidate SVN status cache after adding files

Summary: Cache invalidation is really one of the two hardest computer science problems.

Test Plan:
  lang=sh
  # in Subversion repository
  $ arc diff .arcconfig # untracked

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoHide Git merge stats in arc land
Jakub Vrana [Sat, 6 Apr 2013 16:23:41 +0000 (09:23 -0700)]
Hide Git merge stats in arc land

Test Plan:
  $ arc land # in Git repo

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoEscape ^ on command line (significant on Windows)
Jakub Vrana [Sat, 6 Apr 2013 06:17:40 +0000 (23:17 -0700)]
Escape ^ on command line (significant on Windows)

13 years agoDon't use command output as formatted string in arc land
Jakub Vrana [Sat, 6 Apr 2013 06:09:35 +0000 (23:09 -0700)]
Don't use command output as formatted string in arc land

13 years agoList the openssl functions as extension functions for lint
epriestley [Thu, 4 Apr 2013 23:17:19 +0000 (16:17 -0700)]
List the openssl functions as extension functions for lint

Summary:
sry 2 hear of ur lint trubles

(You may need to `arc liberate --force` or delete all your `src/.phutil_module_cache` after updating, see T1486.)

Test Plan: shrug shrug

Reviewers: btrahan, vrana

Reviewed By: btrahan

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

13 years agoDon't use `emailuser` in Mercurial
epriestley [Tue, 2 Apr 2013 21:06:46 +0000 (14:06 -0700)]
Don't use `emailuser` in Mercurial

Summary:
The `emailuser` template is a relatively recent addition to Mercurial, and a few users have complained about it. It also doesn't actually do what I thought it did, e.g. in an address like this:

  "Abraham Lincoln" <alincoln@whitehouse.gov>
   ^^^^^^^^^^^^^^^   ^^^^^^^^
         (1)            (2)

                     ^^^^^^^^^^^^^^^^^^^^^^^
                              (3)

...I want (1), but `emailuser` means (2). Instead, extract (1) with `getDisplayName()` and (3) with `getAddress()` using PhutilEmailAddress.

The implementation in Mercurial is not particularly sophisticated or magical (it just looks for "@" and "<") so we aren't really missing anything by doing this ourselves, at least today.

Also fix some issues in `arc export`, which literally no one uses, but which is occasionally useful for testing (as here).

Test Plan:
  - Ran `arc diff --only` in an `hg` repo, checked DB to see that name/email were correctly extracted.
  - Ran `arc export --git` in an `hg` repo, didn't get a long series of fatals.

Reviewers: btrahan, DurhamGoode

Reviewed By: DurhamGoode

CC: aran
Maniphest Tasks: T2866, T2858

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

13 years agoAdd hook for runtime config settings.
durham [Mon, 1 Apr 2013 18:26:17 +0000 (11:26 -0700)]
Add hook for runtime config settings.

Summary:
This adds a hook to allow external parties to provide config settings at runtime.
The hook is technically for when a RepositoryAPI is created, but that moment can
be used to set new config settings using the new setRuntimeConfig() api.

For example you could have a external hook that looks for keys like 'git:foo.bar'
or 'hg:foo.bar' and writes the value of 'foo.bar' based on whether the repo is a
git or a hg repo.

Test Plan:
Created a hook that looks for hg/git prefix versions of config keys.
Set hg:arc.feature.start.default to be "master" and set arc.feature.start.default
to be "trunk".
Ran arc feature in the hg repo.  It made a bookmark on master.
Ran arc feature in the git repo.  It made a branch on trunk.

Did it again, but with git:arc.feature... set instead.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMake arc land list the commits being landed.
durham [Fri, 29 Mar 2013 17:08:23 +0000 (10:08 -0700)]
Make arc land list the commits being landed.

Summary:
Arc land is a bit magical and some users have gotten bitten by
the fact that it collapses and lands every commit on the branch. To make
it explicit what is being landed, it now shows a list of the commits
that are being landed.  I also added a --preview flag that will just
print the commits that would be landed, but does nothing else.

Hopefully this make arc land a little less magical for people.

Test Plan:
arc land in the following scenarios:
- Landing one change
- Landing no changes
- Landing a stack of changes

Did it with hg and git.

Reviewers: epriestley

Reviewed By: epriestley

CC: nh, sid0, dschleimer, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5460

13 years agoAdd missing image functions to PHP extension functions list
Jakub Vrana [Thu, 28 Mar 2013 05:04:37 +0000 (05:04 +0000)]
Add missing image functions to PHP extension functions list

Summary:
Copied from PHP Manual.

Also fix missing cache key for implicitly linted file.

Test Plan:
  phabricator/ $ arc lint src/applications/files/PhabricatorImageTransformer.php # without GD2

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDon't connect to Conduit in `arc feature name`
Jakub Vrana [Sat, 23 Mar 2013 00:33:07 +0000 (17:33 -0700)]
Don't connect to Conduit in `arc feature name`

Summary: There's no need for having an Internet connection in creating a branch.

Test Plan:
  $ arc feature name # with disabled Internet
  $ arc feature
  [cURL/6] (https://secure.phabricator.com/api/conduit.connect)

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMake arc patch create a bookmark by default in hg
durham [Fri, 22 Mar 2013 00:52:07 +0000 (17:52 -0700)]
Make arc patch create a bookmark by default in hg

Summary:
Previously, arc patch would create a new commit under the existing
current bookmark in mercurial. There have been two discussions about what the
right behavior should be (D3334 and D3658). One side wants no commit at all,
and one side wants a commit under a new bookmark. The current implementation is
the worst of both worlds :(

This change makes it create a new bookmark at the revision's base before commiting,
same as the --bookmark flag used to do (which is now obsolete). That way the
existing bookmark doesn't move (in mercurial >=1.8). This is the same behavior
git has, which is convienent for groups migrating between the two.

Also makes hg's getCanonicalRevision handle svn revisions just like git. This way
arc patch will try to apply the patch to the appropriate revision in the history.

Test Plan:
Ran:
arc patch - Verified it created a new bookmark and commited on top of the
revision's base commit.

arc patch --nobranch - Verified it put the new commit on top of the current
bookmark without a new bookmark.

arc patch --nocommit - Verified it left all the changes in the working copy.

Also verified arc patch still works with git.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdded automatic stash / unstash support for Git in arc diff.
James Rhodes [Thu, 21 Mar 2013 22:51:39 +0000 (15:51 -0700)]
Added automatic stash / unstash support for Git in arc diff.

Summary:
- Added arc.autostash option to have this behaviour off by
default (but configurable on a per-project basis).
- Automatic stashing of changes now informs the user of how
to restore their working directory if Arcanist unexpectedly
terminates.
- Fixed an issue with finalizeWorkingCopy when the workflow
didn't require a clean working copy.

Test Plan:
Test `arc diff` when there are changes in the working
directory; by default it should tell you to stash or commit.
Turn on the arc.autostash option and try again; it should
automatically stash with a message on how to recover, and
it should restore the working directory automatically under
almost any circumstances (other than an unrecoverable error).

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMake arc land for hg more robust to failures
durham [Wed, 20 Mar 2013 22:06:10 +0000 (15:06 -0700)]
Make arc land for hg more robust to failures

Summary:
Adds error handling for several kinds of failure in arc land for
mercurial.  Previously it would often leave the repo in a confusing state
if something failed.

- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.

Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land

In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.

Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.

Reviewers: epriestley, dschleimer, sid0

Reviewed By: epriestley

CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394

13 years agoFix arc patch adding unnecessary files for hg repos
durham [Wed, 20 Mar 2013 21:40:28 +0000 (14:40 -0700)]
Fix arc patch adding unnecessary files for hg repos

Summary:
Arc patch was committing with -A (--addremove) which meant any random
files that were sitting around in the repo (like conflict .orig files) were
added to the commit.  The -A isn't even necessary since the hg import
adds and removes all the appropriate files for you.

Test Plan:
touch foo
arc patch --diff some-diff-id
Verified that foo was not added to the commit

Reviewers: epriestley, nh

Reviewed By: epriestley

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

13 years agoImprove error if python can't run pep8
Nick Harper [Tue, 19 Mar 2013 18:44:49 +0000 (11:44 -0700)]
Improve error if python can't run pep8

Summary:
On systems with an ancient version of python, the pep8 linter won't run.
Instead of blowing up in the user's face, we should display a nice error
message.

Test Plan:
Put /usr/bin (where the ancient version of python is) at the beginning of
my path and tried to lint some python. I got a nice error instead of a
stack trace.

Reviewers: epriestley, wez

Reviewed By: epriestley

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

13 years agoDon't use absolute path in `ArcanistDiffUtils`
Jakub Vrana [Thu, 14 Mar 2013 16:14:50 +0000 (09:14 -0700)]
Don't use absolute path in `ArcanistDiffUtils`

Summary: Improves Windows compatibility.

Test Plan: Ran failing unit test on Windows.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoParsing rcsdiff -u
Afaque Hussain [Thu, 14 Mar 2013 13:15:42 +0000 (06:15 -0700)]
Parsing rcsdiff -u

Summary: Added some sample rcsdiffs for adding and deleting a line from a file. Wrote some test cases to be tested by ArcanistDiffParser.

Test Plan: By making all the test cases pass.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoChange arc feature to use it's own config key for the start default
durham [Thu, 14 Mar 2013 00:01:23 +0000 (17:01 -0700)]
Change arc feature to use it's own config key for the start default

Summary:
Changes arc feature to read 'arc.feature.start.default' instead
of 'arc.land.onto.default'.  In our usage we actually need to fork off
a different branch than we land to, so separating these is useful.

Test Plan:
Set arc.land.onto.default = master
Set arc.feature.start.default = bar
arc feature foo
cat .git/config
Verified the foo branch tracked bar

Reviewers: epriestley, nh

Reviewed By: epriestley

CC: wez, dschleimer, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5336

13 years agoCompute lint cache key before linting
Jakub Vrana [Mon, 11 Mar 2013 01:49:02 +0000 (18:49 -0700)]
Compute lint cache key before linting

Summary: If user changes the file contents during linting (usually when prompted to apply a patch) then we save the old messages to the new file contents. Fix that by computing the hash before linting (or after applying patch).

Test Plan: Changed the file during linting, verified that the file hash didn't change.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoImprove Windows compatibility
Jakub Vrana [Mon, 11 Mar 2013 01:08:14 +0000 (18:08 -0700)]
Improve Windows compatibility

Test Plan:
  $ arc liberate
  $ arc lint

Reviewers: epriestley

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

13 years agoDispatch an event in arc land right before pushing a revision
Alok Menghrajani [Sat, 9 Mar 2013 02:32:36 +0000 (18:32 -0800)]
Dispatch an event in arc land right before pushing a revision

Summary: I looked at the pros & cons at adding hooks in git/hg vs arc land and I prefer arc land.

Test Plan:
* added an event listener and made sure I could handle the event.
* made sure things get reverted when the event handler throws an exception.

Reviewers: vrana, epriestley, pieter

Reviewed By: epriestley

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

13 years agoInitialize variable in lint patch output
vrana [Fri, 8 Mar 2013 23:25:33 +0000 (15:25 -0800)]
Initialize variable in lint patch output

13 years agoImprove the description of using `arc land --revision`
vrana [Thu, 7 Mar 2013 19:49:34 +0000 (11:49 -0800)]
Improve the description of using `arc land --revision`

Summary: The message suggests that only one revision would land.

Test Plan: Read it.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoMinor, fix `arc land` for the case of no dependencies.
epriestley [Fri, 8 Mar 2013 01:21:37 +0000 (17:21 -0800)]
Minor, fix `arc land` for the case of no dependencies.

Auditors: Afaque_Hussain

13 years agoIgnore remote errors in parsing Mercurial log
vrana [Thu, 7 Mar 2013 00:32:38 +0000 (16:32 -0800)]
Ignore remote errors in parsing Mercurial log

Summary:
This probably indicates some none fatal error, e.g.:

> remote: Certificate invalid: name is not a listed principal

The best thing here would be to avoid the error but we shouldn't explode even if it is there.
I tried to mute the error from the output but didn't find a switch or config option to do it.

Test Plan:
  $ hg outgoing --branch default --style default

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoIf a revision depends on another revision which has not yet been closed, warn the...
Afaque Hussain [Thu, 7 Mar 2013 16:55:34 +0000 (08:55 -0800)]
If a revision depends on another revision which has not yet been closed, warn the developer

Summary: Have arc land inspect the revision if it depends on some other revisions which haven't been closed yet. If yes, then warn users.

Test Plan: Will test them locally.

Reviewers: epriestley, AnhNhan

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

13 years agoFix "arc" when `arcanist/` lives in some directory with spaces in the name
epriestley [Wed, 6 Mar 2013 22:43:18 +0000 (14:43 -0800)]
Fix "arc" when `arcanist/` lives in some directory with spaces in the name

Summary: This shell script needs more quotes.

Test Plan: Ran "arc" with `arcanist/` inside a directory called `s p a c e s`.

Reviewers: irinav, vrana

Reviewed By: vrana

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

13 years agoDocument parameters
epriestley [Wed, 6 Mar 2013 21:47:05 +0000 (13:47 -0800)]
Document parameters

Summary: unlike the hooks I copy/pasted, these hooks have parameters

Test Plan: read it

Reviewers: vrana

Reviewed By: vrana

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

13 years agoAdd willRunTestCases / didRunTestCases hooks
epriestley [Wed, 6 Mar 2013 21:40:07 +0000 (13:40 -0800)]
Add willRunTestCases / didRunTestCases hooks

Summary: These hooks allow test cases to build shared resources -- notably, database fixtures.

Test Plan: See next diff.

Reviewers: vrana

Reviewed By: vrana

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

13 years agoFix bug with `arc unit --everything` when coverage is available
epriestley [Wed, 6 Mar 2013 21:39:31 +0000 (13:39 -0800)]
Fix bug with `arc unit --everything` when coverage is available

Summary: We don't set $paths when running --everything.

Test Plan: Ran `arc unit --everything` with coverage.

Reviewers: vrana

Reviewed By: vrana

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

13 years agoAllow `new self` in linter
vrana [Tue, 5 Mar 2013 21:38:49 +0000 (13:38 -0800)]
Allow `new self` in linter

Summary: Also allow `sTaTiC::$x` which is a valid PHP (contrary to `sElF::$x` which is invalid PHP but I allowed that too).

Test Plan:
  new self;

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdd arcconfig setting for default arc feature start
durham [Tue, 5 Mar 2013 20:48:53 +0000 (12:48 -0800)]
Add arcconfig setting for default arc feature start

Summary:
Adds arc.feature.start.default arcconfig setting to specify
a default value for 'start' in 'arc feature name start'. This lets
users always branch from origin/master (or whatever the main branch is).

Also cleaned up the 'feature' help text a little. The stuff about sorting
and closed/abandoned revisions is explained via the options list already.

Test Plan:
Ran arc feature with/without a start and with/without the config
setting set.

Reviewers: epriestley, vrana

Reviewed By: epriestley

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

13 years agoComplain about Reuse of By-ref Iterators
Andrew Chen [Tue, 5 Mar 2013 15:45:02 +0000 (07:45 -0800)]
Complain about Reuse of By-ref Iterators

Summary:
Added a lint rule that warns about reusing iterator reference
variables.

Test Plan:
- Add a file with examples found in with https://secure.phabricator.com/T2536
- Did not make a unit test yet

Reviewers: vrana, bill, epriestley

Reviewed By: epriestley

CC: aran, epriestley, Korvin
Maniphest Tasks: T2536

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

13 years ago`arc feature` set up git tracking branch
Ryan Patterson [Mon, 4 Mar 2013 05:43:59 +0000 (21:43 -0800)]
`arc feature` set up git tracking branch

Summary:
When using arc feature, it should set up the tracking branch to be
master.

Test Plan:
  ./bin/arc feature tracking

Reviewers: vrana, epriestley

Reviewed By: epriestley

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

13 years agoRespect British spelling also in arguments
vrana [Sat, 2 Mar 2013 00:07:16 +0000 (16:07 -0800)]
Respect British spelling also in arguments

Summary: These are the errors I really do.

Test Plan:
  $ arc diff --no-lint
  (Assuming '--no-lint' is the British spelling of '--nolint'.)
  $ arc diff --reviewer a
  (Assuming '--reviewer' is the British spelling of '--reviewers'.)

New unit test.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoUse hg phases to detect outgoing when phases are supported
durham [Fri, 1 Mar 2013 22:10:25 +0000 (14:10 -0800)]
Use hg phases to detect outgoing when phases are supported

Summary:
There was an accidental ! in the phase vs outgoing condition
which caused it to use 'hg outgoing' when it should have used the draft()
phase.  Fixing this shaves 4.5 seconds off 'arc diff' on large repos.

Test Plan:
Ran arc diff --trace.  Noted that the draft() was used and that the diff
contained the correct files and commit.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoUse bookmark terminology if `arc land` on hg bookmark
mconnor [Fri, 1 Mar 2013 22:04:05 +0000 (14:04 -0800)]
Use bookmark terminology if `arc land` on hg bookmark

Summary: Changes message for `arc land` that displays current branch or bookmark (if none is specified) to appropriately use the term 'bookmark' when on a bookmark in an hg repository.

Test Plan:
Ran `arc land` on new git and hg repositories, checking for correct identification of 'branch' or 'bookmark'.

~/test$ mkdir hg-test
~/test$ mkdir git-test
~/test$ cd hg-test
~/test/hg-test$ hg init
~/test/hg-test$ hg branch
default
~/test/hg-test$ hg bookmarks
no bookmarks set
~/test/hg-test$ arc land
Landing current branch 'default'.
Usage Exception: You can not land a branch onto itself -- you are trying to land 'default' onto 'default'. For more information on how to push changes, see 'Pushing and Closing Revisions' in 'Arcanist User Guide: arc diff' in the documentation. You may be able to 'arc amend' instead.
~/test/hg-test$ hg bookmark testmark
~/test/hg-test$ hg bookmarks
 * testmark                  -1:000000000000
~/test/hg-test$ hg branch
default
~/test/hg-test$ arc land
Landing current bookmark 'testmark'.
Usage Exception: Source testmark is a bookmark but destination default is not a bookmark. When landing a bookmark, the destination must also be a bookmark. Use --onto to specify a bookmark, or set arc.land.onto.default in .arcconfig.

Confirm still works on a git branch:

~/test/hg-test$ cd ../git-test/
~/test/git-test$ ls
~/test/git-test$ git init
Initialized empty Git repository in ~/test/git-test/.git/
~/test/git-test$ touch testfile
~/test/git-test$ git commit -am 'Test file'
~/test/git-test$ git branch
* master
~/test/git-test$ arc land
Landing current branch 'master'.
Usage Exception: You can not land a branch onto itself -- you are trying to land 'master' onto 'master'. For more information on how to push changes, see 'Pushing and Closing Revisions' in 'Arcanist User Guide: arc diff' in the documentation. You may be able to 'arc amend' instead.

Reviewers: DurhamGoode, epriestley

Reviewed By: DurhamGoode

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

13 years agoRender unit results progressively
vrana [Wed, 27 Feb 2013 21:59:12 +0000 (13:59 -0800)]
Render unit results progressively

Summary:
Some tests take longer (fixtures usually around 1 second for me) and also FB runs all tests on deploy.
I want to see all results immediately.

Test Plan:
Added `usleep(200000)` to `resultTest()`, then:

  $ arc unit
  Saw results printed one by one.

Also didn't pass `$renderer` to `ArcanistPhutilTestCase` and saw empty output.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoImprove hg arc diff perf when image files are uploaded
durham [Thu, 28 Feb 2013 17:46:42 +0000 (09:46 -0800)]
Improve hg arc diff perf when image files are uploaded

Summary:
arc diff called 'hg cat' twice for every image binary in the diff.
This turns out to take 1 second per call on a large repo because mercurial
has to parse the manifest every time.

Now arc diff batches up all the files and does only two 'hg cat'
commands.  This makes the cost constant relative to the number of
images being uploaded.

Test Plan:
Ran arc diff on a diff with 30 images on both git and hg.
Verified that it was fast and that the images showed up in the web ui.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix arc lint on working copy changes in mercurial repos
durham [Wed, 27 Feb 2013 00:15:29 +0000 (16:15 -0800)]
Fix arc lint on working copy changes in mercurial repos

Summary:
Previously, running arc lint on a set of changes that only
existed in your working copy threw an exception in mercurial repos.
It was trying to use the revset "...." (i.e. the range from . to .),
which didn't parse. Even if I fix that it still doesn't work because
getRawDiffText did not include the working copy changes (which it does
in git).  I removed the check so the function now acts the same as in
git and arc lint works on working copy changes. I've seen this error before
in other places so hopefully this change will also fix any other areas,
that depended on getRawDiffText working the same as git.

The logic I removed was added in D1954 to support diffing against
uncommited changes.  That workflow should be unchanged.  arc diff will
still prompt the user if there are uncommited changes, and the user can
still choose to abort or continue.

Let me know if I missed something important which makes this a bad idea.

Test Plan:
Edited a file in the working directory of a hg repo.
arc lint
Verified lint ran successfully.

Also ran arc diff and land with and without working copy changes to make sure
they still work.  I'd kill for some tests in this area...

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: dschleimer, bos, sid0, aran, Korvin
Maniphest Tasks: T1631

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

13 years agoInclude linter class MD5 in linter version
vrana [Tue, 26 Feb 2013 23:20:13 +0000 (15:20 -0800)]
Include linter class MD5 in linter version

Summary:
People constantly forget to bump the linter version and I don't see a way how to stop it.
This may bump the version even if it wouldn't be required but let's rather undercache than overcache.

Test Plan: `var_dump($version)`.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoCatch exceptions in didRunLinters()
vrana [Tue, 26 Feb 2013 19:35:58 +0000 (11:35 -0800)]
Catch exceptions in didRunLinters()

Test Plan: Threw in `didRunLinters()` of one linter, still saw the result of other linters and "Some linters failed" at the end.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoInitialize used variable in lint console renderer
vrana [Tue, 26 Feb 2013 00:23:27 +0000 (16:23 -0800)]
Initialize used variable in lint console renderer

13 years agoSupport `arc lint --output none`
vrana [Mon, 25 Feb 2013 20:33:51 +0000 (12:33 -0800)]
Support `arc lint --output none`

Summary:
I want to run lint on background and I'm interested only in side effect of caching (and maybe exit status).
This is better than discarding stdout later because we don't do unnecessary work and error conditions are still printed.

Test Plan:
  $ arc lint --output none # with error
  $ echo $?
  $ arc lint --output none # with no lintable paths
  $ arc lint --output none # witout errors

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoAdd unit tests for implicit fallthrough lint rule
vrana [Sat, 23 Feb 2013 05:12:29 +0000 (21:12 -0800)]
Add unit tests for implicit fallthrough lint rule

Summary:
The perf fix actually catches some real problems.
I didn't find anything in libphutil, Arcanist and Phabricator though.

Also bump version.

Also allow configuring the hook.

Test Plan:
Added a test, saw it fail with the old code.
Repeat for hook.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix intraline lint patch rendering
vrana [Sat, 23 Feb 2013 00:55:22 +0000 (16:55 -0800)]
Fix intraline lint patch rendering

Summary: `,` -> `, ` is currently highlighted wrong.

Test Plan:
Looked at patches of these errors:

- License linter
- `0+0`
- `0,0`

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoChange ArcanistLintRenderer to class
vrana [Sat, 23 Feb 2013 00:12:53 +0000 (16:12 -0800)]
Change ArcanistLintRenderer to class

Summary: Renderers **are** renderers not **can** render.

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDon't amend existing revision with `arc diff --create`
vrana [Fri, 22 Feb 2013 17:52:00 +0000 (09:52 -0800)]
Don't amend existing revision with `arc diff --create`

Summary: If there's other revision in last commit message and I said `--create` then it is clear that I want to create a new commit.

Test Plan:
  $ arc diff --create # in dirty working copy on top of my open revision

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoSpeedup implicit fallthrough lint rule by 99.5 %
vrana [Fri, 22 Feb 2013 21:49:16 +0000 (13:49 -0800)]
Speedup implicit fallthrough lint rule by 99.5 %

Summary: At least on my sample file.

Test Plan: Saw time 0.073 s instead of 12.606 s.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix arc diff --verbatim
vrana [Fri, 22 Feb 2013 20:33:31 +0000 (12:33 -0800)]
Fix arc diff --verbatim

13 years agoDeclare that amend and land are supported by Mercurial
vrana [Fri, 22 Feb 2013 18:14:44 +0000 (10:14 -0800)]
Declare that amend and land are supported by Mercurial

Test Plan: Read it.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoCreate a new diff if the user says so
vrana [Fri, 22 Feb 2013 17:48:33 +0000 (09:48 -0800)]
Create a new diff if the user says so

Summary: If I have //Differential Revision// in my commit message then `arc diff --create` updates that revision instead of creating a new one.

Test Plan:
  $ arc diff --create # on top of commit message with Differential Revision

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoLog two times per linter instead of N
vrana [Fri, 22 Feb 2013 17:21:07 +0000 (09:21 -0800)]
Log two times per linter instead of N

Summary: This number seems more interesting and it includes time for resolving futures which is the main part of some linters.

Test Plan:
  $ arc --trace lint

Reviewers: fdeliege, epriestley

Reviewed By: epriestley

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

13 years agoAdd hgsprintf() and jsprintf() to dynamic string lint warning
epriestley [Fri, 22 Feb 2013 00:44:34 +0000 (16:44 -0800)]
Add hgsprintf() and jsprintf() to dynamic string lint warning

Summary: Soon all functions will accept only static parameters! glorious!

Test Plan: Added a couple tests.

Reviewers: vrana

Reviewed By: vrana

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

13 years agoRemove hgsprintf() from arcanist
epriestley [Fri, 22 Feb 2013 00:44:19 +0000 (16:44 -0800)]
Remove hgsprintf() from arcanist

Summary: Moving to libphutil.

Test Plan: unit

Reviewers: vrana

Reviewed By: vrana

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

13 years agoMake ArcanistLintWorkflow final
vrana [Thu, 21 Feb 2013 20:35:43 +0000 (12:35 -0800)]
Make ArcanistLintWorkflow final

Summary: FB doesn't extend it.

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoCall willLintPath() in future linter
vrana [Thu, 21 Feb 2013 09:22:25 +0000 (01:22 -0800)]
Call willLintPath() in future linter

Summary: Also simplify creating futures.

Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, s.o.butler
Differential Revision: https://secure.phabricator.com/D5042

13 years agoUse Damerau-Levenshtein to improve british spellings
epriestley [Thu, 21 Feb 2013 18:16:02 +0000 (10:16 -0800)]
Use Damerau-Levenshtein to improve british spellings

Summary: Price transpositions very cheaply. We might need to edit these weights a bit, but this covers the two previous cases ("test", "alnd") and gets them right.

Test Plan: Unit tests, various `arc x` tests.

Reviewers: vrana

Reviewed By: vrana

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

13 years agoFix filter/sort order of operations for british spellings
epriestley [Thu, 21 Feb 2013 18:15:20 +0000 (10:15 -0800)]
Fix filter/sort order of operations for british spellings

Summary: Currently, if we match "alnd" to "land" and "amend" equally (distance 2), we drop "land" with the other part of the rule. Stop doing that.

Test Plan:
Unit tests. Also:

```
$ arc alnd
Usage Exception: Unknown command 'alnd'. Try 'arc help'.

Did you mean:
    amend
    land
```

Reviewers: vrana

Reviewed By: vrana

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

13 years agoUse full message if XHPAST fails to parse the file
vrana [Thu, 21 Feb 2013 09:44:48 +0000 (01:44 -0800)]
Use full message if XHPAST fails to parse the file

Summary:
The message is too defensive.

Test Plan: Tested in the fork.

Reviewers: epriestley, nh

Reviewed By: epriestley

CC: aran, Korvin, s.o.butler
Differential Revision: https://secure.phabricator.com/D5043

13 years agoResolve XHPAST linter futures on background
vrana [Tue, 19 Feb 2013 21:42:09 +0000 (13:42 -0800)]
Resolve XHPAST linter futures on background

Summary: This is a little bit tricky - if both XHPAST and PhutilXHPAST linters lint the same path then they get the same future wrapped in two different Future iterators.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDelete newLintAtLine()
vrana [Fri, 8 Feb 2013 22:30:25 +0000 (14:30 -0800)]
Delete newLintAtLine()

Summary: Nobody needs it because `raiseLintAtLine()` returns the message.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agofix 'arc feature' not creating bookmarks on mercurial
durham [Thu, 21 Feb 2013 04:06:16 +0000 (20:06 -0800)]
fix 'arc feature' not creating bookmarks on mercurial

Summary:
The arc feature command wasn't actually creating bookmarks
on mercurial. It needs to call 'hg bookmark' instead of 'hg update'

Also removed an unnecessary hgsprintf since there were no arguments.

Test Plan:
Ran 'arc feature foo' and 'arc feature bar tip^'.
The former created a bookmark at my current location.
The latter created a bookmark at tip^ and moved me to that revision.

Reviewers: vrana, epriestley

Reviewed By: epriestley

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

13 years agoRemove dead class from library map.
epriestley [Wed, 20 Feb 2013 23:10:34 +0000 (15:10 -0800)]
Remove dead class from library map.

13 years agoUndumb other generic text linters
epriestley [Wed, 20 Feb 2013 22:36:53 +0000 (14:36 -0800)]
Undumb other generic text linters

Summary:
Make all the broad-spectrum text linters use the new binary check.

I didn't touch `ComprehensiveLintEngine` because it's a nest of vipers and no one has complained; see T2039.

Test Plan: Ran `arc lint` on text files and binaries in a libphutil project (arcanist).

Reviewers: lisp

Reviewed By: lisp

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

13 years agoAdd linting for syntax brought in by unresolved merge conflicts.
Robert Smith [Wed, 20 Feb 2013 22:19:55 +0000 (14:19 -0800)]
Add linting for syntax brought in by unresolved merge conflicts.

Summary:
Add linting capability for detecting files which contain
syntax introduced by unresolved merge conflicts. The detection is
file-type-agnostic (the only requirement is that the file is a text
file).

Test Plan:
Tested in three ways.

The first way is to add all three forms of syntax to a file to
indicate a merge conflict. HPHP will pick this up as a syntax error
before this linter reaches it.

The second way is to add the syntax in a comment. In that case, this
linter will show three warnings. For example:

    $ arc lint ArcanistMergeConflictLinter.php
    >>> Lint for arcanist/src/lint/linter/ArcanistMergeConflictLinter.php:

       Warning  (MERGECONFLICT1) Unresolved merge conflict
        This syntax indicates there is still an unresolved merge conflict.

                  20
                  21     foreach ($lines as $lineno => $line) {
                  22 /*
        >>>       23 >>>>>>>
                  24
                  25 =======

       Warning  (MERGECONFLICT1) Unresolved merge conflict
        This syntax indicates there is still an unresolved merge conflict.

                  22 /*
                  23 >>>>>>>
                  24
        >>>       25 =======
                  26
                  27 <<<<<<<

       Warning  (MERGECONFLICT1) Unresolved merge conflict
        This syntax indicates there is still an unresolved merge conflict.

                  24
                  25 =======
                  26
        >>>       27 <<<<<<<
                  28
                  29 */

The last test was to test on various different file types, including
JavaScript, PHP, an animated GIF, a PNG, and a Bash file to make sure
the file type detection worked. Each of the aforementioned tests
passed.

Reviewers: vrana, epriestley

Reviewed By: epriestley

CC: aran, epriestley, Korvin
Maniphest Tasks: T2547

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

13 years agoFix issue with SVN property changes under Windows
epriestley [Wed, 20 Feb 2013 21:24:14 +0000 (13:24 -0800)]
Fix issue with SVN property changes under Windows

Summary: We were incorrectly matching `$` in the regexp against a possible `\r\n`. I missed this earlier when trying to catch all of these.

Test Plan:
  - Added unit test and made it pass.
  - Did another search for `getLine()` to see if I could spot any more of these, but failed to identify any via inspection.

Reviewers: vrana, mbishopim3

Reviewed By: mbishopim3

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

13 years agoSimplify (?) arc upload code and make it more future-oriented
epriestley [Wed, 20 Feb 2013 20:24:32 +0000 (12:24 -0800)]
Simplify (?) arc upload code and make it more future-oriented

Summary: See discussion in D4968. This makes us run `file.uploadhash` calls in parallel, to slightly improve performance.

Test Plan:
Created a binary change in a commit:

  $ head -c65535 /dev/urandom > a_random_file
  $ git add .
  $ git commit -m .
  [master 32e4c0a] .
   1 files changed, 0 insertions(+), 0 deletions(-)
   create mode 100644 a_random_file

Verified `arc diff` called `conduit.query`, then `file.uploadhash` (which we expect to fail; the file is new), then `file.upload`:

  $ arc diff HEAD^ --only --trace
  ...
  Uploading 1 files...
  >>> [15] <conduit> conduit.query() <bytes = 157>
  >>> [16] <http> http://local.aphront.com/api/conduit.query
  <<< [16] <http> 111,500 us
  <<< [15] <conduit> 112,169 us
  >>> [17] <conduit> file.uploadhash() <bytes = 254>
  >>> [18] <http> http://local.aphront.com/api/file.uploadhash
  <<< [18] <http> 85,386 us
  <<< [17] <conduit> 85,798 us
  >>> [19] <conduit> file.upload() <bytes = 97009>
  >>> [20] <http> http://local.aphront.com/api/file.upload
  <<< [20] <http> 144,098 us
  <<< [19] <conduit> 144,550 us
  Uploaded 'a_random_file' (new).
  Upload complete.
  ...
  Created a new Differential diff:
          Diff URI: http://local.aphront.com:8080/differential/diff/202/

  Included changes:
    A (bin) a_random_file

Created the same diff again, verified that we skip the data transfer this time:

  $ arc diff HEAD^ --only --trace
  ...
  Uploading 1 files...
  >>> [15] <conduit> conduit.query() <bytes = 157>
  >>> [16] <http> http://local.aphront.com/api/conduit.query
  <<< [16] <http> 112,717 us
  <<< [15] <conduit> 113,374 us
  >>> [17] <conduit> file.uploadhash() <bytes = 254>
  >>> [18] <http> http://local.aphront.com/api/file.uploadhash
  <<< [18] <http> 95,545 us
  <<< [17] <conduit> 95,921 us
  Uploaded 'a_random_file' (new).
  Upload complete.
  ...
  Created a new Differential diff:
          Diff URI: http://local.aphront.com:8080/differential/diff/203/

  Included changes:
    A (bin) a_random_file

Created a new commit which adds a new file and updates the exiting file:

  $ head -c65535 /dev/urandom > another_file
  $ head -c65535 /dev/urandom >> a_random_file
  $ git add .
  $ git commit -m .
  [master 28f4fbd] .
   2 files changed, 0 insertions(+), 0 deletions(-)
   create mode 100644 another_file

Verified `arc diff` transfers one file by hash (old version of the first file) and two by data (new first file, new second file):

  $ arc diff HEAD^ --only --trace
  ...
  Uploading 3 files...
  >>> [19] <conduit> conduit.query() <bytes = 157>
  >>> [20] <http> http://local.aphront.com/api/conduit.query
  <<< [20] <http> 114,825 us
  <<< [19] <conduit> 115,517 us
  >>> [21] <conduit> file.uploadhash() <bytes = 254>
  >>> [22] <http> http://local.aphront.com/api/file.uploadhash
  >>> [23] <conduit> file.uploadhash() <bytes = 254>
  >>> [24] <http> http://local.aphront.com/api/file.uploadhash
  >>> [25] <conduit> file.uploadhash() <bytes = 253>
  >>> [26] <http> http://local.aphront.com/api/file.uploadhash
  <<< [24] <http> 104,310 us
  <<< [26] <http> 105,211 us
  <<< [25] <conduit> 105,587 us
  <<< [22] <http> 112,631 us
  <<< [25] <conduit> 111,437 us
  Uploaded 'a_random_file' (old).
  <<< [25] <conduit> 111,678 us
  >>> [27] <conduit> file.upload() <bytes = 193912>
  >>> [28] <http> http://local.aphront.com/api/file.upload
  >>> [29] <conduit> file.upload() <bytes = 97379>
  >>> [30] <http> http://local.aphront.com/api/file.upload
  <<< [28] <http> 153,126 us
  <<< [29] <conduit> 161,180 us
  Uploaded 'a_random_file' (new).
  <<< [30] <http> 678,739 us
  <<< [29] <conduit> 679,121 us
  Uploaded 'another_file' (new).
  Upload complete.
  ...
  Created a new Differential diff:
          Diff URI: http://local.aphront.com:8080/differential/diff/204/

  Included changes:
    M (bin) a_random_file
    A (bin) another_file

Ran the same command again, verified three uploads by hash:

  $ arc diff HEAD^ --only --trace
  ...
  Uploading 3 files...
  >>> [19] <conduit> conduit.query() <bytes = 157>
  >>> [20] <http> http://local.aphront.com/api/conduit.query
  <<< [20] <http> 117,058 us
  <<< [19] <conduit> 117,792 us
  >>> [21] <conduit> file.uploadhash() <bytes = 254>
  >>> [22] <http> http://local.aphront.com/api/file.uploadhash
  >>> [23] <conduit> file.uploadhash() <bytes = 254>
  >>> [24] <http> http://local.aphront.com/api/file.uploadhash
  >>> [25] <conduit> file.uploadhash() <bytes = 253>
  >>> [26] <http> http://local.aphront.com/api/file.uploadhash
  <<< [22] <http> 103,373 us
  <<< [24] <http> 105,418 us
  <<< [26] <http> 105,251 us
  <<< [25] <conduit> 105,604 us
  Uploaded 'a_random_file' (old).
  <<< [25] <conduit> 105,844 us
  Uploaded 'a_random_file' (new).
  <<< [25] <conduit> 106,053 us
  Uploaded 'another_file' (new).
  Upload complete.
  ...
  Created a new Differential diff:
          Diff URI: http://local.aphront.com:8080/differential/diff/205/

  Included changes:
    M (bin) a_random_file
    A (bin) another_file
  $

Reviewers: kwadwon

Reviewed By: kwadwon

CC: aran
Maniphest Tasks: T2456

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

13 years agoLog slow linters using service call
François Deliège [Tue, 5 Feb 2013 01:25:37 +0000 (17:25 -0800)]
Log slow linters using service call

Summary:
Following @epriestley suggestion to use PhutilServiceProfiler to log lint as a service call

Test Plan: arc lint

Reviewers: vrana

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

13 years agoApply new whitespace lint rules to arcanist/
epriestley [Tue, 19 Feb 2013 22:09:20 +0000 (14:09 -0800)]
Apply new whitespace lint rules to arcanist/

Summary: Automated changes from `arc lint`.

Test Plan: Looked them over.

Reviewers: vrana

Reviewed By: vrana

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

13 years agoAdd a lint rule for spaces before the closing paren of a function/method call
epriestley [Tue, 19 Feb 2013 21:50:13 +0000 (13:50 -0800)]
Add a lint rule for spaces before the closing paren of a function/method call

Summary: This is technically documented, but not currently enforced and we aren't consistent about it in the codebase.

Test Plan: See D5002.

Reviewers: chad, vrana

Reviewed By: chad

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

13 years agoImprove mercurial 'arc land' perf by avoiding updates
durham [Tue, 19 Feb 2013 21:36:02 +0000 (13:36 -0800)]
Improve mercurial 'arc land' perf by avoiding updates

Summary:
Mercurial 'arc land --hold' was taking 90+ seconds on our large
repository.  Since most of arc land doesn't require any particular working
directory, I've changed the mercurial logic to avoid all updates except for
two: the one prior to finding the revision (only applies if the user specified
--branch), and the one at the end to leave the user in a good state.

Also got rid of a 'hg outgoing' call when phases are supported. Also changed
the hg-subversion detection to just look for .hg/svn instead of running 'hg
svn info', which was taking 4 seconds.

Now arc land takes about 50 seconds. Still much worse than git's 25 seconds.
One big hot spot is in the two 'hg rebase' calls, which account for 25 seconds
(versus 11 seconds of git).

Test Plan:
Tested arc land with mercurial and git. Tested with and without the --branch
options.

Reviewers: epriestley, bos, sid0, dschleimer

Reviewed By: epriestley

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

13 years agoFix visibility of future linter methods
vrana [Tue, 19 Feb 2013 21:09:34 +0000 (13:09 -0800)]
Fix visibility of future linter methods

13 years agoRun PEP8 linter on background
vrana [Fri, 15 Feb 2013 00:16:08 +0000 (16:16 -0800)]
Run PEP8 linter on background

Test Plan:
  $ arc lint pep8.py --cache 0 --engine ComprehensiveLintEngine --trace

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoParse property change diffs generated with old SVN (prior to 1.5)
epriestley [Tue, 19 Feb 2013 15:32:57 +0000 (07:32 -0800)]
Parse property change diffs generated with old SVN (prior to 1.5)

Summary:
Fixes T2565. SVN from before June 2008 generates different looking property changes.

See http://subversion.tigris.org/issues/show_bug.cgi?id=3019 for the change.

Test Plan: Added a unit test derived from the report in T2565, made it pass.

Reviewers: chad, vrana

Reviewed By: chad

CC: aran
Maniphest Tasks: T2565

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

13 years agoFix another SVN issue with "@" files
epriestley [Mon, 18 Feb 2013 16:24:47 +0000 (08:24 -0800)]
Fix another SVN issue with "@" files

Summary: This chunk of code is kind of iffy and not really correct, but make it not fail, at least.

Test Plan:
  - Added a file named `swamp@2x.jpg` to a working copy.
  - Used `svn propedit svn:mime-type swamp@2x.jpg@` to incorrectly set its mime type to `text/plain`.
  - Ran `arc diff`.
  - Saw `arc diff` "correctly" change its mime-type to a binary mime type. This isn't really correct, but doing it successfully is better than throwing an exception.

Reviewers: mbishopim3, chad

Reviewed By: mbishopim3

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

13 years agoArc diff tries to upload files it knows about using a content hash rather than transf...
kwadwo [Sun, 17 Feb 2013 22:30:43 +0000 (14:30 -0800)]
Arc diff tries to upload files it knows about using a content hash rather than transfering data.

Summary:
Arc diff will hash file data and try to upload the file using upload by hash rather than transferring data. If it is unable, it defaults to its normal behavior

Attempts to upload file by hash, use regular upload method otherwise

Test Plan: Figure out how to arc diff to my local install and look at the behavior

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix "none" in SVN XML summary
epriestley [Fri, 15 Feb 2013 22:53:31 +0000 (14:53 -0800)]
Fix "none" in SVN XML summary

Summary: The `svn diff --xml --summarize` command reports a bunch of item statuses, which may include "none" if you make property changes to a directory (this is fairly rare).

Test Plan: Created property changes, saw "none" status.

Reviewers: chad, mbishopim3

Reviewed By: chad

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

13 years agoFix various SVN escaping issues in arc patch
epriestley [Fri, 15 Feb 2013 22:53:25 +0000 (14:53 -0800)]
Fix various SVN escaping issues in arc patch

Summary: Followup to D4703. When we give paths to `svn`, we need to escape them if they contain an `@`.

Test Plan:
Created a patch full of modifications to files with `@` in their names, and applied it:

  $ arc patch --diff 192
  A         A@2xcopy2
  A         A@2xcopy
  D         A@2x
   OKAY  Successfully applied patch to the working copy.

Reviewers: chad, mbishopim3

Reviewed By: chad

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

13 years agoDon't run disabled lint rules in other linters.
vrana [Thu, 14 Feb 2013 23:49:22 +0000 (15:49 -0800)]
Don't run disabled lint rules in other linters.

Summary: D4963 for other linters.

Test Plan: Saw time 0.001 instead of 0.113 in spellcheck linter.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoDon't run disabled lint rules
vrana [Thu, 14 Feb 2013 23:18:39 +0000 (15:18 -0800)]
Don't run disabled lint rules

Summary:
We always generate all messages and then filter them out based on minimum severity.
It's lots of useless work, especially in commit hook mode where we are interested only in errors.

Test Plan:
  $ arc lint --cache 0 --severity error ArcanistXHPASTLinter.php
  0.406 s before, 0.074 after

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix "arc:this" and "arc:amended" base rules after D4838
epriestley [Thu, 14 Feb 2013 21:57:34 +0000 (13:57 -0800)]
Fix "arc:this" and "arc:amended" base rules after D4838

Summary:
After D4383, we escape the base commit when constructing a command like this:

  hg log --rev (base::. - base)

However, if the base commit is a revset like ".^", we now escape it and Mercurial looks for a commit named ".^" (a valid mercurial branch name) instead.

Fix this by returning nodes for these rules instead of revsets. The "arc:this" rule is automatically used in some operations, like "arc amend", so users can hit this during normal workflows, not just with weird `--base` rules.

Test Plan: Ran "arc amend" in a Mercurial repository, didn't fatal out.

Reviewers: DurhamGoode, sid0

Reviewed By: DurhamGoode

CC: tido, aran
Differential Revision: https://secure.phabricator.com/D4949

13 years agoDecide whether to commit or amend with arc diff -a
Jakub Vrana [Thu, 14 Feb 2013 18:32:30 +0000 (10:32 -0800)]
Decide whether to commit or amend with arc diff -a

Test Plan:
  $ arc diff -a
  $ arc diff -a # saw amend instead of a new commit

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoRespect granularity in reading cached lint messages
vrana [Wed, 6 Feb 2013 23:27:31 +0000 (15:27 -0800)]
Respect granularity in reading cached lint messages

Summary:
We save repository version to lint cache but ignore it when reading the cache.
Fix it.

Test Plan: Made an error for linter with repo granularity, deleted the error from the cache. Relinted, didn't see the error. Changed another file and relinted, saw the error.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoFix hg 'arc land' when the mq extension is not enabled
durham [Thu, 14 Feb 2013 19:37:49 +0000 (11:37 -0800)]
Fix hg 'arc land' when the mq extension is not enabled

Summary:
Mercurial 'arc land' uses the 'hg strip' command to clean up after
itself, but this command isn't available unless the mq extension is enabled.
The fix is to enable it for that particular command only.

Test Plan: Ran 'arc land' with the mq extension disabled.  It worked.

Reviewers: epriestley, bos, sid0, dschleimer

Reviewed By: epriestley

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

13 years agoSupport `arc bookmark` in Mercurial
vrana [Thu, 31 Jan 2013 01:33:32 +0000 (17:33 -0800)]
Support `arc bookmark` in Mercurial

Summary:
Branch in Mercurial means something else.
Hopefully users wouldn't be too confused.

Test Plan:
  $ arc help
  $ arc help branch
  $ arc help feature
  $ arc feature
  $ arc bookmark
  $ arc branch
  # In hg repo:
  $ arc feature
  $ arc feature new
  $ arc feature new

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2332

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

13 years agoHandle safe HTML in intraline renderer
vrana [Wed, 13 Feb 2013 08:33:14 +0000 (00:33 -0800)]
Handle safe HTML in intraline renderer

Test Plan: Used it in Phabricator.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T2432

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

13 years agoAdd lint warning for $o->m()[0], not just f()[0]
epriestley [Tue, 12 Feb 2013 15:07:35 +0000 (07:07 -0800)]
Add lint warning for $o->m()[0], not just f()[0]

Summary: We only caught half of this.

Test Plan: Unit test.

Reviewers: edward

Reviewed By: edward

CC: aran
Maniphest Tasks: T1261

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

13 years agoMerge PHT into dynamic string linter
vrana [Tue, 12 Feb 2013 02:46:02 +0000 (18:46 -0800)]
Merge PHT into dynamic string linter

Test Plan: Existing unit test.

Reviewers: epriestley

Reviewed By: epriestley

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

13 years agoApply rtrim() to arc:upstream
epriestley [Mon, 11 Feb 2013 23:58:47 +0000 (15:58 -0800)]
Apply rtrim() to arc:upstream

Summary: Git spits these out with \n at the end.

Test Plan:
```
>>> orbital ~/devtools/arcanist $ git branch --set-upstream trim master
Branch trim set up to track local branch master.
>>> orbital ~/devtools/arcanist $ arc which --base arc:upstream
RELATIVE COMMIT
If you run 'arc diff', changes between the commit:

    acf7600e6e728395  Temporarily restore apache/license linters

...and the current working copy state will be sent to Differential, because
it is the merge-base of the upstream of the current branch and HEAD, and
matched the rule 'arc:upstream' in your args 'base' configuration.

You can see the exact changes that will be sent by running this command:

    $ git diff acf7600e6e728395..HEAD

These commits will be included in the diff:

    3580555e4b30598f  WIP

MATCHING REVISIONS
These Differential revisions match the changes in this working copy:

    (No revisions match.)

Since there are no revisions in Differential which match this working copy, a
new revision will be created if you run 'arc diff'.
```

Reviewers: brennantaylor

Reviewed By: brennantaylor

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

13 years agoTemporarily restore apache/license linters
epriestley [Mon, 11 Feb 2013 22:12:10 +0000 (14:12 -0800)]
Temporarily restore apache/license linters

Summary:
Restores linters only, without unit tests or entry in ComprehensiveLinter. Marks them deprecated.

If use at Facebook isn't widespread I'd prefer to simply delete them.

Test Plan: none

Reviewers: vrana

Reviewed By: vrana

CC: aran
Maniphest Tasks: T2274

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

13 years agoSupport short version of arc diff --add-all
vrana [Mon, 11 Feb 2013 18:51:17 +0000 (10:51 -0800)]
Support short version of arc diff --add-all

Summary: Like `git commit -a`.

Test Plan:
  $ arc diff -a

Reviewers: epriestley

Reviewed By: epriestley

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