Step 3: Merge the changes in new version

There are two ways you can apply your remaining customization changes to the new GAS version:

  1. Merge changes automatically by applying the patch.
    This method works well when you are working with a "clean" customization. A "clean" customization is a change where:
    • The change is simple and located, and involves the minimum number of snippet files.
    • The change touches the minimum required number of lines. Ideally, the change simply adds new lines.

    A clean customization reduces the migration time and risks of conflict when applying the patch.

  2. Re-apply changes by hand using a text editor.

    This second method is preferred for complex and intrusive customizations that require re-work and/or strong adaptations to be migrated inside new template and snippets set.

Merge Method 1: Apply the patch

  1. Create a copy of the template or snippet that need to be migrated (as you would for a normal template or snippet customization).
  2. Apply the patch to the copied template or snippet.
  3. Change GAS configuration to point to the newly created customized template or snippet.

Example: UNIX™

$ cd /opt/newer-gas/tpl
$ mkdir MyCustomSetAjax/
$ cp SetAjax/Image.xhtml MyCustomSetAjax/Image.xhtml
$ cd MyCustomSetAjax/
$ patch -p NUM < /some/where/Image.xhtml.patch 
patching file Image.xhtml
$
NUM being the number of slashes to strip to find the file. For example with a patch file beginning with:
--- /opt/gas/tpl/SetAjax/Image.xhtml 2009-04-09 11:18:31.000000000 +0200
+++ /opt/gas/tpl/MyCustomSetAjax/Image.xhtml 2009-11-19 12:00:51.000000000 +0100
...
There are 6 slashes in patch first line, thus you have to use patch command line:
$ patch -p 6 < /some/where/Image.xhtml.patch

Example: Windows™

To apply patch on Windows you need the patch for windows tool.

Once the tool is installed, apply the patch with commands:
>set PATH="C:\Program Files\GnuWin32\bin";%PATH%
>cd C:\Program Files\newer-gas
>mkdir MyCustomSetAjax
>copy SetAjax\Image.xhtml MyCustomSetAjax\
        1 file(s) copied.
>patch -p NUM < C:\some\where\Image.xhtml.patch 
patching file Image.xhtml
NUM being the number of slash to strip to find the file. For example with a patch file beginning with:
--- C:/Program Files/gas/tpl/SetAjax/Image.xhtml    Fri Jun 26 16:00:20 2009
+++ C:/Program Files/gas/tpl/MyCustomSetAjax/Image.xhtml    Thu Nov 19 10:29:48 2009 
There are 6 slashes in patch first line, thus you have to use patch command line:
$ patch -p 6 < C:\some\where\Image.xhtml.patch

Resolving conflicts

A patch is not applicable if the same line has been modified both in the new version of snippet and in the customization. In case of a conflict, the patch will comply:
$ patch -p 6 < /some/where/Image.xhtml.patch 
Hunk #1 FAILED at 12.
1 out of 1 hunk FAILED -- saving rejects to file Image.xhtml.rej

A conflict generally means that this change is not simple enough to be applied automatically. The generated file.rej will help you to figure out why that change needs to be adapted. You will have to migrate that change manually.

Merge Method 2: Migrate changes manually

Based on the changes isolated in the patch file, adapt or re-work the changes and apply them as you would for a classic templates or snippets customization.