Backporting with magit

Ceph uses GF-Complete stable branch (v1). Modifications required by Ceph were proposed to the master branch. While waiting for the corresponding pull request to be reviewed, a temporary branch (v1-ceph) was created in the Ceph name space for immediate use. The changes have been accepted in master, they are to be backported to v1

The ceph remote contains an exact copy of the jimplank remote which is also the upstream. The loic remote is used to push branches to be used in pull requests against the jimplank remote. git-cherry(1) shows which commits are not yet backported, using the y keyboard shortcut.

The commits with + in the first column are in master (the Head) and missing from v1 (the Upstream in the sense that it is the destination of the backport). Figuring out what deserves to be backported and what does not is for the person with merge rights on the jimplank remote to decide. A branch is created localy to backport the do not compile if used in SSE4 code path only commit with b c which translates into:

/usr/bin/git --no-pager -c core.preloadindex=true \
   checkout -b wip-sse4-v1 refs/remotes/jimplank/v1

The command matching the magit keyboard shortcut can be shown with $ magit-process. The commit hash is copied with C-w magit-copy-item-as-kill and cherry picked with : magit-git-command which translates into

/usr/bin/git --no-pager -c core.preloadindex=true \
   cherry-pick -x d569220

There is no keyboard shortcut for cherry-pick -x at the moment. The *magit-branches* buffer shows:

ec90d25 * wip-sse4-v1 [v1 @ jimplank:ahead 1]

The branch is pushed to the loic repository with C-u P P which translates into

/usr/bin/git --no-pager -c core.preloadindex=true \
  push -v loic wip-sse4-v1

The web interface is then used to issue a pull request against the jimplank remote. The name of the topic branch starts with wip- and ends with -v1 to make it easy to identify v1 backport branches.

Sometime two identical commits only differ because of the context and are missed by git-cherry which relies on git patch-id. The details of the difference can be showed with ediff-files on each commit.