Applying a patch to source on Windows

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderator: Forum Moderators

Post Reply
Quitch
Posts: 69
Joined: January 10th, 2006, 2:32 pm

Applying a patch to source on Windows

Post by Quitch »

I'm trying to apply the Machine Learning Recruiter patch to 1.11.1 on a Windows 8 machine, but I've run into some issues and I'm looking for help.

I'm using GnuWin32's copy of patch 2.5.9 for this action.

Code: Select all

c:\Users\Quitch\Downloads\wesnoth-1.11.1>"c:\Program Files (x86)\GnuWin32\bin\patch.exe" -p1 -i c:\users\quitch\Downloads\ML_Recruiter_0.4.patch
patching file RELEASE_NOTES
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
Anyone got any experience with this?
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Applying a patch to source on Windows

Post by Max »

do you have TortoiseSVNinstalled? just right click on patch and select "apply patch"
User avatar
lipk
Posts: 637
Joined: July 18th, 2011, 1:42 pm

Re: Applying a patch to source on Windows

Post by lipk »

do you have TortoiseSVNinstalled? just right click on patch and select "apply patch"
That's not going to work with this particular one, I'm afraid (and anyways, Quitch seems to be working with the 1.11.1 tarball, not an SVN checkout). The problem might be that patch thinks that c:\Program Files (x86)\GnuWin32\bin\ is the working directory; try appending this to the command:

Code: Select all

-d c:\Users\Quitch\Downloads\wesnoth-1.11.1
Quitch
Posts: 69
Joined: January 10th, 2006, 2:32 pm

Re: Applying a patch to source on Windows

Post by Quitch »

Thanks for the suggestion, but alas it doesn't appear to work.

Code: Select all

c:\Users\Quitch\Downloads\wesnoth-1.11.1>"c:\Program Files (x86)\GnuWin32\bin\patch.exe" -p1 -i -d c:\users\Quitch\downloads\wesnoth-1.11.1 c:\users\Quitch\Downloads\ML_Recruiter_0.4.patch
c:\Program Files (x86)\GnuWin32\bin\patch.exe: **** File c:\users\Quitch\downloads\wesnoth-1.11.1 is not a regular file -- can't patch

c:\Users\Quitch\Downloads\wesnoth-1.11.1>"c:\Program Files (x86)\GnuWin32\bin\patch.exe" -p1 -i -d c:\users\Quitch\downloads\wesnoth-1.11.1\RELEASE_NOTES c:\users\Quitch\Downloads\ML_Recruiter_0.4.patch
patching file c:\users\Quitch\downloads\wesnoth-1.11.1\RELEASE_NOTES
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

c:\Users\Quitch\Downloads\wesnoth-1.11.1>"c:\Program Files (x86)\GnuWin32\bin\patch.exe" -p1 -i -d c:\users\Quitch\downloads\wesnoth-1.11.1 c:\users\Quitch\Downloads\ML_Recruiter_0.4.patch c:\users\Quitch\downloads\wesnoth-1.11.1
c:\Program Files (x86)\GnuWin32\bin\patch.exe: c:\users\Quitch\downloads\wesnoth-1.11.1: extra operand
c:\Program Files (x86)\GnuWin32\bin\patch.exe: Try `c:\Program Files (x86)\GnuWin32\bin\patch.exe --help' for more information.
I also tried using TortoiseMerge from TortoiseGit to apply the patch, but get the error:

Code: Select all

The patch seems outdated! The file line

and the patchline
[/list]
do not match!
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Applying a patch to source on Windows

Post by Anonymissimus »

lipk wrote:(and anyways, Quitch seems to be working with the 1.11.1 tarball, not an SVN checkout).
Is that the case ? Does your source tree even contain version control information ? (a .svn or .git subdirectory, possibly hidden). I would be surprised if a vcs could do something useful when applying a patch in this case.

Also, git patches and svn patches are not exactly compatible (IIRC with some manual editing I transferred them in both directions).
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Quitch
Posts: 69
Joined: January 10th, 2006, 2:32 pm

Re: Applying a patch to source on Windows

Post by Quitch »

That post lost me a little, so I should just state that the downloaded source has a hidden .git directory
User avatar
Iris
Site Administrator
Posts: 6799
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: Applying a patch to source on Windows

Post by Iris »

Anonymissimus wrote:Also, git patches and svn patches are not exactly compatible (IIRC with some manual editing I transferred them in both directions).
Or just change the number of patch components to strip when applying the patch (-p argument to patch). For patches generated by svn diff, you don’t strip any path components, whereas git diffs require one path component to be stripped. Manual editing is not necessary.

Example:

Code: Select all

$ patch -p0 < ~/svn-generated.diff

Code: Select all

$ patch -p1 < ~/git-generated.diff
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Applying a patch to source on Windows

Post by Max »

you could apply the patch manually, just open the .patch file in a text editor.
it contains a list of modified files. within a file it starts with some text lines before and after the change (makes it easier to find the right spot). '-' marks lines that got removed, '+' lines that were added.

there are four files that didn't exist before (those showing 'revision 0'), you have to create them.
Post Reply