Importing a new upstream version

To update your patches for a new upstream version one

  1. Imports the current patches onto the patch-queue branch (if not done already) using gbp pq import. This will allow you to rebase the patches on the new upstream version later.

  2. Imports the new upstream version with gbp import-orig --uscan.

  3. Rebases the patches onto the new upstream version using gbp pq rebase. This will bring the patches up to date regarding the new upstream version. Patches already applied upstream can be dropped and remaining patches can be modified to apply to the new version.

  4. Exports the patches to debian/patches using gbp pq export.

But don't worry if you forgot to do so before importing the new version (or if another team member imported the version already).

In this case you can make gbp pq figure out where to apply the patches by using the --time-machine= option. The following command

    gbp pq import --force --time-machine=10

would drop your current patch-queue branch (if existent) and create a new one by going back in your commit history as far as 10 commits to find a place where your patches still apply [3]. If it finds such a commit on your debian-branch it will create the patch-queue branch from there and switch you to that branch. You can now rework your patches to apply to the new upstream version by using gbp pq rebase:

The patch-queue branch and debian-branch after importing the patches.

    gbp pq rebase

or you can invoke git rebase directly:

    git rebase -i debian/latest

Should the rebase fail (e.g. because the upstream source changed at the same place your patches modify the code) you can resolve this by using the options of git rebase (if you simply want to abort use git rebase --abort).

The patch-queue branch after rebasing the patches. Patches that were merged upstream were dropped.

Once done you can export your commits to patch files again:

  gbp pq export --commit

The export will also switch you back to the debian-branch.

The debian-branch after exporting the patches and committing the changes.

See this in action in a short video.



[3] This is not necessarily your debian-branch; HEAD since the new upstream version might have changed so that the patches no longer apply cleanly there.