Patchwork histedit: print another warning when working dir is not a descandant of rev

login
register
mail settings
Submitter Simon Heimberg
Date Feb. 5, 2013, 10:32 a.m.
Message ID <002b01ce038c$0ed8d840$2c8a88c0$@swimatec.ch>
Download mbox | patch
Permalink /patch/807/
State Changes Requested
Headers show

Comments

Simon Heimberg - Feb. 5, 2013, 10:32 a.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1360058492 -3600
# Node ID dc6c15283bf3194f9ed75abbc8d515e8d768fac5
# Parent  1516d5624a2911fcb90ee051c6dc0679b49aef55
histedit: print another warning when working dir is not a descandant of rev

It was not obvious to me that only ancestors of the working dir can be
edited.

 
         ctxs = [repo[r] for r in revs]

Patch

diff -r 1516d5624a29 -r dc6c15283bf3 hgext/histedit.py
--- a/hgext/histedit.py	Mon Feb 04 16:39:02 2013 -0600
+++ b/hgext/histedit.py	Tue Feb 05 11:01:32 2013 +0100
@@ -498,7 +498,11 @@ 
         keep = opts.get('keep', False)
         revs = between(repo, parent, topmost, keep)
         if not revs:
-            ui.warn(_('nothing to edit\n'))
+            if repo.rev("ancestor(%s, %s) AND %s" % (topmost, parent,
parent)):
+            # is parent an ancestor of topmost?
+                ui.warn(_('Working dir is not a descendant of parent. Can
not edit.\n'))
+            else:
+                ui.warn(_('nothing to edit\n'))
             return 1