changeset 33979:3939b30d0cb7

changelog: abort on attempt to write wdir revision Similar to the previous patch which prevented writing the null revision to any revlog, but this is for the wdir revision. Thanks to Jun for pointing this out. Differential Revision: https://phab.mercurial-scm.org/D524
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 25 Aug 2017 22:05:10 -0700
parents 088598153aa2
children 8abbae93045a
files mercurial/changelog.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changelog.py	Thu Aug 24 17:44:08 2017 -0700
+++ b/mercurial/changelog.py	Fri Aug 25 22:05:10 2017 -0700
@@ -14,6 +14,7 @@
     bin,
     hex,
     nullid,
+    wdirid,
 )
 
 from . import (
@@ -535,6 +536,9 @@
         # overlay over the standard revlog._addrevision to track the new
         # revision on the transaction.
         rev = len(self)
+        if node == wdirid: # nullid is checked in super method
+            raise error.RevlogError(_("%s: attempt to add wdir revision") %
+                                    (self.indexfile))
         node = super(changelog, self)._addrevision(node, rawtext, transaction,
                                                    *args, **kwargs)
         revs = transaction.changes.get('revs')