diff mercurial/repair.py @ 25300:678d0bfdd31a

repair: forbid strip from inside a transaction Stripping inside a transaction will (at best) crash or (at worst) result in very unexpected results. We explicitly forbid it early.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sat, 23 May 2015 21:18:47 -0700
parents f3558829471b
children 28800ab40395
line wrap: on
line diff
--- a/mercurial/repair.py	Wed May 27 12:14:10 2015 -0400
+++ b/mercurial/repair.py	Sat May 23 21:18:47 2015 -0700
@@ -151,6 +151,12 @@
 
     mfst = repo.manifest
 
+    curtr = repo.currenttransaction()
+    if curtr is not None:
+        del curtr  # avoid carrying reference to transaction for nothing
+        msg = _('programming error: cannot strip from inside a transaction')
+        raise util.Abort(msg, hint=_('contact your extension maintainer'))
+
     tr = repo.transaction("strip")
     offset = len(tr.entries)