User Guide

tool to find the right place(s) to change in the existing sources.
3.9.2. Generate a patch
There are several ways to generate patches. The preferred way is to generate them from an updated
Subversion tree, since it avoids unnecessary integration work.
3.9.2.1. Using the svn command-line client
svn diff [changed_files] > svn.diff
Use the command line svn client to generate a patch in the required format from the changes you've
made to your working copy. If you leave out the name of the changed file the svn client searches for
all changes in the working copy and usually produces a patch containing more than just the change
you want to send. Therefore you should always check the produced patch file.
If you've added a new file, e.g. packet-myprotocol.c, you can use svn add to add it to your
local tree before generating the patch. Similarly, you can use svn rm for files that should be re-
moved.
3.9.2.2. Using the diff feature of the GUI Subversion clients
Most (if not all) of the GUI Subversion clients (RapidSVN, TortoiseSVN, ...) have a built-in "diff"
feature.
If you use TortoiseSVN:
TortoiseSVN (to be precise Subversion) keeps track of the files you have changed in the directories
it controls, and will generate for you a unified diff file compiling the differences. To do so - after
updating your sources from the SVN repository if needed - just right-click on the highest level dir-
ectory and choose "TortoiseSVN" -> "Create patch...". You will be asked for a name and then the
diff file will be created. The names of the files in the patch will be relative to the directory you have
right-clicked on, so it will need to be applied on that level too.
When you create the diff file, it will include any difference TortoiseSVN finds in files in and under
the directory you have right-clicked on, and nothing else. This means that changes you might have
made for your specific configuration - like modifying "config.nmake" so that it uses your lib direct-
ory - will also be included, and you will need to remove these lines from the diff file. It also means
that only changes will be recorded, i.e. if you have created new files -say, a new packet-xxx for a
new protocol dissector- it will not be included in the diff, you need to add it separately. And, of
course, if you have been working separately in two different patches, the .diff file will include both
topics, which is probably not a good idea.
3.9.2.3. Using the diff tool
A diff file is generated, by comparing two files or directories between your own working copy and
the "official" source tree. So to be able to do a diff, you should have two source trees on your com-
puter, one with your working copy (containing your changes), and one with the "official" source tree
(hopefully the latest SVN files) from www.wireshark.org.
If you have only changed a single file, you could type something like this:
diff -r -u --strip-trailing-cr svn-file.c work-file.c > foo.diff
To get a diff file for your complete directory (including subdirectories), you could type something
like this:
diff -N -r -u --strip-trailing-cr ./svn-dir ./working-dir >
foo.diff
It's a good idea to do a make distclean before the actual diff call, as this will remove a lot of
Work with the Wireshark sources
33