D4645: revlog: define ellipsis flag processors in core
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Tue Sep 18 22:41:15 UTC 2018
indygreg created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4645
AFFECTED FILES
hgext/narrow/narrowrevlog.py
mercurial/revlog.py
CHANGE DETAILS
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -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)"""
diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py
--- a/hgext/narrow/narrowrevlog.py
+++ b/hgext/narrow/narrowrevlog.py
@@ -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
To: indygreg, durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list