D524: changelog: abort on attempt to write wdir revision
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Sat Aug 26 05:29:07 UTC 2017
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D524
AFFECTED FILES
mercurial/changelog.py
CHANGE DETAILS
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -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')
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list