diff hgext/evolve.py @ 1143:160fd06312fc

uncommit: abort when rev specifies the current changeset The uncommit command now fails when the rev argument indicates the current changeset. Previously this aborted in the changeset obsolescence machinery when the current commit tries to obsolete itself. Using the rev argument like this indicates a misunderstanding, so printing an uncommit-specific error should make it easier to understand what went wrong.
author Nathan Goldbaum <ngoldbau@ucsc.edu>
date Tue, 28 Oct 2014 18:06:28 -0700
parents ca17770d2ee9
children b2a78b950a51
line wrap: on
line diff
--- a/hgext/evolve.py	Tue Oct 28 23:18:56 2014 -0400
+++ b/hgext/evolve.py	Tue Oct 28 18:06:28 2014 -0700
@@ -1987,6 +1987,9 @@
         rev = None
         if opts.get('rev'):
             rev = scmutil.revsingle(repo, opts.get('rev'))
+            ctx = repo[None]
+            if ctx.p1() == rev or ctx.p2() == rev:
+                raise util.Abort(_("cannot uncommit to parent changeset"))
 
         # Recommit the filtered changeset
         tr = repo.transaction('uncommit')