# HG changeset patch # User Martin von Zweigbergk # Date 2017-08-26 05:05:10 # Node ID 3939b30d0cb78e43e00f50b9b5bfe882a3b9191f # Parent 088598153aa28a1c65e9757dd52cfc406a330156 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 diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -14,6 +14,7 @@ from .node import ( bin, hex, nullid, + wdirid, ) from . import ( @@ -535,6 +536,9 @@ class changelog(revlog.revlog): # 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')