This project is archived and is in readonly mode.

#3197 ✓stale
Vikrant Chaudhary

[PATCH] Passing a --name to script/plugin install and other improvements.

Reported by Vikrant Chaudhary | September 14th, 2009 @ 08:54 AM

Just enhanced some shortcomings of command script/plugin install --.
Most of the examples are of my own plug-in on which I have been testing the written code.

#1 - Name of the plugin is usually the last fragment of the URL (or second last if last is trunk) and there is no option to change that. Ex: -

script/plugin install

will install the plugin in vendor/plugins/hg/ directory.

Hacking like -, won't work either. Because, script will then try to fetch, hence making an infinite loop.

Added a "--name" option for the command, so

script/plugin install --name kopal

will install the plugin in vendor/plugins/kopal directory.

#2 - For a plugin URL with no post-fixed forward slash "/", if the server doesn't redirect to a URL with trailing "/" (ex: Google Code with Mercurial repository), a "Plugin not found" message is shown.

For example,

script/plugin install ;#without post-fixed forward slash "/"

will result in the first link hg/lib/, which when passes through File.join() with base_url, resulting, which raises a 404 error.
This is a Mercurial web-end specific error as usually all Subversion web-ends will redirect to a URL with trailing '/'.
For example - visiting will redirect to or will redirect to

Fixed. So now all URLs passed to RecursiveHTTPFetcher are post-fixed with '/' unless one exists. This doesn't create a new limit to RecursiveHTTPFetcher#new to only accept directory paths and not file paths, since it was already limited, as (before) RecursiveHTTPFetcher#fetch treated all initial URLs as directory.

#3 - If the Plugin URL contains GET parameters, A "Plugin not found error" is thrown or the script goes in infinite loop. Ex:

script/plugin install

will result in RecursiveHTTPFetcher#fetch_dir() asking for resulting in a 404 error.

For subversion repository, this instead results in a infinite loop. since most subversion web-ends will parse ?r=42/lib/ as revision#42 and will not send a 404. (Ex: will fetch revision#42).

Note - Following are some bugs/features I discovered. Didn't code, since I didn't find them much significant but worth mentioning here.

#5 - RecursiveHTTPFetcher only fetches sub-paths relative to current path, raises error for relative to domain paths and doesn't fetches absolute paths at all (talking only about files in the desired hierarchy).

If contains three links, /svn/myplugin/rel-domain/ and rel-current/,

script/plugin install

will fetch rel-current/, raise a 404 error while fetching rel-domain/(interprets it as and won't fetch absolute/ at all.

However, this is not of much significance, since almost all revision-control-system web-ends publish links in relative-to-current-path format.

#6 - While downloading a plugin from web, some directory path, which may not be in interest of end-user should be ignored by default. Ex: /test/*, /.gitignore, /.hgtags, /.hgignore etc. (Usually most of them are in the root directory of a plugin).

NOTE: While I tested my modifications intensively, I didn't write test for them, since can't find any existing test which I can edit.

Willing to implement/fix last two features/bugs if the community finds them significant and gives a go.

PS: This is my first ever contribution to an open-source software.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket