The next point of advancement in my skill elevation has been learning the patch utility. Actually, I got to work with a combination of the unix utilities diff and patch. I've found various good tutorials on the subject to get me started. Right now, I'm doing some simple patch creation. In the easiest form, you can create a patch from two files using diff like this:
diff -c original_file new_file > patch.diff
Apparently, the "-c" options allows for some context based mode that will allow the patch program to have an easier time patching your code. Also, the order of running the diff is critical. If you do this in the wrong order, patch will just give you a warning message and create a kind of backup file with the .orig extension.
Using the patch file, you would do something like this:
patch original_file -i patch.diff
The "-i" option tells patch the input file (i.e. the patch file).
You can also diff directories in creating a patch. I didn't succeed very well at that, but I'll put up my results once I become an expert in that area.
With Subversion, you can perform even more powerful patches by using Subversion's diff utility and comparing the repository items against a file or even directories. I had some issues getting this to work, but I think my biggest issue was the ordering of the diff. I kept getting the .orig extensions, signifying that patch did not work as expected. Well, I'll try again another day as I really want to become an expert at these subject matters.
On a side note, it's a real bitch mastering so many different technologies. You learn one tool, then you find out that you have to learn around 10 more related ones. On a positive note, I'm getting to the point where I feel very comfortable with a large number of tools. These are just another feather in my cap.
Trackbacks: (Trackback URL)
