In the first article of this series, Conversion to Subversion, Part I, I described the problem I found in trying to convert a project from my CVS repository to Subversion. In my last article, Conversion to Subversion: The Project’s Trunk, I described the solution that I used to convert a basic project with no tags or branches. This time I’ll discuss the converting the tags on a project from CVS to Subversion.
As stated before, the tag directory structure generated by cvs2svn
was not what I wanted. Assuming a CVS module of project1
and a tag of FIRST_RELEASE
, the dump file would have a directory structure of tags/FIRST_RELEASE/project1
. I wanted project1/tags/FIRST_RELEASE
.
At first, I thought I could use the same approach that I had used for the main project. I would
- Filter the dump file to keep only the project and tags I care about.
- Copy the project and the tags over.
- Update the project path as before.
- Change the tag directory from
tags/FIRST_RELEASE/project1
toproject1/tags/FIRST_RELEASE
.
Unfortunately, searching through the dump file did not turn up a tags/FIRST_RELEASE/project1
. So I began looking at the dump file a little harder. The result was a little confusing. Apparently, cvs2svn
treated each tag as if the entire repository had been tagged (everything in trunk
was copied to tags/FIRST_RELEASE
). Then, everything except the project1
directory was deleted. This generated a large number of extraneous revisions that do not accurately reflect what happened in the repository. The end result would have been correct in the repository with the old directory structure; but it wouldn’t work with the new structure.
I modified the initial copy from trunk
to copy from project1/trunk
to project1/tags/FIRST_RELEASE
in the dump file. Then, I deleted all of the extraneous delete directory commands in the dump file.
The new modified dump file would build the project with the tags I required. Just as importantly, the extraneous manipulation used to clean up the initial strange tagging request have been removed. This also solves the problem that would have been caused by attempting to change directories that had been filtered out of the dump.
I incorporated this change into my script that fixes up the dump file before I do the load. It seems to be working quite well. The new projects I’ve added with these changes appear to be intact with the appropriate tags in place. If I had any branches I wanted to keep, I could apply an equivalent approach to fix up the branches before loading.
Update
This entry has been updated a bit in the entry Conversion to Subversion: Tags Revisited to answer questions I’ve received by email.