Patchwork [2,of,3,V2] rebase: allow non-head rebase-set when obsolete is enabled

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 29, 2012, 4:27 a.m.
Message ID <04b52e58f3a811e92100.1356755242@yamac.lan>
Download mbox | patch
Permalink /patch/331/
State Accepted
Commit bacf55bd8f9051b6d0be8bd5d3d086557d2ef8cc
Headers show

Comments

Pierre-Yves David - Dec. 29, 2012, 4:27 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1356754726 -3600
# Node ID 04b52e58f3a811e9210025d8ca6088dcc7cf7dbc
# Parent  84678279bda502d901eff3198553a7158e12b829
rebase: allow non-head rebase-set when obsolete is enabled

Obsolescence marker can represent this situation just fine. Rebased revisions are
marked as precursors of the ones create by rebase. Unrebased descendants becomes
"unstable".

When obsolescence is not enabled we keep aborting. This new default behavior
only apply when obsolete is enabled and is subject to future discussion and
changes.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -192,12 +192,13 @@  def rebase(ui, repo, **opts):
                 root = None
 
             if not rebaseset:
                 repo.ui.debug('base is ancestor of destination\n')
                 result = None
-            elif not keepf and repo.revs('first(children(%ld) - %ld)-hidden()',
-                                         rebaseset, rebaseset):
+            elif (not (keepf or obsolete._enabled)
+                  and repo.revs('first(children(%ld) - %ld)-hidden()',
+                                rebaseset, rebaseset)):
                 raise util.Abort(
                     _("can't remove original changesets with"
                       " unrebased descendants"),
                     hint=_('use --keep to keep original changesets'))
             elif not keepf and not repo[root].mutable():
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -277,6 +277,32 @@  not be rebased.
   $ hg debugobsolete
   5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 {'date': '*', 'user': 'test'} (glob)
   32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 {'date': '*', 'user': 'test'} (glob)
   42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 {'date': '*', 'user': 'test'} (glob)
 
-  $ cd ..
+Test ui.prevent-unstable option
+------------------------------------
+
+  $ hg log -r 'children(8)'
+  9:cf44d2f5a9f4 D (no-eol)
+  $ hg rebase -r 8
+  $ hg log -G
+  @  11:0d8f238b634c C
+  |
+  o  10:7c6027df6a99 B
+  |
+  | o  9:cf44d2f5a9f4 D
+  | |
+  | x  8:e273c5e7d2d2 C
+  | |
+  o |  7:02de42196ebe H
+  | |
+  | o  6:eea13746799a G
+  |/|
+  o |  5:24b6387c8c8c F
+  | |
+  | o  4:9520eea781bc E
+  |/
+  o  0:cd010b8cd998 A
+  
+
+