confused about rebase

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Nov 22 03:23:39 CST 2010


On Sun, 21 Nov 2010 17:37:02 -0500, Neal Becker <ndbecker2 at gmail.com> wrote:
> I have boost_1_44_0.dist which is the upstream hg repo
> I have boost_1_44_0.hg which is the upstream, with my patches added.
>
> I updated to boost_1_45_0.dist by:
> <extract tar file to new dir boost_1_45_0.dist>
> cp -al boost_1_44_0.dist/.hg* boost_1_45_0.dist
> cd boost_1_45_0.dist
> hg addremove
> hg ci
>
> everything looks good - I have a boost_1_45_0.dist matching upstream
>
> Now
> cp -al boost_1_45_0.dist boost_1_45_0.hg
> cd boost_1_45_0.hg
> hg pull --rebase ../boost_1_44_0.hg  <<< pull in my patches

What does 'hg glog --limit 10' show here?  You should see your old
boost_1_44_0.dist history, with your boost_1_44_0.hg local commits as
one head, and then a new head with the boost_1_45_0.dist commit, e.g.:

    @    12     466b9a02640c   2010-11-07 13:07 +0100   ndbecker2
    |      import boost 1.45.0 sources
    |
    | o  11     77fb285a2e35   2010-11-05 09:13 +0100   ndbecker2
    | |    local patches on top of boot 1.44.0
    | |
    | |
    |/
    |
    o    10    5b331fa555a7   2010-11-05 08:39 +0100   gkeramidas
    |      import boost 1.44.0 sources
    :
    :

When you have two heads like these, you can rebase the changes from
11:77fb285a2e35 on top of the new boost import.

Note that for vendor sources like these, I'd probably *AVOID* rebase
though.  You lose merge history when you rebase the local patches on top
of newer releases of boost.

For thirdparty sources like boost, I'd probably use "hg merge"
repeatedly and aim for a history like this:

    o       merge of local changes with boost-1.45
    |\
    | \
    |  |
    o  |     import of boost 1.45.0
    |  |
    |  |
    |  o     local changes on top of boost 1.44.0
    |  /
    | /
    o'       import of boost 1.44.0
    |
    :

This way you can 'see' later on when the merge of 1.45.0 was done, who
did it, what changes they committed to merge the local version of boost
with the upstream vendor source, etc.

The left-hand side of the graph above is essentially a 'vendor branch',
tracking the upstream releases.  You can even use a *named* branch for
this, by importing the original boost-1.44.0 sources in a 'boost'
branch.  Then you can keep importing the boost releases into the 'boost'
branch and merging the new releases into your 'default' branch, e.g. by:

    # import a new snapshot of the boost sources in the boost branch

    hg update --clean boost
    rm -fr lib/boost
    tar xzvf /tmp/boost-1.45.0.tgz && mv boost-1_45_0 lib/boost
    hg addremove lib/boost
    hg commit -m 'Import boost 1.45.0 release'

    # merge the boost release into the default branch

    hg update --clean default
    hg merge boost
    hg commit -m 'Merge boost 1.45.0 into mainline'



More information about the Mercurial mailing list