One of my Tasks customers asked if I had any advice for tracking customizations he makes to Tasks in some organized fashion. I don’t actually customize my software (I use it as it ships), but I do customize WordPress, PunBB, etc. – here is what I do:
Let’s say I want to edit the themes/index.php file of PunBB. I create a folder called ‘punbb-customizations’ (or similar) and a folder inside it called ‘themes’, then I copy the original index.php file into ‘punbb-customizations/themes’ folder. Once I’m happy with my customizations, I then diff the original file and the file with my mods and save the output as index.php.diff in the ‘punbb-customizations/themes’ folder.
That gives me both the original file and the diff of my changes so I can refer back to them when the next version is released and re-apply the changes.
I like the idea about saving the original file with changes. I sometimes can’t figure out what I changed when I need to change it again.
How do you “diff” the two files? What does that mean? Diff? Sorry to be such a technodoofus.
Google, yo! Answers.com has good info too.
After googling around for a while, I still found it very difficult to find an example which showed all the steps Alex describes. For instance, few of the examples showed how to create a diff file or which options one might wish to set as optimal for the diff command, or how to apply a patch. However, I was finally able to work this out and I thought I’d share my results here so that anyone else who googles this page or comes to it via the tasks forums can find it:
First, I logged in to my shell account and created the folder tasks_custom at the root level (so it won’t be overwritten when I upload a new version of tasks).
Then I copy filname.php to the appropriate folder in tasks_custom. In this case I will just assume it is a file at the root level.
Then I type: diff -u tasks/fineame.php tasks_custom /filename.php > tasks_custom/filename.php.diff
the “-u” tells diff to give you some context about the changed lines of code. The “>” creates a new file with the output.
That’s it. You might wish to look at the new file to see what it looks like, or run the command without the “>” and what follows it so you see the output in the terminal.
Finally, assuming you install a fresh install of tasks and want to reapply the differences, you can use the “patch” command as such:
patch
oops. Looks like the last post got cut short. The final line should read:
patch < tasks_custom/filename.php.diff
(I think it interpreted the greater than sign as HTML, so I am trying again with the proper escape code. I hope this works.)