I've searched all over the site...and the most patient explanations assume a certain amount of knowledge and use a gajillion terms that I have no idea what they are (maybe Drupal.org should use the glossary.module). What I need is a step-by-step guide for patching files on my local Windows computer so I can put them on my host. By step-by-step I mean all the way from downloading and installing a certain program to what to click, how to click, and where to click it.
Here is some examples of what I am trying to deal with when I am trying to figure out how to patch. These examples have come up in my search of this site.
find the cvs.exe of your cvs package
What?
make sure it is in your PATH
Who?
maintainers can read and judge the patch before it ever gets near a tree
*looks outside* Tree?
There is a very usefull section in patch handbook
Useful to who? I got more confused reading it.
Seriously, in my search to find the answer before posting, I found many requests for a simple explanation to patch for people who aren't programmers, who aren't fluent in such-n-such jargon, etc but none were forthcoming. Drupal is awesome, but the learning curve for it is insane...mostly due to vague or unfamiliar explanations. This is no different. Please...PLEASE reply. If I can gain an understanding, I will put together an article for the average layman so they can find it in the search.
Comments
Patches are developer level tools
To be frank, patches are developer-level tools. They should be used by the "layman" only with EXTREME CAUTION. Until the code is actually applied to Drupal core and a new release of Drupal comes out, it is unsupported. Until the code is applied to a contrib module and a new version is made available, it is unsupported.
You need to know how to use the command line on *NIX boxes or how to install a command line on Windows in order to do patching. You will probably have an easier time getting a host that allows command line access and learning the step-by-step UNIX commands rather than getting it to work on Windows. So, it's actually kind of impossible to help you if you only have access to a Windows box.
The Diff and Patch section includes everything that is available.
If you have to ask...
Boris makes an excellent point: if you don't know what a patch is, you probably don't want to apply one.
That said, a patch is a modification to Drupal's code. What gets released is the last version with patches applied to fix bugs, add functionality, etc. A released version has patches that have been tested and determined to work as desired. A patch you install yourself might do anything.
I'm an intermediate user. All those terms made sense to me. I still don't apply patches to my production Drupal installation, and hardly ever to my testing one.
I've made an attempt at this...
Check the handbook page available here:
http://drupal.org/node/28245
I know this is not exactly what you're asking for, because it's geared toward people running on Linux (or those with "shell access" to their host -- i.e. you can use a program like PuTTY or telnet to login and type in commands directly), rather than Windows. As such, there is no describing where to click so much as there is describing what to type. :\
I realize it is a higher end
I realize it is a higher end program but the reason I want layman's terms is so I can get beyond this "know nothing" stage and eventually be able to contribute. Many (maybe even all) of you have had this whole patch thing explained to you. That is all I am asking for here. You all had to start somewhere and that is what I am trying to do.
I want to install a patch because I am REALLY wanting to get the Trip Search module up and running properly.
And my reference on where to click was just an example as to how need it explained step by step. I see a lot of "what to type" and a lot of references to a command line. Where is this? If it is on my host, how can I get to it? Let's start there.
Patch Dancer..
I too am a bit rusty when it comes to some of this patching and diff stuff.
I tried to get my head around patching and am almost there..but, for the duration..I tend to do this:
+plus sign indicating lines you have to add in and a-minus sign indicating lines to delete.the above is obviously very laborious when dealing with large patches...but, it works. Most patches are relatively small and take about 5/10 minutes to do manually.
To automatically PATCH a file is quite a routine thing to do on linux/unix apparantly, but I'm on a PC using Windows XP.
I downloaded a programme called WINMERGE (freebie) which is for the PC and has patch/merge and various tools to do this stuff. So if the patch is lenghty and you don't mind playing with winmerge..download it and have a go. I'm playing with it when I have some spare moments and will type up a simple patching for dummies handbook page when I've sussed it.
In the meantime, I hope that helps..
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
> Many (maybe even all) of
Many (maybe even all) of you have had this whole patch thing explained to you. That is all I am asking for here. You all had to start somewhere and that is what I am trying to do.
I don't think anyone has had this stuff explained to them. It's a process of trial and error and poring over every document available, making notes, then Googling for things you don't understand and reading/playing some more until it all starts to make sense. If you don't have at least some basics behind you (i.e. 'where is the command line') before you engage in this process, and moreover are unwilling/unable to do research on your part to look into things you do not understand, you're going to run into a very difficult time, and it will be very frustrating for others to help you.
I see a lot of "what to type" and a lot of references to a command line. Where is this? If it is on my host, how can I get to it? Let's start there.
1. Check to see if your host a) is a Linux/BSD host, and b) has a feature called "shell access." Places to check for this include a FAQ/Knowledge base if your host has one, on a plan comparison page, or by contacting their support directly.
2. If so, go to Start > Run, enter cmd and hit OK. This brings up a "command prompt" (the same thing as "command line").
3. Type in telnet example.com, where example.com is your domain.
4. Enter your username and password when prompted. This is normally the same username/password you use for your FTP account, but check with your host to make sure.
This will give you have a command prompt, from which you can enter the commands referenced in the various handbook documents.
If you don't have a host with shell access, which is very possible, then you'll need to patch the files on your own computer and then FTP (or however you move files to your host) the changed files over the original files. This is a very cumbersome process. The best way in my opinion to do this is with a program called Cygwin, which creates a Linux environment running right under Windows...this way all of the Linux-based commands in the handbook files will work without modification. There are also Windows patch utilities (WinMerge is one, as mentioned below), but then you need to basically teach yourself how to do everything that's in the handbook since it's geared toward "normal" commands and not a specific tool.
Developer skills.
I'd reiterate that these are developer and systems skills that are outside the scope of the Drupal site to teach you even though they are nice guys by explaining it this far. Do you look for CSS or HTML tutorials on drupal.org? I do note with a little irony though that the drupal.org tutorial features very highly in a Google search for "patch diff windows" :)
It sounds like you don't have much or any command line experience on Windows. Is that correct? Without that you will struggle as there is a lot of prerequisite info you need to know before even going near patching Drupal source code.
I started answering your specific questions, but the more I got into it the more I realised that I would only confuse you further and was only really repeating what the Drupal pages were telling you anyway. I'd have to write a whole book explaining the basics of how computers and command line interfaces work, before sidelining into differences between Windows and Unix, source control etc etc.
The page(s) you are struggling with provide concise useful information to developers and sysadmins (the target audience) that is pretty precise and should even be able to even be followed by anyone with anything resembling a passing knowledge of the Windows command line. To be perfectly frank, I don't think you should be attempting this without going back a few steps and learning some of the prerequisite skills.
I think your best bet would be to ask someone nicely if they could patch some specific files for you.
Some useful links:
Windows command line stuff:
http://www.horstmann.com/bigj/help/windows/tutorial.html
http://www.horstmann.com/bigj/help/windows/advanced.html
CVS links:
http://mongers.org/cvs
http://flipcode.com/articles/article_cvsintro.shtml
http://ikon.as/wincvs-howto/
http://cvsbook.red-bean.com/cvsbook.html
Patching on windows
this is what worked for me.
goto www.cygwin.com and download and install cygwin on your pc (can take awhile .. a long while .. sometimes a really long while).
then goto this site http://hp.vector.co.jp/authors/VA010446/toolbox1/archives/patc254w.zip (link courtesy of http://drupal.org/node/323#comment-46764) which will download a zipfile.. Unzip to find a file called patch.exe
Find the folder where you installed cygwin, in there you will find a folder called bin. Open this and copy patch.exe into there
Go back to your main cygwin folder and create a new folder called mypatch.
Now your ready to patch like a pro (pizza and mr pib not included)
As I dont know exactly what versions of trip search your trying to patch we will use this patch to the common.inc as an example http://drupal.org/node/29681
copy the file you want to patch and its patch to the mypatch folder. In this case common.inc and format_date.patch
go to Start > All Programs > Cygwin> Cygwin Bash Shell then hold on tight to your pizza as your not in kansas any more.
There will appear a black window ,
strange symbols shall appear something@somethingelse ~
then a dollar sign followed but a seemingly innocent flashing cursor.
Do not be fooled for this is the dreaded command line
follow these instructions to the letter less ye be mocked by the Devil Opers
type
cd /mypatchthen press entertype
patch -u --verbose common.inc format_date.patchthen press entersit back and behold the dreaded commandline enslaved as it does your biding and produces not only a patched version of common.inc but also a back up of the original common.inc.orig just in case the patch really screws your setup. Use this format for any files you want to patch
patch -u --verbose filename.filetype patchname.patch
Occassionaly the commandline might bite back with "Reversed (or previously applied ) patch detected! Assume -R? fear not type
ythen enter. Providing all your Hunks (yes Hunks honest not kidding) succeeded then the patch worked...But... yes there is always a but... Just because a patch has been applied does nt mean your fancy new file will work. maybe you missed some earlier patches, maybe the file you patched was not the latest version, maybe the patch has some bugs that will be fixed by an even newer patch. Its never a dull moment in the patching game.
having poked fun I must say thank you to all the ppl who know more than I , who do provide the patches, that improve the modules that make the rest of us look good.
Ric :)
WinCVS
All those mentions of command lines sends shivers down my spine. I remember seeing a command line once when I was a kid and that was enough to make me a vegetarian for life.
WinCVS gives you access to CVS without reverting to monochrome or doing things without a mouse. Filezilla gets your files down to your server and back.
petermoulding.com/web_architect
I am one of those "where is
I am one of those "where is the command line" people. My first guess would be a command prompt. Something I am used to from back in the day. But I haven't seen a reference to that. But if I have to do a command line, I won't be completely lost. It is where I got my humble start a long time ago.
Dublin, I REALLY appreciate the explanation you gave. I tried to follow it but the patch file had lines with a "-" next to them but not next to others that seemed to be replaced as well. For example, in the patch file it showed this...
- if (module_exist('taxonomy') && variable_get('trip_search_toggle_categories', TRUE)) {Then, immediately below that...
My best assumption would be that I need to replace the "-" line with the entire "+" area all the way to the next "-". I use this way since it sounds similar to another portal program where they had a:
That system would give an exact line for line to be replaced. The patch file wasn't clear to me about that.
I saw it mentioned in this thread that if I asked nicely someone here may patch the file I need for me. I ask it now. I need the SQL Search (Trip Search) 4.6 trip_search.module file patched with the file from this bug report:
http://drupal.org/node/27267
not quite
Hi Stompdancer...
As a pointer...here's a small patch file example to illustrate what to do:
Patching.
The lines with no + (plus) or - (minus) signes are used to illustrate context. i.e. inserting line number 18 would be made more difficult if you didn't know what the next line was. so it's shown in the patch file to give context.
The
@@ -493,12 +493,12 @@on line 5 gives you a clue to what the line numbers are that need editing as they appear in the full module your patching.In a large module, to help find the corresponding lines in the module to be patched...I tend to just do a text search for the line that needs changing..so in the example above I would search for
* Implementation of hook_node_types()..I hope that makes sense
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
Not for the faint of heart
But here goes:
To patch from windows:
0. In your c: drive, create a folder named C:\cygwinstuff
1. Go to www.cygwin.com and download the setup file.
2. Click on the file downloaded in step 1 to start the install
The next few steps will walk you through the install process for Cygwin.
3. Choose "Install from Internet"
4. For Root Install Directory: Choose "C:\cygwin"
5. For Local package directory, choose "c:\cygwinstuff" -- the folder you created in step 0
6. Choose the appropriate internet connection -- for most of us, that's the "Direct Connection"
7. Choose a download site -- I generally pick one at random, but for those of you who are more precise, you can use the domain names to try and choose a site on the same continent
8. Select packages: This is where things can get tricky. Just make sure to select the "patchutils" under the "Devel" section.
9. Begin the install.
10. Once Cygwin has installed, open the c:\cygwin directory. You will see several folders: bin, etc, home, lib, tmp, usr, var. The folder you care about is the "home" folder.
11. Open the home folder, and you should see a directory with your username. Open this folder, and create a new folder in it named "patchfiles". Move the file you want to patch, and the patchfile, into this folder.
12. Open Cygwin. Cygwin gives you what you have been looking for: the command line. You will need the following commands:
"ls -al" -- lists the contents of your current directory
"cd .." -- moves you up to the parent directory
"cd foldername" -- moves you to a specific folder visible from your current directory
13. When you open Cygwin and type "ls -al", you should see your patchfiles folder. Use "cd patchfiles" to navigate into this folder.
14. Type "ls -al". You should see the files you moved into this folder in step 11.
15. Type
patch filetobepatched <patchfileThat ought to do it.
-------
http://www.funnymonkey.com
Tools for Teachers
-------
http://www.funnymonkey.com
You two are absolute saints!
You two are absolute saints! I saw how it was done manually...I think I finally got it and I got the cygwin to work. I got the file patched!! The patch didn't fix everything but at least I got past this hurdle and will know how to do it again. Once I gain a little bit more familiarity with patching, I plan to write an article that will explain, in detail, several different methods.
Thanks again guys for your patient explanation. That was all I needed :).