Patchwork [1,of,2] histedit: report when revisions to rebase are not ancestors of working dir

login
register
mail settings
Submitter Simon Heimberg
Date Aug. 3, 2013, 2:41 p.m.
Message ID <55d5658e8a2ccdb8f2cc.1375540897@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/879/
State Accepted
Headers show

Comments

Simon Heimberg - Aug. 3, 2013, 2:41 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1375540637 -7200
# Branch stable
# Node ID 55d5658e8a2ccdb8f2cc3201959cd664fb3d9b9f
# Parent  b31e0be96c79156b8236b12315a6f699c1bf992a
histedit: report when revisions to rebase 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

Patch

diff -r b31e0be96c79 -r 55d5658e8a2c hgext/histedit.py
--- a/hgext/histedit.py	Mon Feb 04 23:41:11 2013 +0100
+++ b/hgext/histedit.py	Sam 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', '')
diff -r b31e0be96c79 -r 55d5658e8a2c tests/test-histedit-revspec.t
--- a/tests/test-histedit-revspec.t	Mon Feb 04 23:41:11 2013 +0100
+++ b/tests/test-histedit-revspec.t	Sam 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]