Patrick Mézard committed 336210d

obsolete: make rebase abort with --keep

obsolete modifies rebase to mark rebased changesets obsolete instead of
stripping them, which makes --keep irrelevant.

Comments (0)

Files changed (2)

 A ``debugobsolete`` command was added. It adds an obsolete relation between two
+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
     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)


 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]