#24 need help with diff (please just some advice)

closed
J. Ali Harlow
None
5
2012-08-16
2012-08-16
ozma
No

I know that dev team nethack/slashem staff and other coders will find this very funny but....

I am not a coder, I just made a bunch of changes to the slashem source and I am close to having a MEGA new version of slashem..

Only problem is,,, I have literally NO idea how to make a patch or diff of my changed source against the original source.

Is there some file for MinGW I need to create patch/diff files with? or... Is there a built in windows/dos command that can make them?
Or do I need to download some sort of file that will do this?

I know it is silly to not know how to make a patch but as I said I have never done this before.
I have maybe 3 months left until this thing is totally done and tested and I would rather upload a patch instead of the compiled (for win32) and source (because it will be huge for an upload).

Discussion

  • J. Ali Harlow
    J. Ali Harlow
    2012-08-16

    The program to create a patch/diff is called "diff", and the program to apply a patch/diff is called "patch". You need a win32 executable of diff (which I'm sure the MinGW project would either provide, or provide a link to). I'm afraid I do all my development work under Linux, so I can't be of more help.

     
  • J. Ali Harlow
    J. Ali Harlow
    2012-08-16

    • assigned_to: nobody --> j_ali
    • status: open --> closed
     
  • George Koehler
    George Koehler
    2012-08-16

    You can find diff.exe and patch.exe in MSYS (available from http://www.mingw.org/\). If MinGW is in C:\MinGW, then diff.exe and patch.exe will be in C:\MinGW\msys\1.0\bin. If you installed MinGW without MSYS, then you can add MSYS by running "mingw-get msys-base".

    Another way is to get diff.exe and patch.exe from GnuWin (http://gnuwin32.sourceforge.net/). I have never used GnuWin, but diff.exe should be in DiffUtils package, and patch.exe in Patch package.

    Prepare two copies of SLASH'EM: an original copy (slashem-0.0.7E7F3 or slashem-0.0.8E0F1, or whatever version you started with) and a copy with your changes. I will call these slashem-orig and slashem-mod. If slashem-mod has compiled files (like .o and .exe), delete them with

    > cd slashem-mod\src
    > mingw32-make spotless
    > del Makefile

    (That might not be exactly right; I have never compiled slashem for Windows, so I am not sure of the exact commands.)

    To create the patch, run
    > diff -druN slashem-orig slashem-mod > fun-stuff.diff

    (Instead of slashem-orig, a better name is slashem-0.0.7E7F3 or slashem-0.0.8E0F1, so hackers who read your patch can see the original version number.)

    You might want to test the patch. Make another copy of slashem-orig (I call this slashem-test) and apply the patch there.

    > cd slashem-test
    > patch -p1 < ..\fun-stuff.diff

    After this, slashem-mod and slashem-test should have the same files, and compiling slashem-test should work.

     
  • ozma
    ozma
    2012-08-16

    thanks I didn't install msys so I didn't have it but now I do...with some luck I might be able to complete a patch of this project when it is finished in a few months.