[PATCH] histedit: print another warning when working dir is not a descandant of rev

Simon Heimberg simon.heimberg at swimatec.ch
Tue Feb 5 04:32:11 CST 2013


# HG changeset patch
# User Simon Heimberg <simohe at 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.

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
 
         ctxs = [repo[r] for r in revs]



More information about the Mercurial-devel mailing list