Command of the day: svk ls
Why not calling them command-of-the-year as the one and only command-of-the-day i posted until now was posted one year ago? Well, they are intended to be commands that saved me the day like the one i explain today.
On my previous entry , I explained that Pau and me were publishing on sourceforge a python script, WiKo , that we used to edit our latest articles and thesis. Because we used it in such context, latest version have been commited in a private repository we have for articles and the like.
I wanted to move the files to a public repository at sourceforge . Sadly, svnadmin dump just works when you are in the same host as the repository is and we have no regular ssh access to the subversion. We could bother our admin, Jordi Funollet , but he is always very busy and we are always requesting him. (Thanks, Jordi for your support!!)
Luckily i found a nice entry blog on how to use svk to remotely dump a svn repository .
You need to install svk, in debian based:
$ sudo apt-get install svk
Then we should create a mirror repository with svk just containing the revisions concerning the selected path
$ svk ls svn+ssh://username@svn.myserver.com/path/to/repo/sub/path/to/wiko
svk will ask you several questions:
- Choose a base URI to mirror from (press enter to use the full URI): To filter by path, i recommend to do such filtering on the command line by specifying the full path, so return.
- Depot path: [//mirror/wiko] Is very important here to change the depot name so you can skip that ‘//mirror’ part, so answer //yourproject beginning with a double slash!!
- To end up, it asks which revisions do you want, normally the answer is ‘a’ (all)
Then dump the local svk repository:
$ svnadmin dump ~/.svk/local > my-repository-dump
And now you can import it into sourceforge as normal:
$ svnadmin load [the-new-repository] < my-reposotory-dump
With sourceforge the process is more complex. You should upload the dumpfile to the shell server. For example, for wiko it was at: sftp://wiko.sourceforge.net/home/groups/w/wi/wiko/
Then you should specify the uploaded dump file as it was a cvs to svn migration. It last a while, after that you can checkout wiko code!
$ svn co https://wiko.svn.sourceforge.net/svnroot/wiko/wiko
I lost the history of the file before a move operation, but at least we recovered some of the history.
Taking a look at the man page you can see that svk is really helpfull for other purposes, but definitely, its ability of dumping a remote repository saved my day :-)