Commits

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)

hgext/obsolete.py

 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
 --------------
 
     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)
 

tests/test-obsolete.t

 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]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.