Differences between revisions 22 and 23
Revision 22 as of 2008-07-28 19:30:26
Size: 5073
Comment: Add allowed case to scenario B
Revision 23 as of 2008-07-29 08:24:12
Size: 6700
Comment: Add Parent relationships
Deletions are marked like this. Additions are marked like this.
Line 250: Line 250:
== Details ==
=== Parent relationships ===
When rebasing a given node ('''N''') different situations may happen, depending on the status of its parent(s).

From now on P1,,N,, is used to refer to the first parent of '''N''', P2,,N,, to the second one.

e.g., P1',,N,, identify the rebased first parent of '''N'''

These situations are summed up in the following table:

|| |||| '''P2,,N,, = A''' |||| '''P2,,N,, = S''' |||| '''P2,,N,, = E''' |||| '''P2,,N,, = N''' ||
|| '''P1,,N,, = A''' |||| |||| p1 = P2',,N,, |||| p1 = target, p2 = P2,,N,, |||| p1 = target ||
|| '''P1,,N,, = S''' |||| p1 = P1',,N,, |||| p1 = P1',,N,,, p2 = P2',,N,, |||| p1 = P1',,N,,, p2 = P2,,N,, |||| p1 = P1',,N,, ||
|| '''P1,,N,, = E''' |||| p1 = target, p2 = P1,,N,, |||| p1 = P2',,N,,, p2 = P1,,N,, |||| |||| p1 = target, p2 = P1,,N,, ||

A: In ancestors(target)
S: In the rebasing series
E: External
N: None

The empty cells cover the cases in which:
 * P1,,N,, = P2,,N,, = A
 
 that means that also '''N''' is in ancestors(target) and this scenario is disallowed
 
 * P1,,N,, = P2,,N,, = E
 
 that means that '''N''' is a merged revision and this scenario is disallowed (suggest to rebase from P1,,N,, or P2,,N,, ?)

Also note that:
 * P1,,N,, = None entails that P2,,N,, = None
 * P1,,N,, = P2,,N,, = None is true only if '''N''' is root (this scenario is disallowed by the rule that a node can't be rebased onto a descendant)

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.

In general, this extension allows to move revisions from a point to another, some common scenarios are shown in the section "Scenarios".

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 (TO CHECK)

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

  • rebase G onto I

Note: Rebase drops a parent relationship only if the parent is an ancestor of target.

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.

Details

Parent relationships

When rebasing a given node (N) different situations may happen, depending on the status of its parent(s).

From now on P1N is used to refer to the first parent of N, P2N to the second one.

e.g., P1'N identify the rebased first parent of N

These situations are summed up in the following table:

P2N = A

P2N = S

P2N = E

P2N = N

P1N = A

p1 = P2'N

p1 = target, p2 = P2N

p1 = target

P1N = S

p1 = P1'N

p1 = P1'N, p2 = P2'N

p1 = P1'N, p2 = P2N

p1 = P1'N

P1N = E

p1 = target, p2 = P1N

p1 = P2'N, p2 = P1N

p1 = target, p2 = P1N

A: In ancestors(target) S: In the rebasing series E: External N: None

The empty cells cover the cases in which:

  • P1N = P2N = A

    that means that also N is in ancestors(target) and this scenario is disallowed

  • P1N = P2N = E

    that means that N is a merged revision and this scenario is disallowed (suggest to rebase from P1N or P2N ?)

Also note that:

  • P1N = None entails that P2N = None

  • P1N = P2N = None is true only if N is root (this scenario is disallowed by the rule that a node can't be rebased onto a descendant)


CategoryNewFeatures

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