What's a good (or preferably, in your opinion the best) way to make subversion diff'ing and merging LaTeX-aware?
I know latexdiff and latexrevision exist, but it's not clear to me how to make those part of a normal subversion merge workflow. Especially since you have to edit the resulting file to specify which changes you want. If there's some way to set up subversion or TortoiseSVN to automate this, that would be great.
I'm going to be merging some fairly large documents, and I don't expect my collaborators to have any discipline about maintaining line breaks etc. I only recently learned about this myself.
Windows tools are preferred. I do have Cygwin with X and the Windows svn client, so I can likely get UNIX tools to work.
Best Answer
Edit: Code available for both Subversion and Git here: https://github.com/suomela/gitwdiff
For diffing, I have successfully used the following approach. This is not Latex-aware, but it seems to work very well with Latex documents (and Bibtex files, too). I have used it both on Linux and Mac OS X.
It is word-based and hence does not care about line breaks. For example, you can have each paragraph as a very long line in your source code; even then, the diff output will be easy to read and concise. It uses a colour-coded output:
It is designed for black-on-white terminals; customise the colour codes if needed.
If you have made very extensive changes, occasionally it is better to use the usual diff. Try it out and see what happens.
Usage:
Examples:
svnwdiff
and you will see all your local changes.svnwdiff -c6445 foo.tex
just like you can usesvn diff -c6445 foo.tex
.svnwdiff -c6445 foo.tex | less -R
if you need a pager.Put the following shell scripts in your
$PATH
:svnwdiff:
mywdiff:
Finally, you will also need the wdiff tool. If you are using Ubuntu or Debian, just install the "wdiff" package. On Mac OS X, "port install wdiff" should do the trick.
If you are having problems getting all this working, try the following:
For merging, I have found out that the best solution is to not need to merge. I tend to use email, skype, etc. to coordinate who has got the write token on which parts of the document. If all coordination efforts fail, I use the above diff tool to figure out who has done what, and integrate manually.