Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close
Softrebase extension is a thin wrapper on top of rebase command which
recomputes the destination node so reaching the desired destination will
take several softrebase runs but each of them should cause simpler and
more meaningful merges.

Say you want to rebase a set of revisions REVS on top of a changeset X.
A regular rebase call would merge each changeset in REVS with X and the
common ancestor of X and REVS. If many changes were made to content
touched by REVS you will have to know all the changes which happened to
successfully rebase your revisions. A softrebase call will instead find
the first changeset Y on the path between REVS and X which changes
intersect the changes in REVS and rebase on it.  Obviously, you will
need several calls to softrebase to reach X but each of them will
require you to know only about the changes brought by the intermediate Y
to resolve the merge.

Note: softrebase interface may be improved and change in the future.

Initialize a test repository

    $ hg init repo
    $ cd repo
    $ echo a > a
    $ hg ci -Am 'add a'
    adding a
    $ echo b >> a
    $ hg ci -Am 'append b'
    $ echo c >> a
    $ hg ci -Am 'append c'
    $ hg log -G --template '{rev}:{node|short} {desc}\n'
    @  2:5a9aaaa34af0 append c
    |
    o  1:7415b0fde5c7 append b
    |
    o  0:27b53ea0b53c add a

Add a conflicting branch

    $ hg up -C 0
    1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    $ echo d >> a
    $ hg ci -m 'append d'
    created new head

Call softrebase. Use a nodeidentifier as the revision numbers are going
to change between each rebase call. Note that despite asking a rebase
onto the other branch head, softrebase actually targets an intermediate
changeset.

    $ hg sreb -d 5a9aaaa34af0
    rebasing onto:
    changeset:   1:7415b0fde5c7
    user:        Patrick Mezard <patrick@mezard.eu>
    date:        Sun Oct 21 17:41:12 2012 +0200
    summary:     append b

    merging a
    $ hg log -G --template '{rev}:{node|short} {desc}\n'
    @  4:25ee841b4a7b append d
    |
    | o  2:5a9aaaa34af0 append c
    |/
    o  1:7415b0fde5c7 append b
    |
    o  0:27b53ea0b53c add a

Repeat the previous command. This time we reach destination.

    $ hg sreb -d 5a9aaaa34af0
    merging a
    $ hg log -G --template '{rev}:{node|short} {desc}\n'
    @  5:7938250c4792 append d
    |
    o  2:5a9aaaa34af0 append c
    |
    o  1:7415b0fde5c7 append b
    |
    o  0:27b53ea0b53c add a

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.