bugs, fixes and targeting Juju versions
Hi All, tl;dr `git diff --no-prefix master diff.patch; patch -p0 diff.patch` is useful for landing bug fixes in different versions of juju. As a lot of us are currently bug hunting and needing to land fixes in multiple versions of Juju, I thought I'd share my process of doing that (maybe it's helpful?): So say you've branched master, let's call it bug-fix-master-branch, it's got your fix but you need to land it in 1.24. So branch 1.24, let's call it bug-fix-124, and do the following: # generate a diff of your changes that can be used with patch (--no-prefix master is the magic flag that generates the right format) (bug-fix-master-branch) $ git diff --no-prefix master diff.patch # don't add or commit, checkout the other branch (bug-fix-master-branch) $ git checkout bug-fix-124 # diff.patch is still there, unstaged. So use it to add the patch (bug-fix-124) $ patch -p0 diff.patch # do a sanity check (bug-fix-124) $ git diff # remove the patch file (bug-fix-124) $ rm diff.patch You've now got a bug-fix branch eligible for automatic merging targeting 1.24. Cheers, Jess -- Juju-dev mailing list Juju-dev@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev
Re: bugs, fixes and targeting Juju versions
git cherry-pick does this as a git command. Tim On 05/05/15 13:03, Jesse Meek wrote: Hi All, tl;dr `git diff --no-prefix master diff.patch; patch -p0 diff.patch` is useful for landing bug fixes in different versions of juju. As a lot of us are currently bug hunting and needing to land fixes in multiple versions of Juju, I thought I'd share my process of doing that (maybe it's helpful?): So say you've branched master, let's call it bug-fix-master-branch, it's got your fix but you need to land it in 1.24. So branch 1.24, let's call it bug-fix-124, and do the following: # generate a diff of your changes that can be used with patch (--no-prefix master is the magic flag that generates the right format) (bug-fix-master-branch) $ git diff --no-prefix master diff.patch # don't add or commit, checkout the other branch (bug-fix-master-branch) $ git checkout bug-fix-124 # diff.patch is still there, unstaged. So use it to add the patch (bug-fix-124) $ patch -p0 diff.patch # do a sanity check (bug-fix-124) $ git diff # remove the patch file (bug-fix-124) $ rm diff.patch You've now got a bug-fix branch eligible for automatic merging targeting 1.24. Cheers, Jess -- Juju-dev mailing list Juju-dev@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev
Re: bugs, fixes and targeting Juju versions
Yes, cheery pick is something I use all the time, as it fills out the PR in the latter branches with a nice commit message based on the original and also includes the original PR from which the commit was first done. On 05/05/15 11:45, Jesse Meek wrote: Ah, even better. Now I can update my workflow :) On 05/05/15 13:43, Menno Smits wrote: cherry-pick will even grab the top commit of a branch if you give the branch name (presuming the fix is a single commit). For example: git checkout -b bug-fix-1.24 upstream/1.24 # create a branch for the fix in 1.24 git cherry-pick bug-fix-master-branch # pull the fix across There are various ways of grabbing multiple revisions too. And of course, as per Ian's recent email you should be targeting fixes to the lowest affected version and working forwards. So really in your example the fix should be made for 1.24 and the cherry picked onto a branch made from master. On 5 May 2015 at 13:15, Tim Penhey tim.pen...@canonical.com mailto:tim.pen...@canonical.com wrote: git cherry-pick does this as a git command. Tim On 05/05/15 13:03, Jesse Meek wrote: Hi All, tl;dr `git diff --no-prefix master diff.patch; patch -p0 diff.patch` is useful for landing bug fixes in different versions of juju. As a lot of us are currently bug hunting and needing to land fixes in multiple versions of Juju, I thought I'd share my process of doing that (maybe it's helpful?): So say you've branched master, let's call it bug-fix-master-branch, it's got your fix but you need to land it in 1.24. So branch 1.24, let's call it bug-fix-124, and do the following: # generate a diff of your changes that can be used with patch (--no-prefix master is the magic flag that generates the right format) (bug-fix-master-branch) $ git diff --no-prefix master diff.patch # don't add or commit, checkout the other branch (bug-fix-master-branch) $ git checkout bug-fix-124 # diff.patch is still there, unstaged. So use it to add the patch (bug-fix-124) $ patch -p0 diff.patch # do a sanity check (bug-fix-124) $ git diff # remove the patch file (bug-fix-124) $ rm diff.patch You've now got a bug-fix branch eligible for automatic merging targeting 1.24. Cheers, Jess -- Juju-dev mailing list Juju-dev@lists.ubuntu.com mailto:Juju-dev@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev -- Juju-dev mailing list Juju-dev@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev
Re: bugs, fixes and targeting Juju versions
Ah, even better. Now I can update my workflow :) On 05/05/15 13:43, Menno Smits wrote: cherry-pick will even grab the top commit of a branch if you give the branch name (presuming the fix is a single commit). For example: git checkout -b bug-fix-1.24 upstream/1.24 # create a branch for the fix in 1.24 git cherry-pick bug-fix-master-branch # pull the fix across There are various ways of grabbing multiple revisions too. And of course, as per Ian's recent email you should be targeting fixes to the lowest affected version and working forwards. So really in your example the fix should be made for 1.24 and the cherry picked onto a branch made from master. On 5 May 2015 at 13:15, Tim Penhey tim.pen...@canonical.com mailto:tim.pen...@canonical.com wrote: git cherry-pick does this as a git command. Tim On 05/05/15 13:03, Jesse Meek wrote: Hi All, tl;dr `git diff --no-prefix master diff.patch; patch -p0 diff.patch` is useful for landing bug fixes in different versions of juju. As a lot of us are currently bug hunting and needing to land fixes in multiple versions of Juju, I thought I'd share my process of doing that (maybe it's helpful?): So say you've branched master, let's call it bug-fix-master-branch, it's got your fix but you need to land it in 1.24. So branch 1.24, let's call it bug-fix-124, and do the following: # generate a diff of your changes that can be used with patch (--no-prefix master is the magic flag that generates the right format) (bug-fix-master-branch) $ git diff --no-prefix master diff.patch # don't add or commit, checkout the other branch (bug-fix-master-branch) $ git checkout bug-fix-124 # diff.patch is still there, unstaged. So use it to add the patch (bug-fix-124) $ patch -p0 diff.patch # do a sanity check (bug-fix-124) $ git diff # remove the patch file (bug-fix-124) $ rm diff.patch You've now got a bug-fix branch eligible for automatic merging targeting 1.24. Cheers, Jess -- Juju-dev mailing list Juju-dev@lists.ubuntu.com mailto:Juju-dev@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev -- Juju-dev mailing list Juju-dev@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev