diff hgext/histedit.py @ 33783:c26a76e1af36

histedit: check first changeset for verb "roll" or "fold" (issue5498) If someone changes "pick" to "roll" or "fold" for the first changeset in a histedit rule Mercurial could remove a wrong changeset if the phase is non-public. roll or fold for the first changeset should be invalid.
author Andr? Klitzing <aklitzing@gmail.com>
date Fri, 11 Aug 2017 15:20:41 +0200
parents af402f11cb9d
children 6e6452bc441d
line wrap: on
line diff
--- a/hgext/histedit.py	Mon Jul 31 23:13:47 2017 +0900
+++ b/hgext/histedit.py	Fri Aug 11 15:20:41 2017 +0200
@@ -1417,6 +1417,11 @@
     expected = set(c.node() for c in ctxs)
     seen = set()
     prev = None
+
+    if actions and actions[0].verb in ['roll', 'fold']:
+        raise error.ParseError(_('first changeset cannot use verb "%s"') %
+                               actions[0].verb)
+
     for action in actions:
         action.verify(prev, expected, seen)
         prev = action