d000hg Report post Posted June 2, 2006 I know I can use Diff to create a diff file. But how can I make a patch for multiple files? Is this a feature of the Diff tool? Do I need to have on my PC both versions of the file? Share this post Link to post Share on other sites
ttlanhil Report post Posted June 2, 2006 it can be done like that, but if you're making patches against cvs it's a bit easier "cvs diff -nuaR -o patchname.diff" for the command-line version... that'll diff all files, though, which is probably wastefull. you can specify which files to make it quicker if you're using something like tortoiseCVS then there'll be context options, just select the files in explorer and chose patch from the right-click menu and etc. for any other tool you may be using note that if you want to add/remove files in your patch it's slightly more complicated (but I don't think you were doing that, so I'll skip it for now ) Share this post Link to post Share on other sites
m_bee Report post Posted June 3, 2006 Here is how I do it (linux, sorry ) -Fetch the cvs, for example, in ~/opt/el/elc -Copy it to ~/opt/el/elc-modXYZ -Contents in ~/opt/el/elc is clean cvs -Contents in the rest of dirs under ~/opt/el/* is edited by me To make a patch of the clean cvs agains any of these mods, I cd ~/opt/el for i in modXYZ/*.[h,c]; do diff -U10 /elc/$i $i >> patchfile.patch; done I, of couse, use this in a scripted fashion Do not like to write that much. So I created a file called "makepatch" in the ~/opt/el directory, with just "for i in $1/*.[h,c]; do diff -U10 /elc/$i $i; done" into it. Gave exec perms, and now, when I want to make a patch, I just do: ./makepatch modXYZ > patchs/modXYZ-r17.patch Share this post Link to post Share on other sites
ttlanhil Report post Posted June 3, 2006 -Contents in ~/opt/el/elc is clean cvs-Contents in the rest of dirs under ~/opt/el/* is edited by me this means you're using potentially out-of-date data to compare against... normally that won't much matter, but still. plus it's a waste of disk space and time... if you have the ability to use `cvs patch`, then it'll usually be the best method(oh, and `*.[h,c]`? anything ending with a period followed by a h, c, or comma (closed brackets is a set as I recall. you probably want [hc], but that suffers the same problem)? what about other files (like the .cpp, makefiles, el.ini, etc)?) Share this post Link to post Share on other sites
m_bee Report post Posted June 3, 2006 (edited) I have the ability to do that, but I also have a 56k dialup modem, so I just checkout before making the patch. No problem with the sources. I just make the patch against the sources on where I edited it, that is the right way for me to do the patch. If needed, then I checkout the souces for an update, and apply the patch, and fix the rejects, and make a new one. Disk space can be wasted, for me the issue is bandwidth About the other thing, it was just a quick note on how I do it, i dont mean i do it that way just always. If you want the diff for all the files change that by a single *, teh comma was a typo, yeah, you are right. I do it that way to shorten the thing, since im not editing the cal3dwrapper code, so, no need to include cpp in my list. EDIT: that way I also avoid making into the patch the Makefiles code, wich I modify and dont need to be in the patch, I just want the .h anc .c files, so that is the good way to do it for my purposes. Edited June 3, 2006 by m_bee Share this post Link to post Share on other sites