lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 1/12/2016 12:59 AM, Jonathan Goble wrote:
Creating and applying patches is something I have no clue how to do on
Windows. I do have an Ubuntu machine on which I could figure it out,
but it mostly just acts as a server for bot scripts to run on. My
Windows 10 computer with Visual Studio 2015 Community Edition is what
I do my code development on.

A patch is primarily the output of one of many versions of the diff(1) command. If you already use Git, you will almost certainly have a flavor of diff that will do the job as part of Git.

Outside of Git, diff(1) and patch(1) have reasonable Windows ports that work just fine at the Windows command prompt (i.e., not requiring the heavy burden of a fake Unix emulation layer like Cygwin). One source is the stale but still workable GnuWin32 project.


If you go down that path, you might want to pick up Gnu Make and any other classic Unix tools like grep. See the full list of packages they've ported here:

How would I go about creating and applying patches in Windows? If I
can figure that out, then I'll work on the rock later this week. The
script to extract the code is something I can figure out on my own.

The usual recipe to create a patch is to compare source folders with "diff -uNr path/to/old path/to/new >patch.txt". The -u option formats the differences as a "unified" diff which provides context for each change in a way that allows patch to be confident that it is making valid changes. The -N option treats a missing file as "empty", so that a new file will get included in a patch verbatim. The -r option recurses down the directory tree.

You will want to review the patch file itself to make sure it doesn't contain any surprises before you publish it.

The patch utility will consume a source tree and a patch file and make all the edits. It works startlingly well.

Ross Berteig                     
Cheshire Engineering Corp. 
+1 626 303 1602