News:

SimuTranslator
Make Simutrans speak your language.

Applying .diff files in Windows

Started by jamespetts, April 24, 2014, 07:55:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

I have had some trouble applying .diff files in Windows, and I should be grateful if anyone is able to describe best how to make it work. This is relevant because TurfIt has been very kindly doing some work on Experimental and prefers to produce .diff files rather than a branch on Github.

I have found and installed the Windows port of the Linux patch tool and added it to the path. However, actually running the tool (from the Windows command line) produces a new white on black text window which hangs and does not do anything. However, when I use the --help switch, the window closes as fast as it opens, which, I think, is strictly the correct (albeit not very helpful) behaviour for the tool.

If anyone has any experience of applying .diff files successfully in a Windows environment, I should be very grateful for any pointers.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Dwachs

the patch command reads from standard input, it usually is invoked by

patch -pn < your.diff

where n is the number of directory prefixes (?) to skip. Svn patches work with -p0, git patches usually -p1.
Parsley, sage, rosemary, and maggikraut.

prissi

Windows 7 has a protection that a program patch is not executed unless you run some registry fix or run patch as admin. Rename patch.exe to pat.exe is the easiest way out. You can have it more complex: http://stackoverflow.com/questions/7914180/windows-7-exe-filename-starts-with-patch-wont-run

jamespetts

I think that I have found a better way of doing it than using patch.exe - using the Git BASH shell that comes with an installation of Git for Windows, I am able to use the patch tool built into that. One needs to use the following format: "patch -p0 -i [patch filename].diff", the "-i" indicating that the file should be used. The "p0" might need to be changed to "p1" or some other numerical value if different software was used to create the .diff file.

Thank you both for your help.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.