Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Add Hg (Mercurial) support to script/plugin

#1284

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.

Reported by Bounga · October 28th, 2008 @ 01:50 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Daniel Schierbeck
    Daniel Schierbeck

    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.

    October 29th, 2008 @ 10:32 PM

  2. Daniel Schierbeck
    Daniel Schierbeck

    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.

    October 29th, 2008 @ 10:34 PM

  3. Daniel Schierbeck
    Daniel Schierbeck

    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.

    October 30th, 2008 @ 12:05 AM

  4. Bounga
    Bounga

    no problem. Did you test it with 1.8?

    October 30th, 2008 @ 07:49 AM

  5. Bounga
    Bounga

    Nobody interested in Mercurial support?

    November 20th, 2008 @ 10:50 AM

  6. Alex MacCaw
  7. Bounga
    Bounga

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

    November 20th, 2008 @ 11:21 AM

  8. Daniel Schierbeck
    Daniel Schierbeck

    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 Make it possible to install plugins with Bazaar, 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.

    November 20th, 2008 @ 04:28 PM

  9. Bounga
    Bounga

    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.

    November 20th, 2008 @ 04:34 PM

  10. DHH
    DHH

    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 ;).

    November 20th, 2008 @ 08:26 PM

  11. Daniel Schierbeck
    Daniel Schierbeck

    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.

    November 20th, 2008 @ 10:17 PM

  12. Bounga
    Bounga

    @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.

    November 21st, 2008 @ 08:49 AM

  13. DHH
    DHH

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

    November 21st, 2008 @ 08:55 AM

  14. Daniel Schierbeck
    Daniel Schierbeck

    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?

    November 21st, 2008 @ 06:05 PM

  15. DHH
    DHH
    • 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.

    November 22nd, 2008 @ 10:53 AM

  16. Ryan Bigg
    Ryan Bigg
    • Tag cleared.

    Automatic cleanup of spam.

    October 9th, 2010 @ 09:49 PM

  17. bingbing