]> khamidou — GitHub mirrors - arcanist.git/log
arcanist.git
14 years agoAutocomplete branches to "arc land"
epriestley [Mon, 23 Apr 2012 21:09:29 +0000 (14:09 -0700)]
Autocomplete branches to "arc land"

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

Test Plan: Hit tab, landed this branch.

Reviewers: zeeg, btrahan, vrana, jungejason

Reviewed By: btrahan

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

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

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

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

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

Reviewers: epriestley

Reviewed By: epriestley

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

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

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

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

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1124

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

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

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

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

Reviewers: btrahan, vrana, jungejason

Reviewed By: btrahan

CC: aran, Makinde
Maniphest Tasks: T909

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

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

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

Reviewers: blair

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

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

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

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

Reviewers: btrahan, vrana, simpkins, beng

Reviewed By: btrahan

CC: aran, avive
Maniphest Tasks: T1117

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

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

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

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

Reviewers: svemir, btrahan, vrana, jungejason

Reviewed By: svemir

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

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

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

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

Reviewers: epriestley, jungejason

Reviewed By: epriestley

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

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

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

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

Reviewers: btrahan, vrana, jungejason

Reviewed By: jungejason

CC: aran
Maniphest Tasks: T1100

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

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

Summary: See discussion in D1861.

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

Reviewers: btrahan, vrana, davidreuss, elgenie

Reviewed By: davidreuss

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

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

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

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

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

Reviewers: epriestley

Reviewed By: epriestley

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

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

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

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

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

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

Reviewers: epriestley, jungejason

Reviewed By: epriestley

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

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

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

Also improve a message.

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

Reviewers: svemir, btrahan, vrana, jungejason

Reviewed By: svemir

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

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

Test Plan:
  diviner .

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoProvide a "loadFileDataCallback" for ArcanistBundle
epriestley [Tue, 10 Apr 2012 00:34:45 +0000 (17:34 -0700)]
Provide a "loadFileDataCallback" for ArcanistBundle

Summary: See next diff for an explanation of this issue.

Test Plan: See next diff.

Reviewers: Makinde, btrahan, vrana, jungejason

Reviewed By: Makinde

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

14 years agoUnify links to www.phabricator.com and phabricator.com
vrana [Mon, 9 Apr 2012 21:22:42 +0000 (14:22 -0700)]
Unify links to www.phabricator.com and phabricator.com

Test Plan: Visit http://www.phabricator.com/docs/phabricator/article/Arcanist_User_Guide:_Configuring_a_New_Project.html.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran
Maniphest Tasks: T1096

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

14 years agoMerge pull request #25 from Koolvin/arc_close
Evan Priestley [Mon, 9 Apr 2012 15:46:14 +0000 (08:46 -0700)]
Merge pull request #25 from Koolvin/arc_close

Add arc close command

14 years agoCall phutil_passthru() instead of passthru() in liberate
vrana [Sun, 8 Apr 2012 08:29:28 +0000 (01:29 -0700)]
Call phutil_passthru() instead of passthru() in liberate

Summary: Solves T1085 and is probably slightly better anyway.

Test Plan:
  arc liberate

Reviewers: epriestley

Reviewed By: epriestley

CC: aran
Maniphest Tasks: T1085

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

14 years agoAdd arc close command
Koolvin [Mon, 9 Apr 2012 03:55:10 +0000 (20:55 -0700)]
Add arc close command

Summary:
```arc close T1088 --status wontfix --message "I'm not going to fix this."```
T1088 is the test task to screw with, so feel free.

Test Plan: ```arc close T1088 --status [ resolved | wontfix | invalid | duplicate | spite | open ] -m "Message"```

Reviewers: epriestley

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

14 years agoRaise lint warning on missing space after comma
epriestley [Sun, 8 Apr 2012 23:09:11 +0000 (16:09 -0700)]
Raise lint warning on missing space after comma

Summary: Saw this in a diff somewhere; complain about it.

Test Plan: Unit coverage.

Reviewers: btrahan, vrana, jungejason

Reviewed By: btrahan

CC: aran
Maniphest Tasks: T1060

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

14 years agoMerge pull request #24 from Koolvin/arcpatch-D1943
Evan Priestley [Sun, 8 Apr 2012 00:48:32 +0000 (17:48 -0700)]
Merge pull request #24 from Koolvin/arcpatch-D1943

Add arc tasks command

14 years agoAdd arc tasks command
Koolvin [Sun, 8 Apr 2012 00:40:25 +0000 (17:40 -0700)]
Add arc tasks command

Summary:
Added `arc tasks`:

%%%arc tasks
arc tasks --view-all    // View Open and Closed Tasks
arc tasks --by-status   // Group By Status
arc tasks --by-priority // Group By Priority%%%

Test Plan: Connect to conduit and run arc tasks >> make sure you have tasks =p

Reviewers: epriestley, indiefan

Reviewed By: epriestley

CC: aran, epriestley
Maniphest Tasks: T749

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

14 years agoMake "--auto" the default for "arc diff"
epriestley [Sat, 7 Apr 2012 17:39:27 +0000 (10:39 -0700)]
Make "--auto" the default for "arc diff"

Summary:
NOTE: This is a disruptive change to how 'arc diff' behaves by default.

Many years ago, Differential (then DiffCamp) supported SVN. Someone added a "-i" mode to the "diffcamp" script so you could "git show | diffcamp -i", and thus we were
forever bound to storing metadata in commit messages.

But this isn't a common use case outside of Facebook + git-svn, and isn't very flexible. We now have a great deal of flexibility to identify revisions based on
hashes, branch names, etc, and to sync metdata from web to CLI and back. I want to jettison the commit-message-bound artifacts of the tool's history, and move to a
more flexible, modern workflow.

I added "--auto" a while ago, which figures out if you want to create or update a diff automatically, and then prompts you for whatever data it needs, reading
information if it can from commit messages in the range. This is a vastly better workflow in general, especially for SVN and Mercurial users (who currently need to
jump to the web UI to create revisions). It's better for git users too, since they don't need to use template commits and don't have to muck with or configure
templates. However, it's a nontrivial change to git users' core workflow that is clearly different in more ways than it is clearly better.

  - This might be contentious, but probably not toooo much, I hope?
  - I also deleted the (fairly ridiculous) workflow where we sync commit message changes from the working copy. I think two or three people will be REALLY upset about
this but I have no sympathy. "--edit" covers this and has been around for like two years now, and making the commit message and web dual-authoritative was always a bad
idea that we only ever half-accommodated anyway (see giant swaths of removed TOOD nonsense).

Test Plan:
  - I've been using "--auto" exclusively for like a month, it seems to work well.
  - Created/updated SVN, Git and HG diffs with "arc diff" under this workflow.

Reviewers: btrahan, jungejason, nh

Reviewed By: btrahan

CC: Makinde, vrana, zeeg, mbautin, aran, yairlivne, 20after4
Maniphest Tasks: T614

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

14 years agoFix an issue with "arc diff --update" in Git on immutable workflows
epriestley [Sat, 7 Apr 2012 17:36:16 +0000 (10:36 -0700)]
Fix an issue with "arc diff --update" in Git on immutable workflows

Summary:
This should be a raw text block, not a parsed message object.

I broke this in rARC1f13e022cdc9bf4859274a83784bd615caf62ef9 when I improved Mercurial support.

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

Test Plan: (Will update this diff...)

Reviewers: vrana, jungejason, btrahan

Reviewed By: btrahan

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

14 years agoBump required PHP version
vrana [Fri, 6 Apr 2012 19:55:05 +0000 (12:55 -0700)]
Bump required PHP version

Test Plan:
  arc lint

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoReturn $this from didApplyPatch() shortcut
vrana [Wed, 4 Apr 2012 19:46:42 +0000 (12:46 -0700)]
Return $this from didApplyPatch() shortcut

Test Plan: https://secure.phabricator.com/diffusion/ARC/browse/master/src/lint/patcher/ArcanistLintPatcher.php;bd7dc8abaa7bb4c0$75?view=blame

Reviewers: epriestley, jungejason

Reviewed By: jungejason

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

14 years agoAllow configuration of a weak per-project default relative commit
epriestley [Tue, 3 Apr 2012 23:06:43 +0000 (16:06 -0700)]
Allow configuration of a weak per-project default relative commit

Summary: Allows you to set a default in .arcconfig. This default is overriden by any .arc/ setting.

Test Plan: Ran "arc diff" with a .arcconfig setting but no .arc/ setting, got a diff against the specified relative commit.

Reviewers: nh, btrahan

Reviewed By: nh

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

14 years agoReturn $this from setters
vrana [Tue, 3 Apr 2012 01:35:19 +0000 (18:35 -0700)]
Return $this from setters

Summary:
Most setters returns `$this` but some don't.
I guess it's not by purpose.

Test Plan:
  arc lint

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoRevenge of the git relative commit default
epriestley [Mon, 2 Apr 2012 23:52:20 +0000 (16:52 -0700)]
Revenge of the git relative commit default

Summary:
The default of "arc diff" to "arc diff HEAD^" in git is universally confusing to everyone not at Facebook.

Drive the default with configuration instead. Even at Facebook, "origin/trunk" (or whatever) is probably a better default than "HEAD^".

See D863 for the last attempt at this.

NOTE: This is contentious!

Test Plan: Ran "arc diff", got prompted to set a default. Ran "arc diff" from a zero-commit repo, got sensible behavior

Reviewers: btrahan, vrana, nh, jungejason, tuomaspelkonen

Reviewed By: btrahan

CC: aran, epriestley, zeeg, davidreuss
Maniphest Tasks: T651

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

14 years agoMinor, correct arc handling of relative symlinking (from @makinde).
epriestley [Fri, 30 Mar 2012 21:56:19 +0000 (14:56 -0700)]
Minor, correct arc handling of relative symlinking (from @makinde).

14 years ago[arcanist] properly handle arguments with spaces
Nick Harper [Sat, 31 Mar 2012 03:28:02 +0000 (20:28 -0700)]
[arcanist] properly handle arguments with spaces

Summary:
The new wrapper shell script that is bin/arc does not correctly
handle arguments with spaces in them.

Test Plan:
added a print_r($argv) to scripts/arcanist.php and ran bin/arc -m
"testing something" to see that "testing something" got passed in as
one argument instead of two.

Reviewers: jungejason, epriestley

Reviewed By: epriestley

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

14 years agoWhitespace
vrana [Fri, 30 Mar 2012 21:52:14 +0000 (14:52 -0700)]
Whitespace

14 years agoAdd a lint check for clobbering locals with iterators
epriestley [Thu, 29 Mar 2012 20:21:18 +0000 (13:21 -0700)]
Add a lint check for clobbering locals with iterators

Summary:
See D2049, D2050. Identify reuses of locals as iterator variables. Before raising an error, we require:

  - Variable is declared before the loop.
  - Variable is used after the loop, ignoring uses as an iterator variable.

I think this identifies all problems with a very low false positive rate (the false positives are suspicious/unconventional code, but not necessarily errors).

Also fix an issue identified by the linter.

Test Plan:
  - Verified this identified the bugs in D2049 and D2050.
  - Ran linter against libphutil/, arcanist/ and phabricator/ (see D2051, this, and next diff).
  - Ran unit tests.

Reviewers: vrana, btrahan

Reviewed By: vrana

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

14 years agoMinor Arcanist fixes
epriestley [Thu, 29 Mar 2012 20:21:10 +0000 (13:21 -0700)]
Minor Arcanist fixes

Summary:
Addresses concerns in rARCefb8219196abf047f14b505959e54d078e1df6d3:

  - As I recall, the intent of "generateFile" was that these warnings would replace all the other warnings for that file, under the theory that if one warning caused regeneration of
the file the other warnings were irrelevant.
  - However, this code never had any effect and I haven't seen any issues with the behavior.
  - So, just remove it.

Addresses concerns in rARC070e963d1c26879e47eab19a2377e388c2f166c5:

  - Ran "arc liberate --all".

Test Plan: Ran "arc lint" after removing an "__init__.php" with and without a "fixed" generateFile block, there was no behavioral change. So I just nuked it.

Reviewers: vrana, btrahan

Reviewed By: vrana

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

14 years agoUse assert_instances_of()
vrana [Thu, 29 Mar 2012 04:36:37 +0000 (21:36 -0700)]
Use assert_instances_of()

Summary: D2042

Test Plan:
- `arc lint` with dependent message
- `arc liberate`
- `arc diff`

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoAvoid double indenting in console wrapping
vrana [Thu, 29 Mar 2012 04:38:31 +0000 (21:38 -0700)]
Avoid double indenting in console wrapping

Summary:
D2016 changed the behavior of `phutil_console_wrap()`.
The new behavior is better so I am fixing callsites instead of the function.

Test Plan:
  arc help help

Verify that the options descriptions is not indented with 28 spaces.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoMinor, squelch a warning about reference variables.
epriestley [Mon, 26 Mar 2012 17:03:59 +0000 (10:03 -0700)]
Minor, squelch a warning about reference variables.

Auditors: vrana

14 years agoShow a better expected vs actual for tests with large output
epriestley [Mon, 26 Mar 2012 16:43:47 +0000 (09:43 -0700)]
Show a better expected vs actual for tests with large output

Summary: When tests have a lot of output, show a diff of the expected/actual.

Test Plan: Used this when developing D2016 to examine large output usefully.

Reviewers: btrahan

Reviewed By: btrahan

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

14 years agoRaise a better error message when "arc patch" fails because of filename case changes
epriestley [Mon, 26 Mar 2012 16:43:37 +0000 (09:43 -0700)]
Raise a better error message when "arc patch" fails because of filename case changes

Summary: Git can't apply filename case change patches on case-insensitive filesystems. Some day we could manually do this ourselves, but it's fairly rare and complicated -- just raise a useful warning.

Test Plan: Tried to apply a case-changing patch, got a good error.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T618

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

14 years agoImprove compatibility of "arc patch" on Windows
epriestley [Sun, 25 Mar 2012 16:32:20 +0000 (09:32 -0700)]
Improve compatibility of "arc patch" on Windows

Summary: Can't use (cd ...) on windows.

Test Plan: Ran "arc patch" successfully.

Reviewers: Makinde, btrahan

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T124, T1034

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

14 years agoMinor, fix clowniness.
epriestley [Fri, 23 Mar 2012 15:56:38 +0000 (08:56 -0700)]
Minor, fix clowniness.

14 years agoMinor, fix inverted condition.
epriestley [Fri, 23 Mar 2012 15:53:47 +0000 (08:53 -0700)]
Minor, fix inverted condition.

14 years agoUpdate 'arc land': add --squash, add default config, fix windows compat
epriestley [Fri, 23 Mar 2012 15:45:28 +0000 (08:45 -0700)]
Update 'arc land': add --squash, add default config, fix windows compat

Summary:
  - We have "--merge", added similar "--squash" for completeness.
  - Switched away from (cd .. && ...) pattern which is not functional on Windows.
  - Allow a default --onto to be specified, if master isn't the best default for a project.

Test Plan:
  - Did --hold --keep dry runs, changes landed properly.
  - Set a default onto branch in .arcconfig.
  - Ran --merge and --squash together to verify conflict configuration.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley, gschmidt
Maniphest Tasks: T124, T1033

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

14 years agoUpdate 'arc land': add --squash, add default config, fix windows compat
epriestley [Fri, 23 Mar 2012 01:20:22 +0000 (18:20 -0700)]
Update 'arc land': add --squash, add default config, fix windows compat

Summary:
  - We have "--merge", added similar "--squash" for completeness.
  - Switched away from (cd .. && ...) pattern which is not functional on Windows.
  - Allow a default --onto to be specified, if master isn't the best default for a project.

Test Plan:
  - Did --hold --keep dry runs, changes landed properly.
  - Set a default onto branch in .arcconfig.
  - Ran --merge and --squash together to verify conflict configuration.

Reviewers: btrahan

CC: aran, epriestley
Maniphest Tasks: T124, T1033

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

14 years agoSet relative commit early in "arc diff"
epriestley [Fri, 23 Mar 2012 00:22:52 +0000 (17:22 -0700)]
Set relative commit early in "arc diff"

Summary:
In Mercurial, we figure out if the working copy is dirty with "hg diff", and do a somewhat expensive merge-base / outgoing operation if the relative commit isn't set. We can set the relative commit earlier and avoid some extra work.

We also may incorrectly cache this state (diff from merge-base of outgoing to tip) and pass the wrong rev and file dirty list to the linters.

Test Plan: Made commits which changed (A, B) and then (A). Ran "arc diff tip^". Before this change, observed full outgoing + merge base resolve and both "A" and "B" passed to lint. Observed execution of fewer commands and lint executing against "A" only after this change.

Reviewers: Makinde, btrahan

Reviewed By: Makinde

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

14 years agoFix a doc link in arcanist
epriestley [Thu, 22 Mar 2012 19:25:37 +0000 (12:25 -0700)]
Fix a doc link in arcanist

Summary:
Missed this when I moved the document a while ago. See <https://github.com/facebook/arcanist/issues/21>.

NOTE: The actual document isn't very helpful in figuring out the error. I'll address this in a followup.

Test Plan: Hit error, clicked link, got docs.

Reviewers: btrahan

Reviewed By: btrahan

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

14 years agoResolve arc location through symlinks-of-symlinks, etc
epriestley [Thu, 22 Mar 2012 01:04:35 +0000 (18:04 -0700)]
Resolve arc location through symlinks-of-symlinks, etc

Summary:
Stole this from stackoverflow; seems to work?

http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in

Test Plan: Ran a symlink to bin/arc.

Reviewers: btrahan, zeeg

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T124

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

14 years agoInstead of looping forever, resolve the relative commit
epriestley [Wed, 21 Mar 2012 18:07:15 +0000 (11:07 -0700)]
Instead of looping forever, resolve the relative commit

Summary: Obvious error in refactoring code around getCanonicalRevisionName() in D1954.

Test Plan: Ran "arc diff" without looping. Can you verify this fixes your case?

Reviewers: Makinde, btrahan

Reviewed By: Makinde

CC: aran, epriestley
Maniphest Tasks: T1025

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

14 years agoReplace "bin/arc" with a shell script
epriestley [Tue, 20 Mar 2012 02:23:41 +0000 (19:23 -0700)]
Replace "bin/arc" with a shell script

Summary: Currently, we use a symlink. Under git bash, it tries to run the symlink. This is not a recipe for success. Instead, use a trivial wrapper script.

Test Plan: Ran "arc" from git bash.

Reviewers: Makinde, btrahan, Koolvin

Reviewed By: Koolvin

CC: aran, epriestley
Maniphest Tasks: T124

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

14 years agoWhen a mercurial working copy has uncommitted changes, prompt to include them in...
epriestley [Tue, 20 Mar 2012 02:17:10 +0000 (19:17 -0700)]
When a mercurial working copy has uncommitted changes, prompt to include them in "arc diff"

Summary:
See task. Allow mercurial users to diff with uncommitted changes.

  - By default, commit range is merge-base of `hg outgoing` to `.` (dirstate).
  - You can get JUST dirstate with `arc diff tip` or similar.
  - This ended up being a giant mess various other changes to deal with empty `hg outgoing` and empty dirstate.

Test Plan: Diffed with uncommitted changes, got sensible prompts and results.

Reviewers: Makinde, btrahan

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T998

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

14 years agoUse libphutil __init_script__.php to initialize Arcanist
epriestley [Tue, 20 Mar 2012 02:17:03 +0000 (19:17 -0700)]
Use libphutil __init_script__.php to initialize Arcanist

Summary:
See D1950, same patch for arc/.

NOTE: I'm moving the ob_get_level() stuff to libphuil.

Test Plan: Ran "arc".

Reviewers: btrahan, killermonk

Reviewed By: btrahan

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

14 years agoMinor, address @btrahan feedback.
epriestley [Tue, 20 Mar 2012 02:16:50 +0000 (19:16 -0700)]
Minor, address @btrahan feedback.

14 years agoThrow a helpful message when users run "arc diff --raw --update".
epriestley [Tue, 20 Mar 2012 02:15:58 +0000 (19:15 -0700)]
Throw a helpful message when users run "arc diff --raw --update".

Summary: We crash and burn right now, trying to launch an interactive editor against a non-tty stdin. Raise a helpful error message instead.

Test Plan: Will run "arc diff --raw --update".

Reviewers: btrahan, yairlivne

Reviewed By: btrahan

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

14 years agoIn "arc patch", use "cat-file -t" instead of "rev-parse --verify" to check for commits.
epriestley [Tue, 20 Mar 2012 02:11:52 +0000 (19:11 -0700)]
In "arc patch", use "cat-file -t" instead of "rev-parse --verify" to check for commits.

Summary:
  - `git rev-parse --verify` "verifies" very valid-looking commit name, not just valid commit names.
  - Currently, if we can't find the base rev we'll incorrectly "verify" it and then fail on "git checkout -b <branch> <some bogus commit>".
  - Instead, use `git cat-file -t`.
  - See similar fix in D1590.

Example:

  $ git rev-parse --verify aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Test Plan: Ran "arc patch" in a mismatched local, hit "Y" to branch, got a branch off HEAD instead of an error.

Reviewers: btrahan

Reviewed By: btrahan

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

14 years agoAdd an arc.bat file for Arcanist
epriestley [Mon, 19 Mar 2012 02:42:53 +0000 (19:42 -0700)]
Add an arc.bat file for Arcanist

Summary: Allow Windows users to type "arc" with appropriate env config.

Test Plan: Typed "arc", got arc.

Reviewers: Makinde, btrahan, Koolvin, jungejason

Reviewed By: jungejason

CC: aran, epriestley
Maniphest Tasks: T124

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

14 years agoDon't fatal without Conduit for "--patch" and "--bundle"
epriestley [Fri, 16 Mar 2012 20:40:33 +0000 (13:40 -0700)]
Don't fatal without Conduit for "--patch" and "--bundle"

Summary:
In some workflows, we don't have Conduit at all, so we'll fail with a raw exception. Test for conduit presence before trying to make the encoding call.

Also move some "instanceof" logic for updates into RepositoryAPI (factoring, windows compat).

Test Plan: Ran "arc patch --patch some.patch".

Reviewers: 20after4, davidreuss, nh, btrahan

Reviewed By: 20after4

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

14 years agoFix an issue with unified patch generation for terminal newline changes
epriestley [Fri, 16 Mar 2012 20:40:11 +0000 (13:40 -0700)]
Fix an issue with unified patch generation for terminal newline changes

Summary:
We currently detect the "\" as a change, and may generate a hunk like this, without changes.

  @@ -97,4 +98,4 @@
   mmm
   mmm
   mmm
  \ No newline at end of file

While "git apply" is OK with this, "patch" is not. Instead, don't detect this as a change (it is always accompanied by - / + if it's a real change).

Test Plan: Successfully applied a previously-failing SVN patch to a file without a terminal newline that had nonlocal changes.

Reviewers: 20after4, nh, btrahan

Reviewed By: 20after4

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

14 years agoRemove debugging print from a test case
Nick Harper [Thu, 15 Mar 2012 02:49:16 +0000 (19:49 -0700)]
Remove debugging print from a test case

Test Plan: reran the test

Reviewers: epriestley, jungejason

Reviewed By: epriestley

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

14 years agoRespect custom set encoding in patch/export workflows
David Reuss [Wed, 14 Mar 2012 14:08:06 +0000 (07:08 -0700)]
Respect custom set encoding in patch/export workflows

Summary:
In cases where a codebase is not UTF-8, we will attempt an conversion,
if an alternative encoding is given/configured.

This is now possible in two ways:

  - by configuring one under repository tracking in diffusion
  - by passing an --encoding option to the workflow

If the first is not available we will make a conduit call
to do an extra check and see if an encoding is configured directly with
phabricator.

Test Plan:
Tried various diffs with known encodings (mostly ISO-8859-1), and passed
it in, via stdin, or downloaded a known problematic revision from
phabricator, and they applied where they otherwise failed.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Maniphest Tasks: T452

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

14 years agoStrip colorized diffs, show line numbers in context
epriestley [Wed, 14 Mar 2012 13:34:00 +0000 (06:34 -0700)]
Strip colorized diffs, show line numbers in context

Summary:
  - When users pipe in colorized diffs, strip the colors instead of failing.
  - When showing context, show line numbers (we do show 3 lines around the failure, the failure was just on the first line).
  - Remove an irrelevant TODO comment (we handle this elsewhere now).

Test Plan: Unit tests.

Reviewers: Makinde, btrahan

Reviewed By: Makinde

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

14 years ago[svn1.7] handle removed directories in svn in arc diff
Nick Harper [Wed, 14 Mar 2012 06:42:05 +0000 (23:42 -0700)]
[svn1.7] handle removed directories in svn in arc diff

Summary:
`svn rm $directory` removes the directory and its contents in svn 1.7, whereas
svn 1.6 only removes the directory's contents, so arc diff needs to not try
to read the directory.

Test Plan:
ran arc diff in a svn working copy that had a directory removed (with both
svn 1.6 and svn 1.7) and confirmed that the command did not throw an exception,
and that the removed directory was marked as directory (not a file).

Reviewers: epriestley, jungejason

Reviewed By: epriestley

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

14 years ago[svn1.7] Handle changes to svn properties in svn1.7 working copies
Nick Harper [Tue, 13 Mar 2012 23:05:57 +0000 (16:05 -0700)]
[svn1.7] Handle changes to svn properties in svn1.7 working copies

Summary: svn changed the format of property changes for svn1.7.

Test Plan: arc diff on a working copy with svn property changes

Reviewers: epriestley, jungejason

Reviewed By: epriestley

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

14 years agoAdd a check to 'arc liberate' for loose .php files in the library root
epriestley [Tue, 13 Mar 2012 18:17:28 +0000 (11:17 -0700)]
Add a check to 'arc liberate' for loose .php files in the library root

Summary: @koolvin ran into this and was justifiably confused.

Test Plan: Put some random .php file in src/, ran arc liberate src/, got warned.

Reviewers: btrahan, Koolvin

Reviewed By: btrahan

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

14 years ago[svn1.7] treat nonpositive rev numbers as added files
Nick Harper [Mon, 12 Mar 2012 23:18:44 +0000 (16:18 -0700)]
[svn1.7] treat nonpositive rev numbers as added files

Summary:
svn 1.7 reports a rev number of -1 for added files; previous versions
reported a rev number of 0. Interpret nonpositive rev numbers to mean
the file was added.

Test Plan: ran arc diff on an svn1.7 working copy with added files

Reviewers: epriestley, jungejason

Reviewed By: epriestley

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

14 years agoAdd a test case to make sure prefix/suffix intraline diffs work correctly
epriestley [Tue, 13 Mar 2012 01:21:44 +0000 (18:21 -0700)]
Add a test case to make sure prefix/suffix intraline diffs work correctly

Summary: Wanted to double-check that this works properly; it does, but might as well keep the test case.

Test Plan: Ran tests.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T970

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

14 years agoDon't show "not executable" for files with no coverage information
epriestley [Tue, 13 Mar 2012 00:04:51 +0000 (17:04 -0700)]
Don't show "not executable" for files with no coverage information

Summary: We incorrectly merge array() into empty string, which is later interpreted as "this file is entirely not-executable". Instead, show no coverage information in the UI.

Test Plan: Looked at a README diff with no coverage information, got no UI render.

Reviewers: tuomaspelkonen, btrahan, zeeg

Reviewed By: tuomaspelkonen

CC: aran, epriestley
Maniphest Tasks: T965

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

14 years agoImprove "arc cover" parameters
epriestley [Tue, 13 Mar 2012 00:04:20 +0000 (17:04 -0700)]
Improve "arc cover" parameters

Summary: Give "arc cover" --rev and paths parameters like "arc lint" and "arc unit".

Test Plan: Ran 'arc cover' with various rev/path things. Ran in SVN to verify it works/fails correctly.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T707

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

14 years agoArcanistRepositoryAPI: add getCanonicalRevisionName
Edward Speyer [Fri, 9 Mar 2012 22:40:47 +0000 (14:40 -0800)]
ArcanistRepositoryAPI: add getCanonicalRevisionName

Summary:
Resolves crazy stuff like 'HEAD' or '{2001-01-01T01:01:01}' into an
actual revision, with a provided implementation for git.

Test Plan: Tested in a hacky script.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoDon't record anonymous functions into the symbol map
epriestley [Fri, 9 Mar 2012 23:45:47 +0000 (15:45 -0800)]
Don't record anonymous functions into the symbol map

Summary:
Although we currently forbid anonymous functions, some day we will likely permit them, and our behavior for them is wrong.

Handle them correctly rather than throwing an exception because we should be covered by D1846 against accidental use, and we won't be on PHP 5.2 forever.

Test Plan: Ran against a test file with anonymous functions. Before, it emitted a declaration of a nameless function; afterward, it did not.

Reviewers: btrahan, edward

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T963

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

14 years agoImprove arc support for svn 1.7
Nick Harper [Fri, 9 Mar 2012 21:37:48 +0000 (13:37 -0800)]
Improve arc support for svn 1.7

Summary:
svn 1.7 no longer has a .svn directory in every subdirectory of the working
copy, only one in the root of the working copy (like git, except you can still
check out subtrees). Thus, we can't check whether we're in an svn repo by
looking for a .svn directory alongside the .arcconfig file.

Test Plan: ran arc diff in an svn 1.7 working copy where it previously wasn't working

Reviewers: epriestley, btrahan, jungejason

Reviewed By: epriestley

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

14 years agoRaise a lint error when code uses a PHP 5.3 feature in Phabricator
epriestley [Fri, 9 Mar 2012 21:51:02 +0000 (13:51 -0800)]
Raise a lint error when code uses a PHP 5.3 feature in Phabricator

Summary:
  - Add a lint check for PHP 5.3 features (namespaces, anonymous functions).
  - Add unit tests.
  - Disable it by default.
  - Enable it for us.

Test Plan: Ran unit tests.

Reviewers: btrahan, edward

Reviewed By: edward

CC: aran, epriestley
Maniphest Tasks: T962

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

14 years agoMake lint output look like a compiler
Edward Speyer [Wed, 29 Jun 2011 01:14:07 +0000 (18:14 -0700)]
Make lint output look like a compiler

Summary:
Make lint output look like gcc errors / grep output; a format used by
editors to jump from a compiler error to a file+line of code which
triggered the error.

Test Plan:
In vim, I ran:

  :set makeprg=~/checkouts/devtools/arcanist/bin/arc\ lint\ --output\ compiler

Then:

  :make

And was able to jump directly to problematic lines of code.

Reviewers: jungejason

Reviewed By: jungejason

CC: aran, edwardspeyer, jungejason, codeblock, tuomaspelkonen, epriestley
Differential Revision: https://secure.phabricator.com/D550

14 years ago[arcanist] respect severity disabled in PEP8 linter
Nick Harper [Fri, 9 Mar 2012 05:22:36 +0000 (21:22 -0800)]
[arcanist] respect severity disabled in PEP8 linter

Summary:
This allows for disabling certain PEP8 linter errors by calling
setCustomSeverityMap on an ArcanistPEP8Linter. However, any custom severities
besides disabled will be ignored.

Test Plan: arc lint

Reviewers: epriestley, andrewjcg

Reviewed By: epriestley

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

14 years agoRemove chooseRevision() and DifferentialRevisionRef
epriestley [Fri, 9 Mar 2012 16:57:24 +0000 (08:57 -0800)]
Remove chooseRevision() and DifferentialRevisionRef

Summary: `arc which` and related workflows have supplanted these now-unused mechanisms.

Test Plan: Grepped for chooseRevision() and DifferentialRevisionRef.

Reviewers: btrahan

Reviewed By: btrahan

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

14 years agoFix another "arc patch" authentication issue
epriestley [Fri, 9 Mar 2012 16:57:18 +0000 (08:57 -0800)]
Fix another "arc patch" authentication issue

Summary: Similar to rARC298ed9cda55d90b755e4dc45d202213e91631888, work around "differential.anonymous-access" issues until we get proper permissions up.

Test Plan: Ran "arc patch" against a "differential.anonymous-acccess" install with a revision argument

Reviewers: btrahan, mbautin

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T848

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

14 years agoFix implicit fallthrough in arc
epriestley [Fri, 9 Mar 2012 16:57:03 +0000 (08:57 -0800)]
Fix implicit fallthrough in arc

Summary: Raised by new linter.

Test Plan: Lint/inspection.

Reviewers: btrahan

Reviewed By: btrahan

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

14 years ago[ArcanistPhutilTestCase] add ->assertException() to the base test case
Edward Speyer [Thu, 8 Mar 2012 22:54:49 +0000 (14:54 -0800)]
[ArcanistPhutilTestCase] add ->assertException() to the base test case

Summary: Simpler assert function for asserting a type of exception was raised.

Test Plan: Wrote this for (and tested it with) D1836.

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoImprove performance of XHPASTLinter
epriestley [Thu, 8 Mar 2012 20:20:46 +0000 (12:20 -0800)]
Improve performance of XHPASTLinter

Summary:
  - XHPASTLinter + coverage is ass-slow.
  - Use caching/perf options introduced by D1828.

Test Plan:
  - Ran profiling for unit tests with new --xprofile command line flag.
  - Old profile: https://secure.phabricator.com/xhprof/profile/PHID-FILE-uiuwsqa5wulj7eyfkjy2/
  - New profile: https://secure.phabricator.com/xhprof/profile/PHID-FILE-nl635t3jcp2sfo2spzwu/
  - Overall runtime decreased from 18.2s to 3.7s (4.9x performance increase) with coverage enabled.

Reviewers: btrahan

Reviewed By: btrahan

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

14 years agoUse PhutilArgumentParser for some argument parsing in Arcanist
epriestley [Thu, 8 Mar 2012 20:20:26 +0000 (12:20 -0800)]
Use PhutilArgumentParser for some argument parsing in Arcanist

Summary:
Instead of doing custom parsing for --trace and --no-ansi, use builtin parsing.

This also gives us access to xprofile.

I eventually want to fully switch over, but that'll take some work.

Test Plan: Ran `arc list --trace`, `arc list --no-ansi`, etc.

Reviewers: btrahan

Reviewed By: btrahan

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

14 years agoAdd a lint warning for implicit fallthrough in switch statements
epriestley [Thu, 8 Mar 2012 20:20:19 +0000 (12:20 -0800)]
Add a lint warning for implicit fallthrough in switch statements

Summary: If a case does not end with break, continue, throw, exit or return and does not have a "fallthrough" comment, raise a warning.

Test Plan: Ran test case; ran linter against all of Phabricator (no hits).

Reviewers: btrahan

