(Update — version 0.3 released 2-Oct-07. Release notes are here.)
We use subversion for our source control. We love it. But we’ve noticed a few flaws, and a few weeks ago I decided I’d had enough and wrote a wrapper for it that fixes a few of the most glaring ones:
- Externals get messed up pretty frequently. If you remove or rename an external, the old one gets left around on disk, and if you convert an external to a “real” directory or vice versa then the next update simply fails.
- Externals are updated in series, not in parallel, meaning that if you have a lot of externals your updates can take an excruciatingly long time.
- Externals are updated even if they’re frozen to a specific revision number, which wastes even more time on update.
- If you want a clean checkout — say, for an automated build — the only way to do it is to do a full checkout, even if 99% of the files are already there on disk.
cocommand is not compatible with the convention of putting files under
/trunk, requiring you to type out your whole repository URL followed by
- The name of the executable is hard to pronounce — either “ess vee enn” or “seven”, but nobody says “seven” except when they’re saying “seven up”, which is, I admit, a pretty good pun, but come on, how much cooler is it to say, “sub”?
The current version of
sub fixes all of the above (except for converting directories to and from externals, and I’m going to make that work pretty soon).
sudo gem install sub
Help text is below the fold.
Usage: sub co project_name [dir_name] checks out [base_url]/project_name/trunk into ./project_name (or dir_name if specified) sub up [dir]* fast update (default command, so 'sub dir...' or just 'sub' work too) sub help prints this message Options: --verbose, -v lots of output --quiet, -q no output at all except for errors --help, -h prints this message --clean, -c 'up' command removes all unversioned files and directories --url [base_url] sets base repository url for 'co' command (default is ENV['SUB_BASE_URL'] or ENV['SVN'] or svn+ssh://rubyforge.org/var/svn) --version prints release version
sub up took the update time for my main project from 16.5 sec to 3.5 sec (we have about 20 externals).
If you have a common repository like we do, set it in your
.bash_profile like this
sub co foo
svn co https://svn.mygreatcompany.com/svn/foo/trunk foo
Otherwise it’ll default to Rubyforge’s repository.
If you want to see what commands it’s executing,
--verbose will show you (it indents the system commands so they’re easier to spot).
Enjoy! And please suggest improvements of any kind.