Now we can actually start porting the remaining commits. git-cherry-menu provides an interactive interface to make this process less tedious:

$ git cherry-menu -h usage: git [options] cherry-menu <command> [<args>...] suggested options: [... snipped ...] <command> <args> are typically "git icing -v3" or "git cherry", but can be anything which gives output in the same format. This allows more control over which commits constitute the upstreaming backlog, e.g. git icing -v2 $upstream $downstream | grep ... > tmpfile # Could edit tmpfile here if we want git-cherry-menu cat tmpfile Provides an interactive wrapper around git-icing (or git cherry). For each commit provided on STDIN by COMMAND which has not yet been upstreamed, asks the user whether they want to cherry-pick the commit, blacklist it, or skip it. After a successful cherry-pick, the source commit will be automatically blacklisted if the patch-id changed. You can quit the process at any time and safely re-run it later - it will resume from where you left off. Invoking icing with "-v2" ensures that previously blacklisted / upstreamed commits are also processed.

Let’s give it a go …

$ git cherry-menu git icing -v3 stable/grizzly to-backport commit 348cfedfcadc377fa91029b932b2a93d16475822 Author: Zhiteng Huang <zhiteng.huang@CENSORED.com> Date: Tue Feb 26 09:23:13 2013 +0800 nova-manage: remove redundant 'dest' args Includes a hack to calculate 'dest' from the argument name. This hack is removed in a later commit. Change-Id: I60567ff232ab7699f3234b3bfc1618a17a648976 diff --git a/bin/nova-manage b/bin/nova-manage index 0fde8ba..4919d88 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -127,10 +127,10 @@ def param2id(object_id): class VpnCommands(object): """Class for managing VPNs.""" - @args('--project', dest="project_id", metavar='<Project name>', + @args('--project', dest='project_id', metavar='<Project name>', [... snipped ...] Cherry-pick / blacklist / skip 348cfedfca, or quit ?

It’s showing us the first commit in the porting backlog, and asking us to decide whether to cherry-pick it, blacklist it (i.e. permanently exclude it from the porting process), or defer the decision by skipping it and moving onto the next commit in backlog. ( q quits the whole process, of course.)

Let’s try cherry-picking it:

Cherry-pick / blacklist / skip 348cfedfca, or quit ? c error: could not apply 348cfed... nova-manage: remove redundant 'dest' args hint: after resolving the conflicts, mark the corrected paths hint: with 'git add <paths>' or 'git rm <paths>' hint: and commit the result with 'git commit' Spawning a shell so you can fix; exit the shell when done. $

Oh dear, this one’s going to need some further thought. Let’s skip it for now:

$ git reset --hard HEAD is now at ddb676d Merge "Typo: certicates=>certificates in nova.conf" $ exit Warning: HEAD did not change; no action taken. Press enter to continue ... ----------------------------------------------------------------------- commit f16534db22d63ce9f762ee6f7a9245126e9f28ed Author: Zhiteng Huang <zhiteng.huang@CENSORED.com> Date: Tue Feb 26 09:23:13 2013 +0800 nova-manage: remove unused import Unused since commit 9ff3121b Change-Id: I76bb49669d1cdfc3bf5b1c20087b4bd77420cd91 diff --git a/bin/nova-manage b/bin/nova-manage index 4919d88..e93c3d8 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -88,7 +88,6 @@ from nova.openstack.common import timeutils from nova import quota from nova.scheduler import rpcapi as scheduler_rpcapi from nova import servicegroup -from nova import utils from nova import version CONF = cfg.CONF Cherry-pick / blacklist / skip f16534db22, or quit ?

cherry-menu presents the next commit in the backlog, which in this case is removing an unused import from bin/nova-manage . Sounds pretty straight-forward, so let’s cherry-pick:

Cherry-pick / blacklist / skip f16534db22, or quit ? c [stable/grizzly 3f013e4] nova-manage: remove unused import Author: Zhiteng Huang <zhiteng.huang@CENSORED.com> 1 file changed, 1 deletion(-)

Looks like this worked fine. The output continues:

----------------------------------------------------------------------- Already upstream: 775e3b02b2 - Pass project id in quantum driver secgroup list

Here cherry-menu is telling us it automatically skipped over a commit which is already in our target branch. The output continues with the next commit in the backlog, which we can also successfully pick:

commit dbbbbf4ecb2c7b03ebb30fa11e077d35b2186cbb Author: Clark Boylan <clark.boylan@CENSORED.com> Date: Thu Feb 7 21:39:31 2013 -0800 Enable tox use of site-packages for libvirt. Enable the use of site-packages in tox which will allow the use of the system install of libvirt while testing. Hardcode the libvirt host UUID for tests that check this UUID when system libvirt is being used. Without this hardcoding eight tests would fail when using the system libvirt install. Partially fixes bug #1113181 Change-Id: I59c5fbd45639962c0963298203c39759b6ca2d11 [... snipped ...] Cherry-pick / blacklist / skip dbbbbf4ecb, or quit ? c [stable/grizzly b4fdf14] Enable tox use of site-packages for libvirt. Author: Clark Boylan <clark.boylan@CENSORED.com> 2 files changed, 8 insertions(+) ----------------------------------------------------------------------- Already upstream: 76844433f6 - Add caching for ec2 mapping ids. commit def5fa1e0e1c0426d973e4d8e3935c6eb18698dc Author: Thierry Carrez <thierry@CENSORED.org> Date: Wed Mar 20 16:21:48 2013 +0100 Set version to 2013.2 Open Havana development by setting version to 2013.2. Change-Id: I37917d28a1f9e0adc2fe3e382412ebc4ed0f3bee diff --git a/setup.py b/setup.py index fd968ee..e4bc7d4 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setuptools.setup( name=project, - version=common_setup.get_version(project, '2013.1'), + version=common_setup.get_version(project, '2013.2'), description='cloud computing fabric controller', author='OpenStack', author_email='nova@CENSORED.launchpad.net', Cherry-pick / blacklist / skip def5fa1e0e, or quit ?

Now, obviously we don’t want to backport this version change, so let’s blacklist it in order to permanently excluded it from the porting backlog:

Cherry-pick / blacklist / skip def5fa1e0e, or quit ? b

At this point, your favourite $EDITOR will be launched via an invocation of git notes edit , and you’ll be presented with a text buffer which looks like this:

skip: all XXX (you can optionally change the "all" above to the name of the XXX upstream branch if you want to limit blacklisting to that upstream) XXX Enter your justification for blacklisting here or XXX remove the whole note to cancel blacklisting. # # Write/edit the notes for the following object: # commit def5fa1e0e1c0426d973e4d8e3935c6eb18698dc # Author: Thierry Carrez <thierry@CENSORED.org> # Date: Wed Mar 20 16:21:48 2013 +0100 # # Set version to 2013.2 # # Open Havana development by setting version to 2013.2. # # Change-Id: I37917d28a1f9e0adc2fe3e382412ebc4ed0f3bee # # setup.py | 2 +- # 1 file changed, 1 insertion(+), 1 deletion(-)

At this point you should remove all the lines beginning XXX , and decide whether you want this commit to be blacklisted from any future porting operation. If so, you can leave the skip: all line as is and simply save the buffer and quit the editor, although it’s best practice to also give a sentence or two justifying why you’re blacklisting the commit.

Alternatively you can change all to the name of the branch to which this commit should never be ported, which in this case is stable/grizzly . It is also permitted to use Ruby regular expressions here, by surrounding the regexp with forward slashes, e.g.

skip: /stable/ It never makes sense to port version number changes back to stable releases.

Once the editor has been quit, we see:

Blacklisted def5fa1e0e Press enter to continue ...

Behind the scenes, cherry-menu has attached a note to this commit within the refs/notes/upstreaming namespace:

$ git notes --ref=upstreaming show def5fa skip: all

and you can even see the complete history of your note-editing:

$ git log notes/upstreaming commit ed6cf5fa75921f23088656b7a8d8a96faa9d769d Author: Adam Spiers <aspiers@CENSORED.com> Date: Fri Sep 20 15:59:04 2013 +0100 Notes added by 'git notes edit' commit c1f6ba13e643de4da354375b479470599f92b272 Author: Adam Spiers <aspiers@CENSORED.com> Date: Fri Sep 20 15:44:15 2013 +0100 Notes added by 'git notes add' [... snipped ...]

After all this hard work, maybe it’s time for lunch. We can safely quit cherry-menu via Control-C or q , and resume it later. Before tucking into a tasty sandwich, let’s quickly review our progress:

$ git icing -v3 -s stable/grizzly to-backport + 348cfedfcadc377fa91029b932b2a93d16475822 nova-manage: remove redundant 'dest' args - f16534db22d63ce9f762ee6f7a9245126e9f28ed nova-manage: remove unused import - 775e3b02b2afbf101db22b87a1c3b189d68532e1 Pass project id in quantum driver secgroup list - dbbbbf4ecb2c7b03ebb30fa11e077d35b2186cbb Enable tox use of site-packages for libvirt. - 76844433f69a7c29ed4566ad34d7e9740feaf660 Add caching for ec2 mapping ids. . def5fa1e0e1c0426d973e4d8e3935c6eb18698dc Set version to 2013.2 + 3aa80834e6aab2456f0f5229a63c2dcef007cb36 Change type of ssh_port option from Str to Int + 26aa01094a79939320d58f2fe2d5731f169987b1 Change arguments to volume_detach() [... snipped ...] Summary ======= 14 commits processed: 13 already upstream 1 blacklisted - should not be pushed to this upstream 15 commits remaining: 15 not yet upstream Progress: 14 / 29 commits (48%)

Wow, almost half-way! Notice also how the prefix by def5fa1 has changed to a period sign to indicate that it’s now blacklisted.

After lunch, we can resume the process:

$ git cherry-menu git icing -v3 stable/grizzly to-backport commit 348cfedfcadc377fa91029b932b2a93d16475822 Author: Zhiteng Huang <zhiteng.huang@CENSORED.com> Date: Tue Feb 26 09:23:13 2013 +0800 nova-manage: remove redundant 'dest' args [... snipped ...] Cherry-pick / blacklist / skip 348cfedfca, or quit ?

This is the same commit which caused conflicts last time we tried to pick it. Let’s officially postpone resolving conflicts by adding it to a “TODO” blacklist. Press b , then as before, remove the XXX , and also replace the skip: all line with:

TODO: fix conflicts next week

Blacklisted 348cfedfca Press enter to continue ... ----------------------------------------------------------------------- Already upstream: f16534db22 - nova-manage: remove unused import Already upstream: 775e3b02b2 - Pass project id in quantum driver secgroup list Already upstream: dbbbbf4ecb - Enable tox use of site-packages for libvirt. Already upstream: 76844433f6 - Add caching for ec2 mapping ids. Blacklisted: def5fa1e0e - Set version to 2013.2 commit 3aa80834e6aab2456f0f5229a63c2dcef007cb36 Author: Devananda van der Veen <devananda.vdv@CENSORED.com> Date: Wed Mar 20 09:19:44 2013 -0700 Change type of ssh_port option from Str to Int The type of CONF option virtual_power_ssh_port was incorrectly defaulted to Str. This can cause Paramiko to raise when casting to %d. Fixes bug 1157824. Change-Id: I30ddd1ff0da45f8392085249f1bd2a539b201a7e

Now we are taken immediately to where we left off just before lunch, because git-icing automatically detected the cherry-picks we did earlier, and also that we blacklisted the 2013.2 version change commit.

If we run git-icing again, we’ll see that it understands the significance of the TODO attached to the first commit in the backlog:

$ git icing -v3 -s stable/grizzly to-backport ! 348cfedfcadc377fa91029b932b2a93d16475822 nova-manage: remove redundant 'dest' args - f16534db22d63ce9f762ee6f7a9245126e9f28ed nova-manage: remove unused import - 775e3b02b2afbf101db22b87a1c3b189d68532e1 Pass project id in quantum driver secgroup list [... snipped ...] Summary ======= 14 commits processed: 13 already upstream 1 blacklisted - should not be pushed to this upstream 15 commits remaining: 14 not yet upstream 1 still needs to be upstreamed, tracked on a TODO list Progress: 14 / 29 commits (48%)

On subsequent invocations of git cherry-menu , it will offer the option of editing existing notes. There is also an option to automatically skip any notes including the word TODO :

$ git cherry-menu -h usage: git [<options>] cherry-menu <command> [<args>...] suggested options: [... snipped ...] -c cherry-menu.skip-todos=true Skip commits which have notes including 'TODO'. This allows unresolved upstreaming tasks to be tracked via an external issue tracker without getting in the way during repeated runs of cherry-menu. [... snipped ...]

So that’s the majority of cherry-menu ‘s functionality explained. It’s not rocket science, just a quick hack of a shell-script, but it gets the job done pretty well.

There’s one more important feature I didn’t cover: if the patch-id changes during cherry-picking, cherry-menu will notice, and automatically add the old commit to the blacklist: