What is scdiff?
Imagine this: you’ve just made changes to code kept in
CVS, Subversion or
Git repository. You’re ready to check them in but you
want to take a last look at the changes. Usually you would do
cvs diff -u or
svn diff. This program allows you to see the changes with an external gui
diff program. I find it much easier to understand the changes that way (as
opposed to looking at unified diff in the console). By default it uses
windiff.exe but you can use
-diff option to select any other program (e.g.
WinMerge or Araxis
Merge) . Clearly, it’s a tool for
scdiff [-h] [-old] [-cvs cvsCommand] [-cvsargs cvsOptions] [-diff
If you run scdiff without any arguments, it’ll determine if a given directory
is under CVS or Subversion control, check for locally modified files and
launch external diff program showing local modifications. By default it uses
windiff (assumes that windiff.exe is in the
%PATH%) but you can use
-diff option to use any other diff program that can be launched from
command lind. First two arguments given to the diff program are directories to
diff. This works for all diff programs I’ve tested it (windiff, WinMerge and
By its nature (see how it works for more explanation) scdiff uses temporary
directory for storing original and modified files so even after you finish,
you can still see the result of previous diff. Option
-old does exactly
that. It saves the time (getting files from repository may take some time).
To see built-in help, use
-cvs defaults to “cvs -z3”. Option
-cvsargs defaults to “-u -N”. In
theory you shouldn’t need to change them.
Download scdiff.exe. Requires .NET Framework 2.0.
You can get the sources from project site.
- added Git support
-cvsparameter to provide the name of cvs executable. Default is “cvs -z3”.
-cvsargsparameter to provide additional args to cvs. Default is “-u -N”
- fixes for handling new and deleted files in cvs All 0.4 changes provided by dB.
- Eli Tucker fixed a bug handling directories in cvs
- no longer crash when handling
svn remove. Still, handling of deleting files is far from perfect (currently they are silently ignored while we should show apropriate diff)
- properly handle file names with spaces. Fix suggested by Raman Gupta
- now also shows files that only exists locally and are not present in
cvsrepository. If that bothers you, learn how to use
- show version number when displaying help
- first version
How it works
Not that it’s terribly interesting, but just in case you were wondering.
First, we capture the output of
cvs diff -u or
svn diff. From that we
extract names of the files that are locally modified and the revision number
of the file before modifications. The we check out the originals (using
update -p -r rev or svn cat …), copy the originals to
$tempDir/sc_originals, our locally modified copies to
and launch external diff program with
$tempDir/sc_altered as arguments. Pretty simple and possibly suboptimal
(subversion can do a diff without contacting remote repository, so it should
be possible to significantly speed up the program if I knew how to get the
original without asking remote repository).
It’s really a quick & dirty program, so there’s potential for a lot of stuff to be done. In the “blue sky” departement, I would like to have a full-fledged program for browsing changes in CVS or Subversion repositories. And no, it’s not about re-writing WinCVS and the like for the fun of it. WinCVS does much more that what I need my ideal program to do, but it also doesn’t do what I want (easily end efficiently browse changes).
But that’s unlikely to happen, so here’s a couple of things that could be fixed:
- as noted in “how it works”, it should be possible to make Subversion case work without contacting remote repository
- currently you can’t launch two copies at the same time because they use the same temp directory for storing files so the second copy will be unable to access temp directory
- currently windiff.exe must be in path. Could try to auto-detect full path by checking known paths or maybe looking in the registry
- auto-detect other diff programs like WinMerge and Araxis Merge
- downloading revisions from the repository takes time. Revisions do not change so they are perfect target for caching. We could locally cache revisions we retrieved so far to speed up a case of comparing local changes with the same revision multiple times. It happens quite often (we often get into develop/compare/fix/compare/fix/compare… cycle)
- CVS and Subversion are source control systems. Use Subversion if you have a choice
- Windiff, WinMerge, Araxis Merge are diff/merge programs. There are others.
- WinCVS is a GUI for managing CVS. It doesn’t do what I need.
As noted, this program is simple, does one thing that is useful to me. It might never get any better and there’s not much to talk about. If you, however, have a burning desire to talk to me about it (you know, comments, bug reports, suggestions etc.), you can always send me an e-mail.