* Louis Bouchard <louis.bouch...@canonical.com> [141120 10:52]:
> The upstream project I am working on has a new upstream release that I want to
> include in my git-dpm managed git repository[1].
[order of quoted text changed]
> In both cases, I end up with conflicts in the upstream code that I must fix,
> which is not what I expect. In my mind, I should not be touching the upstream
> code *ever*, only doing changes in the ./debian packaging files.

If you have patches and those no longer apply cleanly to upstream, you
will have to adjust them (in the step of rebasing the patches).
Otherwise you should indeed not get any conflicts.

> I have tried the following method :
>  * $ git-dpm import-new-upstream --rebase sosreport_3.2.orig.tar.gz
>  * Rebase my upstream-ubuntu/utopic branch with the new upstream branch
>  and
>  * $ git-dpm new-upstream --rebase sosreport_3.2.orig.tar.gz

Note that --rebase means that you do two steps in one, i.e.

git-dpm import-new-upstream --rebase ../sosreport_3.2.orig.tar.gz

is the same as:

git-dpm import-new-upstream ../sosreport_3.2.orig.tar.gz
git-dpm rebase-patched

The second command calls git rebase with the right commands
to rebase the commits in your pateched branch (your "patches")
onto your new upstream branch.

(Note that git-dpm new-upstream requires that the upstream branch
was already prepared by you before, that's what new-upstream will
be renamed record-new-upstream in future versions).

> Here is an example of a session :
> $ git clone g...@github.com:karibou/sosreport.git
> Cloning into 'sosreport'...
> remote: Counting objects: 13822, done.
> remote: Compressing objects: 100% (3902/3902), done.
> remote: Total 13822 (delta 9459), reused 13808 (delta 9448)
> Receiving objects: 100% (13822/13822), 3.90 MiB | 1.18 MiB/s, done.
> Resolving deltas: 100% (9459/9459), done.
> Checking connectivity... done.
> caribou@marvin:tmpgit$ export PS1="$ "
> $ cd sosreport
> $ git checkout -b pristine-tar origin/pristine-tar
> Branch pristine-tar set up to track remote branch pristine-tar from origin.
> Switched to a new branch 'pristine-tar'
> $ git checkout -b ubuntu/utopic origin/ubuntu/utopic
> Branch ubuntu/utopic set up to track remote branch ubuntu/utopic from origin.
> Switched to a new branch 'ubuntu/utopic'
> $ cat debian/.git-dpm
> # see git-dpm(1) from git-dpm package
> 8c1c48d30d8508d23f06db10ec1c9ece989133f9
> 8c1c48d30d8508d23f06db10ec1c9ece989133f9
> 9ce854d4925b54e829836af3905ee4424935d249
> 9ce854d4925b54e829836af3905ee4424935d249
> sosreport_3.1.orig.tar.gz
> c937644608096bc9b8e8f6d10d5aa1bd83110511
> 164165
> $ git-dpm prepare
> $ git branch
>   master
>   pristine-tar
> * ubuntu/utopic
>   upstream-ubuntu/utopic
> $ git-dpm import-new-upstream --rebase ../sosreport_3.2.orig.tar.gz
> Switched to a new branch 'patched-ubuntu/utopic'
> Rebasing changes in 'patched-ubuntu/utopic' since
> '9ce854d4925b54e829836af3905ee4424935d249' onto 'upstream-ubuntu/utopic'...

Above it says that it is doing the --rebase part. (The verbosity looks a
bit improveable, it doesn't say anything about the import-new-upstream
already done, because there was no error but tells it is rebasing, so
one knows what the following messages are for:)

> First, rewinding head to replay your work on top of it...
> Auto-merging sos/policies/__init__.py
> CONFLICT (content): Merge conflict in sos/policies/__init__.py
> Auto-merging sos/plugins/emc.py
> CONFLICT (content): Merge conflict in sos/plugins/emc.py

The git-dpm rebase-patched command (called by the --rebase option)
found that your old upstream was
and your old patched branch was
so you have some patches, as you
can see with:

$ git log 9ce854d4..8c1c48d

9ce854 confused me a bit as it talked about debian/changelog, but
it looks that debian/changelog was in the upstream git repostory before.

I'd suggest:

First do

git-dpm import-new-upstream -p 3.2 ../sosreport_3.2.orig.tar.gz

This will import the .orig.tar on top of the 3.2 upstream commit
(assuming my guess that 3.2 is the upstream tag in your repository
is correct).

Then do

git-dpm rebase-patched

to let it try to rebase the patches. Those that are already in the
new upstream version you can simply skip.

Then take a look at what you got with gitk or
git log upstream-ubuntu/utopic..HEAD

Correct any remaining problems (sometimes git correctly detects that
something was already applied and then just creates a commit with some
leftovers, for example).

fix them until everything is right, e.g. using

git rebase -i upstream-ubuntu/utopic

until everything is correct.

And then use

git-dpm updates-patches

to merge the new upstream with the new patches on top in the integration
branch (this should not give any conflicts, as update-patches calls
git-dpm merge-patched which just takes .git* and debian/ from the
old debian branch and everything else from the new patched branch
(including the new upstream)).

If everything fails you can always go back to the old
state by removing the upstream-... and patched-... branches
and git reset --hard in the main branch to any previous state.

        Bernhard R. Link
F8AC 04D5 0B9B 064B 3383  C3DA AFFC 96D1 151D FFDC

Git-dpm-user mailing list

Reply via email to