Search code examples
version-controlscriptingmercurialrepositorycode-organization

How many repositories should I use to maintain my scripts under version control?


I mainly code small programs for myself, but recently, I've been starting to code for my peers on my team. To that end, I've started using a Mercurial repository to maintain my code in some form of version control (specifically, Tortoise-Hg on Windows). I have many small scripts, each in their own directory, all under one repository. However, while reading Joel's Hg Tutorial, I tried cloning a directory for one of my bigger scripts to create a "stable" version and found I couldn't do it because the directory wasn't itself a repository.

So, I assume (and please correct me if I'm mistaken) that in order to use cloning properly, I'd have to create a repository for each script/directory. But.. would that be a "good idea" or a future maintenance nightmare waiting to happen?

Succinctly, do I keep all my (unrelated) scripts in one repository, or should I create a repository for each? Or some unknown third option?


Solution

  • Use separate repos for everything that you might want to use independently at some point. It's very easy to combine repos in the future and much harder to pull them apart. The subrepos feature (like svn externals) even lets you make an umbrella repo that includes all the small repos if that's still something you'd like to be able to clone in a single command.