changeset 18608:3adbd57e1794

histedit: report when revisions to edit are not ancestors of working dir Editing the history only is possible when the working dir is a descendant of the revisions to edit. When this happens explain it by writing abort: %s is not an ancestor of working directory
author Simon Heimberg <simohe@besonet.ch>
date Sat, 03 Aug 2013 16:37:17 +0200
parents 26627c30735a
children 909cb9ddba4a
files hgext/histedit.py tests/test-histedit-revspec.t
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Sat Feb 09 15:59:44 2013 +0000
+++ b/hgext/histedit.py	Sat Aug 03 16:37:17 2013 +0200
@@ -498,8 +498,8 @@
         keep = opts.get('keep', False)
         revs = between(repo, parent, topmost, keep)
         if not revs:
-            ui.warn(_('nothing to edit\n'))
-            return 1
+            raise util.Abort(_('%s is not an ancestor of working directory') %
+                             node.short(parent))
 
         ctxs = [repo[r] for r in revs]
         rules = opts.get('commands', '')
--- a/tests/test-histedit-revspec.t	Sat Feb 09 15:59:44 2013 +0000
+++ b/tests/test-histedit-revspec.t	Sat Aug 03 16:37:17 2013 +0200
@@ -65,5 +65,5 @@
   $ hg up 2
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg histedit -r 4
-  nothing to edit
-  [1]
+  abort: 08d98a8350f3 is not an ancestor of working directory
+  [255]