changeset 39767:db088e133e91

revlog: define ellipsis flag processors in core We will soon be teaching core to honor the ellipsis flag on revlogs. Moving the definition of the processor functions to core is the first step in this. The processor is still not registered unless the narrow extension is loaded. Differential Revision: https://phab.mercurial-scm.org/D4645
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 05 Sep 2018 13:29:22 -0700
parents 9358f5066811
children 7b2b42fc377a
files hgext/narrow/narrowrevlog.py mercurial/revlog.py
diffstat 2 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowrevlog.py	Wed Sep 05 12:44:25 2018 -0700
+++ b/hgext/narrow/narrowrevlog.py	Wed Sep 05 13:29:22 2018 -0700
@@ -11,17 +11,7 @@
    revlog,
 )
 
-def readtransform(self, text):
-    return text, False
-
-def writetransform(self, text):
-    return text, False
-
-def rawtransform(self, text):
-    return False
-
-revlog.addflagprocessor(revlog.REVIDX_ELLIPSIS,
-                        (readtransform, writetransform, rawtransform))
+revlog.addflagprocessor(revlog.REVIDX_ELLIPSIS, revlog.ellipsisprocessor)
 
 def setup():
     # We just wanted to add the flag processor, which is done at module
--- a/mercurial/revlog.py	Wed Sep 05 12:44:25 2018 -0700
+++ b/mercurial/revlog.py	Wed Sep 05 13:29:22 2018 -0700
@@ -115,6 +115,22 @@
     REVIDX_ISCENSORED: None,
 }
 
+# Flag processors for REVIDX_ELLIPSIS.
+def ellipsisreadprocessor(rl, text):
+    return text, False
+
+def ellipsiswriteprocessor(rl, text):
+    return text, False
+
+def ellipsisrawprocessor(rl, text):
+    return False
+
+ellipsisprocessor = (
+    ellipsisreadprocessor,
+    ellipsiswriteprocessor,
+    ellipsisrawprocessor,
+)
+
 _mdre = re.compile('\1\n')
 def parsemeta(text):
     """return (metadatadict, metadatasize)"""