I got a fairly significant patch to DrProject today. I wanted to show it to the other developers so they could give it a look over. How'd I do it?
Reverting Changes in SVN (or: it's not as easy as svn up -r)
February 08, 2008 at 11:57 AM | DrProject, Python, Work | View CommentsIf there is one thing that I've found universally confusing about version control systems, it's how to revert back to a previous revision, then move on from there. Conventional wisdom would dictate that svn up -r $OLD
with some additional flag that says pretend that we're still at HEAD
would do the trick... But, alas, there exists no such flag.
So, besides svn cat -r $OLD $FILE > $FILE
, what's the best way to revert a file (or entire tree) to an older revision? Well, it turns out that merge is the tool you're looking for.
The trick is that you can diff
backwards as well as forwards:
[wolever@thebes] ~/test_dr/All svn diff -r 2:1 Index: stuff =================================================================== --- stuff (revision 2) +++ stuff (revision 1) @@ -1,4 +1,3 @@ Let us endeavor so to live that when we come to die even the undertaker will be sorry. -- Mark Twain, "Pudd'nhead Wilson's Calendar" -Increased knowledge will help you now. Have mate's phone bugged. Index: docs.html
Which means that merge will work both ways as well:
[wolever@thebes] ~/test_dr/All svn merge -r 2:1 stuff U stuff [wolever@thebes] ~/test_dr/All svn ci -m "reverted changes" stuff [wolever@thebes] ~/test_dr/All svn diff -r 1:3 stuff [wolever@thebes] ~/test_dr/All
Of course, this will also work with the myriad of other version control tools out there. In fact, if you're still using SVN, reverting old changes is probably the least of your problems... At least compared to, say, merging different branches ^_^
But that's a post for another day -- I need to stop writing about merging and actually get on with, err, doing it...
DrProject/Trac Wiki Syntax Highlighting for Vim
August 16, 2007 at 10:39 AM | DrProject, Vim | View CommentsAfter being frustrated with boring white-on-almost-black (spectro) while working with DrProject wiki files, I broke down and wrote a Vim plugin to make the syntax pretty. It will also parse most of the Trac syntax (and more should be easy to add).
Get it: http://wolever.net/~wolever/drpwiki.vim
Using it:
- Save it to ~/.vim/syntax/drpwiki.vim (create the directory if it doesn't exist)
- In Vim, enter `:set filetype=drpwiki`