comparison mercurial/changelog.py @ 34028:bfb38c5cebf4

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
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 30 Aug 2017 09:21:31 -0700
parents 3939b30d0cb7
children 0fa781320203
comparison
equal deleted inserted replaced
34026:b2eb0aa445cb 34028:bfb38c5cebf4
12 from .i18n import _ 12 from .i18n import _
13 from .node import ( 13 from .node import (
14 bin, 14 bin,
15 hex, 15 hex,
16 nullid, 16 nullid,
17 wdirid,
18 ) 17 )
19 18
20 from . import ( 19 from . import (
21 encoding, 20 encoding,
22 error, 21 error,
534 533
535 def _addrevision(self, node, rawtext, transaction, *args, **kwargs): 534 def _addrevision(self, node, rawtext, transaction, *args, **kwargs):
536 # overlay over the standard revlog._addrevision to track the new 535 # overlay over the standard revlog._addrevision to track the new
537 # revision on the transaction. 536 # revision on the transaction.
538 rev = len(self) 537 rev = len(self)
539 if node == wdirid: # nullid is checked in super method
540 raise error.RevlogError(_("%s: attempt to add wdir revision") %
541 (self.indexfile))
542 node = super(changelog, self)._addrevision(node, rawtext, transaction, 538 node = super(changelog, self)._addrevision(node, rawtext, transaction,
543 *args, **kwargs) 539 *args, **kwargs)
544 revs = transaction.changes.get('revs') 540 revs = transaction.changes.get('revs')
545 if revs is not None: 541 if revs is not None:
546 revs.add(rev) 542 revs.add(rev)