subcheat
Subcheat is a simple wrapper around Subversion’s svn command-line client.
This is hobby project I’m hacking away on. Poke around at your own peril.
Description
subcheat
functions the same way svn does. You could alias subcheat
to svn
and use subcheat
from now on without ever noticing it.
subcheat
adds some subcommands that can make your life a little easier:
-
subcheat undo
: roll-back a commit or range of commits. -
subcheat tag
: create, show or delete tags -
subcheat branch
: create, show or delete branches -
subcheat reintegrate
: merge changes from a branch back into trunk -
subcheat rebase
: merge changes from trunk into current branch -
subcheat url
: output the current working copy URL -
subcheat root
: output the current project root folder -
subcheat path
: output the current path in the repository -
subcheat revision
: output the current revision number -
subcheat pretty-log
: output friendly single-line logs
Also, some existing subcommands are enhanced:
-
subcheat export
: now expands simple tag names to tag URLs -
subcheat switch
: now expands simple branch names to branch URLs
Examples
Rolling back a commit is basically reverse-merging a revision into the current working copy. The following are equivalent:
subcheat undo 5000
svn merge -r 5000:4999 url/to/current/repo
Managing branches and tags are basic copy
and list
operations. The following are equivalent:
# assume we're in /svn/project/trunk
subcheat branch foo
svn copy /svn/project/trunk /svn/project/branches/foo
subcheat branch -d foo
svn delete /svn/project/branches/foo
subcheat branch
svn list /svn/project/branches
Note that tags and branches work the same but operate on the tags
and branches
subdirectories respectively.
reintegrate
and rebase
are two similar tools for managing feature branches. These basically merge changes from a branch into trunk, or the other way around. These commands first determine the revision number that created the branch and then merge from that revision to HEAD
. So, the following are equivalent:
# Subcheat
subcheat reintegrate foo
# Regular
svn log /svn/project/branches/foo --stop-on-copy
# note that revision number that created the branch is 5000
svn merge -r 5000:HEAD /svn/project/branches/foo .
Both reintegrate
and rebase
can accept a revision number as an argument to start the revision range to merge somewhere other than the branch starting point.
Installation
This project will some day be released as a gem, so you can install it as easily as sudo gem install subcheat
, but for now you will have to clone the project itself and include ./bin/subcheat
in your path in some way.
Once you’ve got it set up, you should really alias svn
to subcheat in your shell.
Assumptions
Subcheat assumes a particular layout for your repository:
[root]
`- project1
`- trunk
`- branches
`- tags
`- project2
`- trunk
`- branches
`- tags
`- ...
It might some day be made more flexible, but this works for me right now.
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2009 Arjan van der Gaag. See LICENSE for details.