Patch vs Code snippet
by John Eric Miller · in Torque Game Engine · 03/28/2003 (6:57 pm) · 4 replies
Can someone explain how the patch system works? How does this differ from just getting the h and cc files?
Thanks
Eric
Thanks
Eric
#2
03/29/2003 (3:16 am)
What happens when the Head version changes? Does this effect the patches from working correctly?
#3
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3014 has some more information on them, too.
03/29/2003 (4:00 am)
Only if the changes in HEAD conflict with changes in the patch will you have problems. Go do a man on diff and patch.www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3014 has some more information on them, too.
#4
Resources and snippets should ALWAYS be provided as a patch. And it's not very difficult to do. If one wants to provide a line by line explanation, it's pretty easy to do that from a patch file.
Why?
- A patch is a cleaner method of making changes to the engine code, without breaking alot of things. It's hands off, which means less transcription or copy/paste bugs. There's a reason why the GG folks want bug fixes and such in patch format.
- A patch is very very easy to make. It's really quite trivial, actually. More on this later.
- A patch stands the test of time better than providing changed engine files. Unless a file has changed dramatically, or the patch conflicts with a change that's been made, HEAD changes won't cause problems with your resource. On the other hand, the smallest change to the file can cause the other method to fail.
- A patch is so much quicker than a) writing up the line by line change list in the resource text, and b) copy and pasting or retyping said line by line change list. Like to learn off resources like Erik Madison? Read the diff file. They're really easy to read, and show context and all sorts of nice things.
Great, I'm sold! So how do I make a patch?
It's really really easy.
You go here ... read Tim's nice guidelines for creating a patch to submit to GG, and follow them.
What? You don't test your resources? Yikes. One should always test a resource against HEAD (or whatever version you make your resource against) BEFORE submitting. That means making the patch from a clean HEAD checkout, and applying it to a clean HEAD checkout and then verifying that it compiles and runs properly. Submitting a resource that doesn't work is a pain for those who want to use it and makes you look bad. It doesn't take that long to test a resource :)
Why not use your own game tree and just prune stuff? Because it's prone to failure. You can certainly build the patch from your own tree if you know what you're doing, but be sure to test the patch against HEAD before you submit it as a resource.
Finally, don't forget to include any NEW files along with your patch file, since cvs diff, unlike standard diff, ignores files it doesn't know about.
03/29/2003 (9:20 am)
I gotta say, this is a big pet peeve of mine.Resources and snippets should ALWAYS be provided as a patch. And it's not very difficult to do. If one wants to provide a line by line explanation, it's pretty easy to do that from a patch file.
Why?
- A patch is a cleaner method of making changes to the engine code, without breaking alot of things. It's hands off, which means less transcription or copy/paste bugs. There's a reason why the GG folks want bug fixes and such in patch format.
- A patch is very very easy to make. It's really quite trivial, actually. More on this later.
- A patch stands the test of time better than providing changed engine files. Unless a file has changed dramatically, or the patch conflicts with a change that's been made, HEAD changes won't cause problems with your resource. On the other hand, the smallest change to the file can cause the other method to fail.
- A patch is so much quicker than a) writing up the line by line change list in the resource text, and b) copy and pasting or retyping said line by line change list. Like to learn off resources like Erik Madison? Read the diff file. They're really easy to read, and show context and all sorts of nice things.
Great, I'm sold! So how do I make a patch?
It's really really easy.
You go here ... read Tim's nice guidelines for creating a patch to submit to GG, and follow them.
What? You don't test your resources? Yikes. One should always test a resource against HEAD (or whatever version you make your resource against) BEFORE submitting. That means making the patch from a clean HEAD checkout, and applying it to a clean HEAD checkout and then verifying that it compiles and runs properly. Submitting a resource that doesn't work is a pain for those who want to use it and makes you look bad. It doesn't take that long to test a resource :)
Why not use your own game tree and just prune stuff? Because it's prone to failure. You can certainly build the patch from your own tree if you know what you're doing, but be sure to test the patch against HEAD before you submit it as a resource.
Finally, don't forget to include any NEW files along with your patch file, since cvs diff, unlike standard diff, ignores files it doesn't know about.
Torque 3D Owner Xavier "eXoDuS" Amado
Default Studio Name
When you make a patch you compare 2 things, in our case, torque head with the modified head. So all the differences it finds it stores them in the patch file, saying what to change in what line, or what to remove, or what to merge, etc.
So when you run a patch file it modifies the files to make them be like in the patched version.
Overwriting .cc and .h files isn't really very intelligent... patches MERGE changes... while overwriting files wouldnt.