views:

82

answers:

5

I have a private SVN repository that I use for all of my projects. It is backed up regularly, and I like being able to browse it over the web, when I need a little snippet of code.

Now, I would like to move to a more modern platform for source control (say, Git or Mercurial), but I also like having all of my projects in one place.

Is there a way to store multiple repositories in the same location with Mercurial?

Something like a personal Github or something?

Or, should I just continue to use SVN as the backing store, and use Mercurial to push and pull?

+2  A: 

Mercurial and Git are generally oriented towards 1-repository-per-project models. However, you could still have a bunch of repositories all grouped together in their own subdirectories within a directory, effectively having them mostly in the same place, and serve the entire top-level directory via a webserver.

Amber
Would I be able to create a new repository on-the-fly? Or, would I need to log onto the server and do an `hg init`?
John Gietzen
hg is distrbuted. The word "server" has no meaning except that imposed by developer convention.
Mark Borgerding
@Mark: I am fully aware of that. If you would read my question, you would see my use-case for a server.
John Gietzen
You can remotely create new repos over ssh:// but not http:// . If your repo is avialable vi hgweb only then you'll need to login and hg init.
Ry4an
+1  A: 

The short answer is no, DVCS repos aren't really set up to be used with multiple projects.

See my answer at the Kiln Stack Exchange on Should I use more than one repository? for the long version.

If this is just for your personal code that you aren't really working on with someone else, you can put them up on Kiln (backed by Mercurial) for free by using the "Student and Startup Edition". (Full disclosure: I'm a dev on Kiln.) BitBucket is also a good option.

tghw
My question was for an automated way to create *multiple repositories*, and for a way to access all of this via HTTP.
John Gietzen
+1  A: 

Yes and no. See the hgweb.cgi file.

Here's a link to the Dreamwidth project with multiple repos on a website (note, this isn't the default formatting, but it's the only one I could think of off the top of my head.

Oh - turns out Debian uses hg and has a web-facing cgi - http://hg.debian.org/hg/

The default setup of the hgweb will give you - for all your repos - version tree, commit logs, push/pull functionality.

Paul Nathan
+1  A: 

You can create new remote repositories over ssh using clone-to-remote like this:

hg init
hg clone ssh://remote//path/to/repos

after which you can browse and push via http if you have hgweb setup.

I wrote a cheesy little script to show how easy it would be to enable remote creation over http if ssh is undoable, but without some new configuration or software you'll find you're not able to create new remote repos without shell access of some sort.

Ry4an
What server software do I need in order to perform such an operation?Can I do this on windows?
John Gietzen
For the ssh:// you need a ssh server running on the system, but if you're already using ssh:// URLs then you have what you need. That little .cgi I wrote could be done in a few seconds in whatever CGI-like lanaguage IIS has. Anything _can_ be done on Windows, it's just usually a colossal hassle.
Ry4an
+1  A: 

As an alternative, you can use hg-app http://hg.python-works.com it's hgwebdir replacement written entirely in pylons.

  • has it's own middleware to handle mercurial protocol request each request can be logged and authenticated + threaded performance unlikely to hgweb
  • full permissions per project read/write/admin access even on mercurial request
  • mako templates let's you cusmotize look and feel of application.
  • diffs annotations and source code all colored by pygments.
  • mercurial branch graph and yui-flot powered graphs
  • admin interface for performing user/permission managments as well as repository managment.
  • Additional settings for mercurial web, (hooks editable from admin panel !) also manage paths, archive, remote messages
  • backup scripts can do backup of whole app and send it over scp to desired location
  • setup project descriptions and info inside built in db for easy, non file-system operations
  • Full search text on repository codes
  • added cache with invalidation on push/repo managment for high performance and always upto date data.
  • rss / atom feeds, gravatar support
  • based on pylons 1.0 / sqlalchemy 0.6
marcinkuzminski