Reviewed By: btrahan

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

14 years agoWhen a file doesn't begin "<?php", raise one warning, not one for each line
epriestley [Thu, 8 Mar 2012 01:52:46 +0000 (17:52 -0800)]
When a file doesn't begin "<?php", raise one warning, not one for each line

Summary: Linter flipped out on D1817; reign it in.

Test Plan: Ran "arc lint" on D1817, got one message.

Reviewers: btrahan

Reviewed By: btrahan

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

14 years agoFix arc diff / arc patch to handle files with missing trailing newlines properly
epriestley [Wed, 7 Mar 2012 21:19:58 +0000 (13:19 -0800)]
Fix arc diff / arc patch to handle files with missing trailing newlines properly

Summary:
  - When you try to "arc patch" a change which adds or removes a trailing newline or alters a file with a trailing newline near the newline, the patch fails because we fail to reconstuct the "\ No newline at end of file" line.
  - We don't currently record enough information about these diffs to reconstruct them with a sensible amount of effort. Store the "\ No newline at end of file" line instead of just a flag.
  - There are some special rules for these lines; implement them.

NOTE: This causes some display glitching in Differential, but nothing major; I'll fix that in a followup patch.

Test Plan:
  - Created a diff which added a trailing newline, removed a trailing newline, and altered a file without a trailing newline near the end of the file.
  - Verified that the git version of this patch and the 'arc export --git' version of this patch are (essentially) identical.
  - Verified that "arc diff" + "arc patch" can apply these changes.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T533

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

14 years agoArc patch - upgrade "same base rev" check to "does this commit exist in the working...
Bob Trahan [Wed, 7 Mar 2012 21:02:53 +0000 (13:02 -0800)]
Arc patch - upgrade "same base rev" check to "does this commit exist in the working copy?" check

Summary: good title

Test Plan: ran "arc patch DX" a bunch

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley
Maniphest Tasks: T892

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

14 years agoCatch "ConduitClientException", not "Exception", in "arc patch"
epriestley [Wed, 7 Mar 2012 04:14:34 +0000 (20:14 -0800)]
Catch "ConduitClientException", not "Exception", in "arc patch"

Summary: This may raise other types of exceptions, e.g. http/network exceptions, where getErrorCode() is not defined.

Test Plan: Reasoned about beahvior.

Reviewers: btrahan

Reviewed By: btrahan

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

14 years agoImprove ArcanistMercurialParser's handling of unusual branch names
epriestley [Wed, 7 Mar 2012 04:14:25 +0000 (20:14 -0800)]
Improve ArcanistMercurialParser's handling of unusual branch names

Summary:
See <https://github.com/facebook/phabricator/issues/97>. Mercurial branch names may contain any characters, but we currently reject branch names with spaces.

NOTE: Mercurial allows you to name branches things like `     ` (five spaces). We do not parse this correctly. Die in a well fire.

Test Plan:
  - Added some horrible-but-possible test cases for crazy branch names.
  - Unit tests now pass.

Reviewers: btrahan, Makinde, killermonk

Reviewed By: btrahan

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

14 years agoFix escaping of "git log ---format" command on Windows
epriestley [Mon, 5 Mar 2012 21:22:41 +0000 (13:22 -0800)]
Fix escaping of "git log ---format" command on Windows

Summary:
On Windows, the PHP function escapeshellarg() replaces '%' with ' ' (space). This is apparently because there is no safe way to escape % inside of strings.

cmd.exe does use "^" as an escape character, so I think replacing "xyz" with "^x^y^z" might work for arbitrary strings (maybe?), or at least some subset of strings, but I don't know cmd.exe well enough to make that call without being concerned I'm introducing a security issue.

Although this patch is dumb, it's certinaly safe, and can only do something wrong if the user has environmental variables like H, P, T, or x01, in which case they're sort of asking for it.

cmd.exe also truncates output on \0, so use \1 as a delimiter instead.

Seriously it's like this thing was written in 1982 and never ever changed.

Test Plan: Created D1783 successfully after applying this patch.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T124

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

14 years agoMake git repo discovery work on Windows
epriestley [Mon, 5 Mar 2012 21:22:04 +0000 (13:22 -0800)]
Make git repo discovery work on Windows

Summary: This use of "(cd ..)" is outside of the RepositoryAPI proper (it's when we're trying to figure out which VCS a directory uses) and explodes on Windows.

Test Plan: @koolvin applied this patch manually and got farther than before.

Reviewers: btrahan, Koolvin, jungejason

Reviewed By: jungejason

CC: aran, epriestley
Maniphest Tasks: T124

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

14 years agoSimplify `arc help`, add `arc help --full`
vrana [Sun, 4 Mar 2012 11:16:45 +0000 (03:16 -0800)]
Simplify `arc help`, add `arc help --full`

Summary:
`arc help` currently prints more than 500 lines and it is hardly usable without ##> arc.help##, ##| less##, ##| grep##, ##| wc -l## or such.
It is even worse with custom commands and options.

This diff changes `arc help` to only list commands with no description (under 100 lines).
It also adds `arc help --full` which maintains the original behavior.
It doesn't change `arc help <command>`.

NOTE: BC break on different levels.

Test Plan:
  arc help
  arc help --full
  arc help help
  arc help lint

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoMake "arc diff --raw -C HEAD" work correctly
epriestley [Mon, 5 Mar 2012 18:08:50 +0000 (10:08 -0800)]
Make "arc diff --raw -C HEAD" work correctly

Summary:
There's no reason this can't work now, we're just not quite careful enough about definitions.

NOTE: If you use a message which has a revision ID in it already, this will fail in an obtuse way when launching the update editor fails because stdin isn't a tty. I'll clean this all up after T614 is fully sorted.

Test Plan: Ran "arc diff --raw -C HEAD".

Reviewers: btrahan, yairlivne

Reviewed By: btrahan

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

