Page 1 of 40

Howto apply a patch/diff file

Posted: 29 Oct 2005 10:15
by Bjarni
Patching (applying a patch/diff file) is done to OpenTTD's sources. This implies that you have to get the sources to apply the patch/diff and compile OpenTTD yourself.


So the first step is acquiring the source code. It can be found in the same place you found the binary under "source".


Now you can start the patching:

first of all: .patch and .diff is the same. It doesn't matter. We could call them .this_is_my_patch_file too if we want to. It's just a name (ok, some app apart from patch might not like it)

on most systems:

Code: Select all

patch -p0 -i file.diff
the -p option means how many leading dirs that you skip when patching. Usually it's 0, but sometimes some odd patch uses a different number. You can learn this by reading the first line of the diff file

Code: Select all

Index: src/video/dedicated_v.cpp
this would be 0

Code: Select all

Index: trunk/src/video/dedicated_v.cpp
this would be 1, because you need to skip the trunk part of it to get to the root dir of your local source folder

-i tells what file you want to patch from, in this case the file named file.diff

There are some other apps to do this on windows. I don't know them, so somebody else have to write how to use them. Patch works in cygwin too.

Posted: 29 Oct 2005 12:03
by Darkvater
I usually use

Code: Select all

patch -p0 < file.diff
but it's personal :).
Usually however all patches are made from SVN so you would use TortoiseSVN to apply the diff.

patch.exe also exists on windows (look for gnu-tools); you only need to make sure that the patch file is in windows format. Eg CR/LF line-endings, otherwise patch will crash. You can do this with any decent text-editor like UltraEdit. Use File -> Conversions -> UNIX/MAC to DOS.

Posted: 30 Oct 2005 04:05
by Conditional Zenith
While there are more answers that just this one, this wiki page has this info.

Posted: 24 Nov 2005 08:32
by MeusH
If you're using windows, you can download TortoiseSVN, install and do the following:

Download the source files:
Make a new folder
Right click on it
Choose "SVN Checout..." from the menu
Set data fields like on attachement 1
Hit OK, wait 5-20 minutes for all files to download

Choose the diff file:
Right click on folder you've downloaded files to
Choose "TortoiseSVN > Apply Patch..." from the menu
Browse for .patch or .diff file

Apply the changes:
Usually, right clicking on filelist window (attachement 2) and clicking "Patch all" should work, but sometimes there is something wrong (attachement 2 - files marked red):

Don't worry, often application will download other revision and everything will work.
However, if you're experiencing problems (marked red) ask patch developer and tell him what's wrong. Tell him what diff file have you downloaded and what revision have you downloaded using "SVN Checkout"


Happy patching :)

Patches...

Posted: 12 Jan 2006 19:09
by Benbo
I'm kind of new at doing this, (actully, it's my first time...) and I'm asking whether this kind of 'coding' is done in Command? I don't know where to write the stuff into. I presume it is Command.

When I say the 'code', I mean this...

Code: Select all

patch -p0 -i file.diff

Posted: 12 Jan 2006 19:24
by webfreakz.nl
You have to type it in the linux commandline (also called Linux Box like Bash) in the current directory, otherwise it won't be able to apply the patch 'file.diff' :)

Posted: 12 Jan 2006 20:31
by egladil
Or, if you are using windows, just read what MeusH wrote right above your post.

Posted: 18 Jan 2006 19:18
by Benbo
I seem to have endless problems with that and I just simply want to know, using Windows do I need to use command to do it or what? What program do I type that code in :?:

Posted: 18 Jan 2006 20:34
by egladil
If you are using windows, you don't type any code in anywhere. As I said, you do as MeusH said and download TortoiseSVN and follow his instructions.

Posted: 18 Jan 2006 20:37
by MeusH
*deleted*

Egladil was faster ;) Thx

Posted: 19 Jan 2006 08:28
by Benbo
See I've been searching the site for the download for Win 98 and I can't find it anywhere. I have downloaded different versions, but they have different problems, so if someone coud point me in the direction of the version for Win 98 and they know that it'll work on Win 98 then i would be very grateful :wink:

Posted: 19 Jan 2006 08:36
by egladil
http://tortoisesvn.tigris.org/download.html wrote:NOTE: If you need to use TortoiseSVN with Windows 95/98/Me/NT4 then you will need to use a pre-1.2 version. The last release on the 1.1.x line was 1.1.7. Read the 1.2 Release Notes to find out why we have had to drop support for these older operating systems.
So either look in their archive, or even better, upgrade your OS if possible.

Hmm...

Posted: 19 Jan 2006 19:35
by Benbo
I had read that, and gone through the archives and looked for version 1.2. Couldn't find it. So I decided that the versions before it would work on 98 too. I have tried several versions, and mostly come up with the same problems.

I just tried version 1.1.4 and when I went to install it, it said to me
SVN wrote:The installer needs an NT based OS
What??? I thought that this was supposed to work on 98 too...

Posted: 19 Jan 2006 19:41
by webfreakz.nl
WTF, why do you work on Win98(se)? Just install Win2000 then, much better, more stable and it does have a NT engine.

Posted: 19 Jan 2006 19:57
by MeusH
webfreakz.nl, win 98 has its advantages over 2000.

Benbo, we shall look for other SVN clients/tools. Google probably :)

Posted: 20 Jan 2006 08:45
by bobingabout
there are s*** of things you can't do in the NT engine.

for example, here at college, we've just had to make a bunch of MS-DOS boot disks to run out logic analyser software, because it doesn't run under windows 2000.

and this isn't exactly something you can just go out and buy a replacement for.

Posted: 20 Jan 2006 10:30
by Brianetta
webfreakz.nl wrote:Just install Win2000 then...
Are you offering to pay? Windows is hardly cheap.

Posted: 20 Jan 2006 11:59
by webfreakz.nl
Brianetta wrote:
webfreakz.nl wrote:Just install Win2000 then...
Are you offering to pay? Windows is hardly cheap.
Did I say he has to buy Win2k? :P

Posted: 20 Jan 2006 14:48
by Benbo
Well else do I get it then???

Posted: 20 Jan 2006 17:38
by MeusH
Warez and illegal software is not tolerated here. I'd google for SVN client...