changeset 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 b2eb0aa445cb
children 6e6452bc441d
files mercurial/changelog.py mercurial/revlog.py
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changelog.py	Tue Aug 22 21:21:43 2017 -0400
+++ b/mercurial/changelog.py	Wed Aug 30 09:21:31 2017 -0700
@@ -14,7 +14,6 @@
     bin,
     hex,
     nullid,
-    wdirid,
 )
 
 from . import (
@@ -536,9 +535,6 @@
         # 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')
--- a/mercurial/revlog.py	Tue Aug 22 21:21:43 2017 -0400
+++ b/mercurial/revlog.py	Wed Aug 30 09:21:31 2017 -0700
@@ -1697,6 +1697,10 @@
         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: