OK, first.... please no lectures on why command line is better than GUI. I went through my radical anti-GUI (who needs a mouse anyway) days back in the '80s. Oh, and yes, I know what Cygwin is -- I even have it on another one of my computers...
Has anyone found a good Windows program that reads patch files and applies them to files on Windows?
I have wasted half a day trying to find one because I am trying to install the taxonomy_access module and much to my horror, it requires applying a patch to another module.
I found this really nice, deceptively named "winmerge" which is great for making diffs but doesn't merge.
So I have installed gnu patch for now, but I dislike programs that need command line options to work properly. It's a great way to destroy the universe at 4:28 am with a typo.
Comments
Cygwin?
After messing around with a few other choices, cygwin worked for me. It does use a unix/command line interface, but I actually find that pretty direct. Although, it doesn't employ a pretty point-and-click interface.
Geez
I just realized, three years later, that you didn't want to hear about Cygwin. Some help I was! Sorry about that.
lol
lol
maybe?
http://www.tortoisecvs.org/
-sp
---------
Test site...always start with a test site.
Drupal Best Practices Guide
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
Thanks, I am using Tortoise cvs
I am using Tortoise cvs, it does not apply patch files.
Patch by hand.
Patch by hand. The +++ get added and the --- get removed.
Have fun and check my Drupal Profile: http://drupal.org/user/519
Go Open Source!
Try the following (no guarantees... I don't use them myself but they look good):
http://gnuwin32.sourceforge.net/packages/patch.htm
http://unxutils.sourceforge.net/
Hope this helps
I have installed gnu patch
I have installed the gnu version of patch. You still have to type filenames.
If I must use command line then I must. If I had a problem with open source then I wouldn't be using Drupal. Unfortunately, I thought it (open source) meant that you could become familiar with the source code, not that it was an absolute requirement to get it to work.
I give up. I could type 1000 filenames in the time it has taken me to find a way not to. Even if I did it wrong 1% of the time and it took me 15 minutes to undo the damage each time I think I would still be ahead.
Solution under Windows
After a bit of fiddling, I found that the way to get patches to install is to use the form:
patch {file} {patch} --verbose --binary
Without --binary, you get the most useful and informative message: "assertion failed" message due to the fact that the drupal files are in UNIX format.
Additionally, to upload the edited files successfully, you should add the Drupal file extensions .patch, .module, and .theme to the list of text file types in your FTP program, so it can repair newlines when it sends them to *nix hosts.
Thank you!
Thank you!
Set up an association for one-click patching
Really, I'm sympathetic with you... I also think that the Unix command-line is one the biggest propagations of idiocy of the modern age, but applying a patch with the patch tool requires one command that is relatively easy to remember:
patch -p0 < file.patch
If you want, you can turn this into one-click patching with a little trick. Get the native win32 version of patch.exe from the gnu tools, copy it to a directory within the system PATH. Then create a patch.bat file in the same location, with the following content:
Finally, set up a file type association for .patch and .diff files which executes:
patch.bat "%1"
From now on when you need to apply a patch, copy the patch file to the right location and double-click it. Or if you want, you can set up the default action to open the patch in a text-editor, with "Apply Patch" being a non-default right-click action.
With some tweaking, you can turn Windows into a very productive environment ;).
--
If you have a problem, please search before posting a question.
Duh
Now you see what happens when you are stuck on one way of thinking... I was ticked off because they made patch a win32 application, so you can't set it's command line parameters.
cygwin probs
I have installed cygwin and put the .module and .patch file in its directory. when i open the program and type anything that begins with "patch" it tells me "bash: patch: command not found" what do i do??? thanks
In all likelihood, you
didn't install the "patch" command when you installed Cygwin. In the install process, you are given a list of options to install -- I forget exactly where it is located (it's been a while since I installed cygwin) but I think it's located in "Developer Tools".
I hope this takes care of it.
Cheers,
Bonobo
-------
http://www.funnymonkey.com
thanks for the tip
After fixing the "assertion failed" error (details at http://drupal.org/node/60116), this worked great. Thanks!
Thanks for the great tip Steve! (All those years ago!)
I put the ".BAT" file in /SYSTEM32 with the following lines:
Now I can just double click on ".PATCH" files.
Easy Peasy! :)
Thanks again!
You can also create .patch files just as easily..
You can also create .patch files just as easily..
1. Download and install diff from the GNUWin32 Project http://gnuwin32.sourceforge.net/packages/diffutils.htm
2. Navigate to the place that the exe's were installed (eg. C:\Program Files\GnuWin32\bin)
3. Create a new file called diff.bat and put the following code in the file:
4. Go to the Start menu->Run and type "sendto"
5. Create a shortcut of diff.bat in this folder
6. You can now create a diff file by selecting both the original and modified file with your mouse, right click ON THE ORIGINAL file and choose diff.bat. A new .patch file will be created.
Try a full featured IDE
I've had a number of IDE's that can handle patches. Eclipse is one such example, and works a treat.
Alan Davison
www.caignwebs.com.au
Alan Davison
Any other?
I'm using Eclipse/Aptana only for patching, but it crashing very often, so I'm sick if I need to run it only for patching.
WinMerge/SVNTortoise to apply patches based on SVN repositories, but CVSTortoise doesn't have any patch utils (like in SVN version) and even just on filesystem it's not working quite well.
Ported Patch version doesn't work on Vista (it's asking for a permission, but it popup additional window ignoring console arguments).
You can try with admin console, but often it's crashing or making: Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354, so you need to convert your patches into CR-LF, so it making more complicated.
Manually you can change small patches, but not more complicated, so it not make sense.
Any other simpler sugestions? I'm interested with patching, not making a patch.
working on 7
Install the package aaron1234nz mentioned.
I run command
patch -i foo.patch --verbose --binary
I have just patched the gmap module this way
diff -urp works great too
Since I currently have to patch and diff files in Windows 7 x64, I have started to use the following three batch files together with GnuWin32 diff and patch executables:
diff.bat (shortcut to the batch file used in "sendto": you can now create a diff file by selecting both the original and modified file with your mouse, right click ON THE ORIGINAL file and choose diff.bat. A new .patch file will be created - thanks aaron1234nz) :
diffR.bat (shortcut to the batch file used in "sendto": you can now create a diff file by selecting both the original and modified directory with your mouse, right click ON THE ORIGINAL file and choose diff.bat. A new .patch file will be created) :
patch.bat (link the .patch extension to this batch file, remove "@echo off" if you want to see the feedback - thanks hoobuba) :
The same with Unxutils
Yes, I use the same approach of batch files with Unxutils.
Using the sendto and right click for Diff works fine but I have found the file manager determines which file is %1 and which is %2 in different ways depending on the current sort order of the file manager. My use case requires ensuring the file manager sort places the original file above the newer file. It's handy for quick diff's but calling the the batch files from the command line is still needed to create diff from different "root" as required for core patches or contrib patches if the changed file is in a sub-folder.
I decided to use Unxutils because it is not dependent on extra dll files and if I am only using patch and diff I don't need to worry about adding it to the windows path. This way it can be used as a portable app on a usb key.
I also found the Tofrodos utility is a good, free tool to remove the CR from files if patches are going to be uploaded to drupal.org. It can be used to convert files both ways, either remove or add the CR. http://www.thefreecountry.com/tofrodos/index.shtml
Thanks to everyone for the tips, this thread has also been a helpful one for me.
Izzy
I tried the patch.bat but
I tried the patch.bat but when i open the patch file with patch.bat i get the following
Commercial options are out there
More options to try; sorry I don't know for sure that any support applying .patch files.
http://en.wikipedia.org/wiki/Comparison_of_file_comparison_tools
edit: Further down on the page it mentions jEdit's ability to apply .patch files.
jEdit is Java heavy but it's not Eclipse heavy; it seems as though it is trying to implement the desired functionality.
http://www.jedit.org/index.php?page=download
1. install and run jEdit
2. install JDiff Plugin
- menu: Plugins | Plugin Manager
- change to tab: Install
- check: JDiff Plugin
- click: Install
- click: Close
3. configure JDiff Plugin
- menu Plugins | JDiff Plugin | check: Dual Diff
4. open file to patch
- (will be loaded in both edit panes)
5. apply patch
- menu: Plugins | JDiff Plugin | Apply Patch...
- select .patch file (click: Browse or paste in full path)
- click: Ok
6. review changes made and save as desired
- (if it works)
... I had problems here because it seemed it didn't work right; it had problems applying a multi-file patch to a single file, and it said it did not support a .patch file I generated using Tortoise SVN.
It took me a while to find which plugin implemented this functionality; I hope it works for someone. Here is a page with a lot more detailed info (someone obviously loves jEdit):
http://taat.pl/en/jedit/
jspraul, I've got a
jspraul, I've got a multi-file patch - can u tell me the secret please? I've wasted a few hours not finding solution for jEdit..
_
See my previous comment: http://drupal.org/node/609976#comment-2175532
I got gnuwin32 patch.exe to
I got gnuwin32 patch.exe to work perfectly on windows 7 x64 in what I feel is the most absurd way ever...
Backstory:
simply put... running it from a .bat file (so I just double click on patch files)... I was plagued by the UAC garbage that everyone else in the world ran across...
The solution:
rename patch.exe to something else... like pch.exe... as long as it doesn't contain the word "patch"... then rename your bat file to also not be "patch" (just for good measure). I haven't tested this on Vista or Win7 x32, but the theory is sound.
BTW, as soon as I rename it back to patch.exe, I have issues with UAC again. Apparently this is some heuristic protection scheme by UAC...
unx utils
you can use this win32 native port of the patch utiltity: http://unxutils.sourceforge.net/
it comes along with a bigger selection of other utilities and in contrast to cygwin and similar it does not need any DLLs or similar. just pick your tiny executeable of choice and store it wherever you want.
simple usage: patch.exe -i [filename]
get more help: patch.exe --help
The life of this thread is amazing :)
Given that this original post was in 2005, and that Windows XP is no longer supported (yippee!), I would strongly recommend that anyone looking for the range of utilities (like patching) offered within linux use a tool like VirtualBox: https://www.virtualbox.org/
It's open source, runs in Mac, Windows, and Linux, and is generally a useful option for a range of development scenarios.
-------
http://www.funnymonkey.com