Skip to content

Instantly share code, notes, and snippets.

@peterfpeterson
Last active February 26, 2016 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterfpeterson/341aeeebfe74b850bb8b to your computer and use it in GitHub Desktop.
Save peterfpeterson/341aeeebfe74b850bb8b to your computer and use it in GitHub Desktop.
Creating the mantid 3.5.1 patch release

The problem

This example explains how to merge 4f894cb54 into the release-v3.5.0 branch.

Normally patch releases are done via either merging the feature branch in to the release branch, or by cherry-picking the individual commits into the release branch. In this case the source files were moved by (in general terms) removing the Code/Mantid levels of the repository to be more consistent with other CMake based projects. The effect is that changes made based off of master cannot be simply cherry-picked into the release branch.

The hard way

Here is a cumbersome way to "make it work."

  1. git format-patch 4f894cb54b0f9c5c2fe9629876289f0180f2c8a4 -1 will generate a patch file called 0001-Updating-Mantid.properties.template.patch
  2. Edit 0001-Updating-Mantid.properties.template.patch and change all occurences of Framework/Properties with Code/Mantid/Framework/Properties
  3. Apply the patch using the original commiter's information git am 0001-Updating-Mantid.properties.template.patch
  4. Declare victory
$ git log -n 2
commit 61f65e2b7a03005531a1d99fad5198ad98709bc3
Author: Andrei Savici <saviciat@ornl.gov>
Date:   Tue Nov 3 15:08:12 2015 -0500

    Updating Mantid.properties.template
    
    Fixes #14260

commit 2d851e28b2f0763329ca4dc763a9af1ca5872b4e
Author: Pete Peterson <petersonpf@ornl.gov>
Date:   Tue Nov 3 14:58:28 2015 -0500

    Commenting out patch version

This was modified from this stack overflow answer.

Easier way

In this particular case there is a --directory argument that can be supplied to git-am to help track down the file to patch. This changes the process to

  1. git format-patch 4f894cb54b0f9c5c2fe9629876289f0180f2c8a4 -1 will generate a patch file called 0001-Updating-Mantid.properties.template.patch. If you want a bunch of commits, use the --start-number option to create them all then apply using normal globbing.
  2. Apply the patch using the original commiter's information git am --directory=Code/Mantid 0001-Updating-Mantid.properties.template.patch
  3. Declare victory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment