We have been quite happy running our ReviewBoard / TFS server at work however every once and a while we would get errors during review creation. It turned out that some times the files would get corrupt during the TFS to SVNBridge to SVN diff. This would manifest when the “post-review” command would fail during the SVN diff procedure with logged errors such as:
'svn: XML data was not well-formedn', 'svn: Error reading spooled REPORT request responsen'
This was 100% reproducible on one of our TFS projects but I could not figure out why this was occurring. Rather than waste more time trying to play with my TFS hack I ran a migration tool to copy an entire project with history from TFS to a local SVN repository and run the code review against the SVN repository instead. I found a tool online called tfs2svn in SourceForge that would do the migration for me. I downloaded the tool and did the installation however I did need to change a few things after and the documentation for this app is non-existent.
- I manually upgraded the SVN bin in the tfs2svnlibs. I went to another SourceForge project, win32svn, which has the Windows 32 bit SVN binaries pre built. Download that and extract to tfs2svnlibssvn-win32-1.6.13 (as this was the svn version at the time). Lastly, open tfs2svntfs2svn.Winforms.exe.config and modify the SVnBinFolder setting near the bottom of the file to look like:
<setting name="SvnBinFolder" serializeAs="String"> <value>libssvn-win32-1.6.13bin</value> </setting>
Save and close.
- Also hidden in the docs was another bit of config for the SVN repository. The tfs2svn app requires that the <svnrepo>hookspre-revprop-change.* be enabled. I went into my hooks folder via command line and ran:
echo exit 0 > pre-revprop-change.cmd
which creates the pre-revprop-change.cmd file in the folder and puts the bare minimum code into the hook. - If you followed the steps in my TFS Reviewboard setup post a while back, near the end I modified the diff behavior of SVN to always interpret files as TEXT even if they are binary. This check can be removed since SVN will return the correct file encoding. Edit the C:GnuWin32bindiffForceText.bat and remove the
--text
parameter for the diff command to return it to normal operation.
Run the tfs2svn migration tool and start your migration. During migration I hit a few errors that had to do with commit rule differences between TFS and SVN. In one TFS changeset a new folder was added and then existing files were renamed/moved into this folder. tfs2svn stopped and said that the folder didnt exist. Luckily tfs2svn will reset the changeset to where the error was to give you a chance to manually make the change yourself and then carry on later. At one point I also had to manually accept a conflict using svn commands:
svn resolve --accept working
Once these types of issues are resolved continue with the tfs2svn migration.
You will need to create another repository in ReviewBoard administration so that posting a new review from the local SVN repository will be accepted. Follow the normal ReviewBoard documentation on how to add a repository for Subversion.
This was a perfect fix for us to carry on with our code reviews when problems arise. Hopefully I can convince management to finally move to a real production Subversion server for our development instead of the TFS monster. 🙂
Pingback: TFS (2010) to SVN using a modified tfs2svn | tim.pinet's Blog