changeset 18164:bacf55bd8f90

rebase: allow non-head rebase-set when obsolete is enabled Obsolescence markers can represent this situation just fine. Rebased revisions are marked as precursors of the ones create by rebase. Unrebased descendants becomes "unstable". If obsolescence is not enabled we keep the current behavior of aborting. This new behavior only applies when obsolete is enabled and is subject to future discussion and changes.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 31 Dec 2012 17:45:52 -0600
parents c5bd753c5bc6
children 0f5a0a2073a8
files hgext/rebase.py tests/test-rebase-obsolete.t
diffstat 2 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Mon Dec 31 17:44:18 2012 -0600
+++ b/hgext/rebase.py	Mon Dec 31 17:45:52 2012 -0600
@@ -194,8 +194,9 @@
             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"),
--- a/tests/test-rebase-obsolete.t	Mon Dec 31 17:44:18 2012 -0600
+++ b/tests/test-rebase-obsolete.t	Mon Dec 31 17:45:52 2012 -0600
@@ -279,4 +279,30 @@
   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
+  
+
+