changeset 275:336210dada95

obsolete: make rebase abort with --keep obsolete modifies rebase to mark rebased changesets obsolete instead of stripping them, which makes --keep irrelevant.
author Patrick Mezard <patrick@mezard.eu>
date Wed, 20 Jun 2012 15:42:01 +0200
parents 6622a24f3b0f
children f26e9bc5f7fc
files hgext/obsolete.py tests/test-obsolete.t
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/obsolete.py	Tue Jun 19 09:23:50 2012 +0200
+++ b/hgext/obsolete.py	Wed Jun 20 15:42:01 2012 +0200
@@ -45,6 +45,12 @@
 A ``debugobsolete`` command was added. It adds an obsolete relation between two
 nodes.
 
+Note that rebased changesets are not marked obsolete rather than being stripped
+In this experimental extensions, this is done forcing the --keep option. Trying
+to use the --keep option of rebase with this extensionn this experimental
+extension will cause such a call to abort. Until better releasen please use
+graft command to rebase and copy changesets.
+
 Context object
 --------------
 
@@ -231,9 +237,10 @@
     return newrev
 
 def cmdrebase(orig, ui, repo, *args, **kwargs):
-    oldkeep = kwargs.pop('keep', False)
-    if oldkeep:
-        ui.warn('WARNING --keep option ignored by experimental obsolete extension')
+    if kwargs.get('keep', False):
+        raise util.Abort(_('rebase --keep option is unsupported with obsolete '
+                           'extension'), hint=_("see 'hg help obsolete'"))
+    kwargs = dict(kwargs)
     kwargs['keep'] = True
     return orig(ui, repo, *args, **kwargs)
 
--- a/tests/test-obsolete.t	Tue Jun 19 09:23:50 2012 +0200
+++ b/tests/test-obsolete.t	Wed Jun 20 15:42:01 2012 +0200
@@ -475,4 +475,6 @@
 Test rebase --keep warning
 
   $ hg --config extensions.rebase= rebase -d 1 --keep
-  WARNING --keep option ignored by experimental obsolete extension (no-eol)
+  abort: rebase --keep option is unsupported with obsolete extension
+  (see 'hg help obsolete')
+  [255]