This project is archived and is in readonly mode.

#1284 ✓wontfix
Bounga

Add Hg (Mercurial) support to script/plugin

Reported by Bounga | October 28th, 2008 @ 01:50 PM | in 2.x

script/plugin was lacking of mercurial support, lot of people really like this SCM and are forced to switch to Git (or svn) to publish their plugins and allow users to install it easily.

This patch add the ability to do :

script/plugin install http://www.host.com/hg_repo

It uses the same implementation as Git but performs a better check to ensure "hg" is installed and that the repo is a real Hg repo.

Comments and changes to this ticket

  • Daniel Schierbeck

    Daniel Schierbeck October 29th, 2008 @ 10:32 PM

    I'm getting the following error with Rails 2.1.0:

    >> script/plugin install http://www.host.com/hg_repo
    /home/daniel/test/config/boot.rb:86:in `load_rubygems': undefined method `>=' for nil:NilClass (NoMethodError)
        from /home/daniel/test/config/boot.rb:52:in `load_initializer'
        from /home/daniel/test/config/boot.rb:38:in `run'
        from /home/daniel/test/config/boot.rb:11:in `boot!'
        from /home/daniel/test/config/boot.rb:109:in `<top (required)>'
        from script/plugin:2:in `require'
        from script/plugin:2:in `<main>'
    
    

    You may want to replace if system("hg version") with if system("hg version") rescue false.

  • Daniel Schierbeck

    Daniel Schierbeck October 29th, 2008 @ 10:34 PM

    With the message above I meant that there should be a better error message, both when an invalid repo is specified, and also when Hg isn't installed.

  • Daniel Schierbeck

    Daniel Schierbeck October 30th, 2008 @ 12:05 AM

    I'm terribly sorry, that error message was caused by me accidentally running your patched code with Ruby 1.9! Just ignore what I wrote.

  • Bounga

    Bounga October 30th, 2008 @ 07:49 AM

    no problem. Did you test it with 1.8?

  • Bounga

    Bounga November 20th, 2008 @ 10:50 AM

    Nobody interested in Mercurial support?

  • Alex MacCaw
  • Bounga

    Bounga November 20th, 2008 @ 11:21 AM

    You don't know what are the good things in life :(

  • Daniel Schierbeck

    Daniel Schierbeck November 20th, 2008 @ 04:28 PM

    Bounga: I think we should wait until there's a bigger group of people using Hg with Rails. Even if this patch was to be accepted, the implementation would need to be updated and tested as Rails evolves, and without Hg-using Rails contributors, that probably won't happen.

    It's sad, but it's true. The same thing happened to #1291, my attempt at getting script/plugin support for Bazaar.

    I'd like to be proven wrong -- if there indeed is a big need for better support of non-Git SCM's, we could refactor the source to make it easier to accommodate a wider variety of tools.

  • Bounga

    Bounga November 20th, 2008 @ 04:34 PM

    The thing is that only supporting svn and git tends to "force" users and new plugin developers to adopt Git even if they don't like it. That's what makes me sad.

    At least, I've tried. Nevermind.

  • DHH

    DHH November 20th, 2008 @ 08:26 PM

    Perhaps we could add an API to the script/plugin that plugins could use to add these things? Then you could just install the hg-plugins plugin to be able to install plugins from hg ;).

  • Daniel Schierbeck

    Daniel Schierbeck November 20th, 2008 @ 10:17 PM

    David: if people would be willing to review a patch, i guess i could create a simple API for installing plugins.

    By the way, would it be preferable if it was possible to use Git submodules through script/plugin? I tend to use submodules a lot to keep the size of my repos to a bare minimum.

  • Bounga

    Bounga November 21st, 2008 @ 08:49 AM

    @DHH : Do you mean that we could write plugins (to handle other SCM) to install plugins ? So before installing plugins, we need to install a plugin that add the support for the SCM ? If so, I think it's a bit ... disappointing because it's gonna be a per-project install. If we go this way, we need an API that let install it "in" Rails, not in projects. A gem maybe that can be loaded automatically by Rails projects at initialization.

    @Daniel : I'm available to review your code, even for other patches ;) I can help to write code too if you need it.

  • DHH

    DHH November 21st, 2008 @ 08:55 AM

    Yeah, a gem sounds good too. You can follow the example from the generator gems which are also system wide.

  • Daniel Schierbeck

    Daniel Schierbeck November 21st, 2008 @ 06:05 PM

    David: would it be okay if I opened a ticket dedicated to this API? I'm thinking of adding a PluginManager class that can be extended by plugins, e.g. GitPluginManager, HTTPPluginManager, etc. Any thoughts on this API? Perhaps just copy the design of the Generator API?

  • DHH

    DHH November 22nd, 2008 @ 10:53 AM

    • State changed from “new” to “wontfix”

    Sounds great to me, Daniel. I think the generator API would be a good way to start from in terms of wiring in the gem support. You might want to assign the new ticket to Jeremy. He did the gem support for generators.

    I'll close this in the mean time.

  • Ryan Bigg

    Ryan Bigg October 9th, 2010 @ 09:49 PM

    • Tag cleared.

    Automatic cleanup of spam.

  • bingbing

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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages