# HG changeset patch # User Martin von Zweigbergk # Date 2017-08-30 16:21:31 # Node ID bfb38c5cebf4e13b4ce36ecda8369bac690915e8 # Parent b2eb0aa445cbe7cadc8b7691c6266908adfc5057 revlog: move check for wdir from changelog to revlog Yuya said he preferred this (to keep them in one place, I think). Differential Revision: https://phab.mercurial-scm.org/D569 diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -14,7 +14,6 @@ from .node import ( bin, hex, nullid, - wdirid, ) from . import ( @@ -536,9 +535,6 @@ 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') diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1697,6 +1697,10 @@ class revlog(object): if node == nullid: raise RevlogError(_("%s: attempt to add null revision") % (self.indexfile)) + if node == wdirid: + raise RevlogError(_("%s: attempt to add wdir revision") % + (self.indexfile)) + btext = [rawtext] def buildtext(): if btext[0] is not None: