Smooth migration from CVS to darcs
I moved another project from CVS to darcs. The main secret is just cvs2darcs, which has worked perfectly for me. But in this case, I knew I there were some URLs in the wild pointing into my viewcvs site, which I didn't want to break.
So I fired up darcsweb, which is nicer than I expected it would be. I'm using nginx, so I can't just run darcsweb as CGI. While eventually the darcsweb toplevel code should be rewritten to not be CGI, for now I'm running a simple twisted.web CGI server. Here's the full code:
#!/usr/bin/python
import sys
from twisted.internet import reactor
from twisted.python import log
from twisted.web import server, resource, static, twcgi
class Root(resource.Resource):
def __init__(self):
resource.Resource.__init__(self)
for f in ['darcs.png', 'minidarcs.png', 'style.css']:
self.children[f] = static.File(f)
self.children[''] = twcgi.CGIScript(filename='./darcsweb.cgi')
log.startLogging(sys.stdout)
reactor.listenTCP(8004, server.Site(Root()))
reactor.run()
Finally, to make the URLs redirect, I added a nginx rewrite rule:
server { include conf/stdsite.conf;
server_name cvs.bigasterisk.com;
location / {
proxy_pass http://bang:8003/;
# for 'room', filenames in viewcvs forward to the new darcs repository
# e.g. '/viewcvs/room/evening_lights?rev=1.3'
rewrite ^/viewcvs/room/([^\?]*).* "http://bigasterisk.com/darcs/?r=room;a=headblob;f=/$1?" permanent;
}
}
So now you can go to an old link to viewcvs and it'll redirect to a reasonable point in darcsweb. Until I relocate all my files into new directories, which darcs will let me do easily :)