Differences between revisions 17 and 18
Revision 17 as of 2008-07-16 22:49:19
Size: 4233
Comment:
Revision 18 as of 2008-07-19 16:12:36
Size: 4728
Comment: Add scenario C
Deletions are marked like this. Additions are marked like this.
Line 202: Line 202:
=== Scenario C ===
This case represents a quite common situation, a repository with just one (merge) head.

{{{#!dot
digraph {
    node [shape=box];
    graph [rankdir=LR];
    A -> B -> C;
    A -> D -> E;
    C -> F;
    E -> F;
}
}}}

 * D onto C

{{{#!dot
digraph {
    node [shape=box];
    graph [rankdir=LR];
    A -> B -> C;
    node [color=red];
    C -> D -> E;
    D [label="D`"];
    E [label="E`"];
}
}}}
 Obviously the revision F has been skipped.
 

Rebase Project

Introduction

When contributing to a project, sometimes there is the need to keep some patches private, while keeping the whole repository up-to-date.

In those cases it can be useful to "detach" the local changes, synchronize the repository with the mainstream and then append the private changes on top of the new remote changes. This operation is called rebase.

This feature is being implemented as part of SummerOfCode.

Current implementation

The current code can be find [http://freehg.org/u/astratto/soc/ here]

Current version's features:

  • rebase both simple and complex cases
  • abort of an interrupted rebasing
  • resume of an interrupted rebasing
  • mq patches handling

Usage example

Let suppose we have the following repository:

where C* are common revisions, R* changes in upstream and L* local changes.

We want to rebase L* on top of R2.

This can be achieved using:

   $ hg rebase L1 R2

Result:

Dealing with conflicting merges

Sometimes could happen that some changes in L* conflicts with some changes in R*. In these cases the extension will stop, store the current status and let user the ability to solve the conflict on his own.

In event of interruption users have two choices:

  • abort
  • continue

Abort

An interrupted process can be aborted, thus restoring the repository to its original state, with:

   $ hg rebase --abort 

Continue

The most common situation, however, is resuming an interrupted process and this can be done with:

   $ hg rebase --continue

Scenarios

Now will be analyzed the most interesting scenarios.

Scenario A

The first one is the simplest one, a simple branch.

In this scenario there are two interesting interactions:

  • rebase on top

  • rebase on an intermediate revision

Scenario B

The second scenario involves something more complicated. In this scenario the user cloned from upstream, then merged several times.

  • rebase D on I

  • Despite being a merge revision D hasn't been skipped in this case, as opposite to H.

  • rebase B on I

  • In this case two revisions (D and H) have been skipped.
  • rebase C on B

Note: Rebase G onto I is not allowed, because that would mean compacting G and D into G'. Rebase would suggest to rebase starting from D.

Scenario C

This case represents a quite common situation, a repository with just one (merge) head.

  • D onto C

  • Obviously the revision F has been skipped.


CategoryNewFeatures

RebaseProject (last edited 2012-10-25 20:45:08 by mpm)