14 years agoRaise a better error from PhutilUnitTestEngine when trying to use one copy of libphut...
epriestley [Mon, 5 Mar 2012 18:03:13 +0000 (10:03 -0800)]
Raise a better error from PhutilUnitTestEngine when trying to use one copy of libphutil to test another copy

Summary:
We currently raise a very confusing error when we hit this case:

  Exception: The phutil library '' has not been loaded!

Because of the trickiness of init-order stuff, it's difficult to detect this more explicitly earlier -- instead, just raise a more descriptive error.

Test Plan: Ran "arc unit" in a copy of libphutil other than the one arc loads.

Reviewers: btrahan, jungejason

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T580

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

14 years agoImprove arc compatibility on Windows
epriestley [Mon, 5 Mar 2012 18:02:37 +0000 (10:02 -0800)]
Improve arc compatibility on Windows

Summary:
  - When altering the include_path(), use PATH_SEPARATOR (";" on Windows, ":" elsewhere) instead of hard-coded ":".
  - Detect missing php_curl.dll extension.
  - Use APPDATA instead of HOME for storing .arcrc (the internet implies this is correct?)
  - Don't try to do chmod() stuff on Windows; it's not critical and I don't want to figure out how it works.

Test Plan: Was able to run part of some arc commands on Windows.

Reviewers: btrahan, Makinde, Koolvin

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T124

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

14 years agoWarn about wrong ID in `arc download D8O88`
vrana [Sun, 4 Mar 2012 07:55:50 +0000 (23:55 -0800)]
Warn about wrong ID in `arc download D8O88`

Summary: It also disables `arc download F7312-rainbow`.

Test Plan:
  arc download D8O88
  arc download F7312-rainbow
  arc download F7312

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoEnable shell completion without set aliases
vrana [Sun, 4 Mar 2012 07:26:16 +0000 (23:26 -0800)]
Enable shell completion without set aliases

Summary:
Otherwise it says after hitting Tab everytime:

> Warning:  Invalid argument supplied for foreach() in arcanist/src/workflow/shell-complete/ArcanistShellCompleteWorkflow.php on line 99

Test Plan: arc h<Tab>

Reviewers: epriestley

Reviewed By: epriestley

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

14 years agoUse execxLocal() for ArcanistGitAPI
epriestley [Sat, 3 Mar 2012 00:47:34 +0000 (16:47 -0800)]
Use execxLocal() for ArcanistGitAPI

Summary:
  - This is simpler and reuses more code than doing "(cd %s && ...)" every time.
  - If we have an issue like HGPLAIN, we have one place to fix it now.
  - On Windows, the construct "(cd %s && ...)" does not mean what we'd like it to.

Test Plan: Ran "arc diff" in a git repo with this change.

Reviewers: btrahan, Makinde

Reviewed By: Makinde

CC: aran, epriestley
Maniphest Tasks: T124

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

14 years agoAdd "--revision <id>" flag to "arc land"
epriestley [Sat, 3 Mar 2012 00:47:05 +0000 (16:47 -0800)]
Add "--revision <id>" flag to "arc land"

Summary: Allow the user to pick a revision explicitly if they think they know what they're doing. Similar to "arc amend --revision", etc.

Test Plan: Obviously compells a meta-test.

Reviewers: btrahan, fratrik

Reviewed By: fratrik

CC: aran, epriestley
Maniphest Tasks: T928

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

14 years agoAllow disabling the part where you write an excuse
Andrey Sukhachev [Thu, 1 Mar 2012 00:30:17 +0000 (16:30 -0800)]
Allow disabling the part where you write an excuse

Summary:
Not everyone thinks it's a great feature

Task ID: #

Blame Rev:

Test Plan:
arc diff --skip-excuses

Revert Plan:

Tags:

Reviewers: akramer, epriestley, ide, mroch

Reviewed By: epriestley

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

14 years agoFix "arc lint" when HEAD has been reverted in the working copy
epriestley [Wed, 29 Feb 2012 20:18:46 +0000 (12:18 -0800)]
Fix "arc lint" when HEAD has been reverted in the working copy

Summary:
If a user reverts HEAD in the index or working copy, "git diff" shows no changes
and we explode.

Instead, we should simply return no changes; the rest of the lint pipeline
accommodates this correctly.

Test Plan: Reverted HEAD in a working copy, ran "arc lint", got an error.
Applied patch, ran "arc lint", got accurate lint.

Reviewers: Koolvin, btrahan

Reviewed By: Koolvin

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

14 years agoUse string operations, not idx(), for string indexing.
epriestley [Wed, 29 Feb 2012 16:39:25 +0000 (08:39 -0800)]
Use string operations, not idx(), for string indexing.

Summary: Missed this in review (D1715), idx() does not operate on strings (maybe
it does in HPHP/i?).

Test Plan: Faked an editable lint warning, ran "arc lint".

Reviewers: Koolvin, andrewjcg, btrahan

Reviewed By: Koolvin

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

14 years agoPre-fill template fields under "arc diff --create" in git
epriestley [Wed, 29 Feb 2012 01:00:35 +0000 (17:00 -0800)]
Pre-fill template fields under "arc diff --create" in git

Summary:
When the user runs "arc diff --create" or triggers it via "arc diff
--auto", prefill the template as best we can.

Test Plan:
Ran "arc diff --auto" with a template commit message in the working
copy under various configurations, results seemed reasonable.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley, dmi
Maniphest Tasks: T614

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

14 years agoPrefill template update message in Mercurial during --update
epriestley [Wed, 29 Feb 2012 00:59:40 +0000 (16:59 -0800)]
Prefill template update message in Mercurial during --update

Summary:
When a user invokes the update flow from Mercurial, prefill the update message
like we do for Git.

Also add a little caching to improve performance since "hg" execs cost ~100ms.

Test Plan: Updated a Mercurial diff repeatedly, got sensible default message
fills.

Reviewers: Makinde, btrahan

Reviewed By: Makinde

CC: aran, epriestley
Maniphest Tasks: T28

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