context: remove unused overlayfilectx (API)
authorSean Farley <sean@farley.io>
Tue, 22 May 2018 12:35:38 +0200
changeset 39712 15e86ecf6b26
parent 39711 6c8ceebce309
child 39713 a5dafefc4a53
context: remove unused overlayfilectx (API) It seems that this was maybe used in an extension but at this point nothing in lfs, hg-experimental, or any other cursory repo looked at has a reference to this class; so, for now, let's just remove it.
mercurial/context.py
--- a/mercurial/context.py	Mon Jun 11 20:48:47 2018 -0700
+++ b/mercurial/context.py	Tue May 22 12:35:38 2018 +0200
@@ -623,7 +623,6 @@
     workingfilectx: a filecontext that represents files from the working
                     directory,
     memfilectx: a filecontext that represents files in-memory,
-    overlayfilectx: duplicate another filecontext with some fields overridden.
     """
     @propertycache
     def _filelog(self):
@@ -2370,76 +2369,6 @@
         """wraps repo.wwrite"""
         self._data = data
 
-class overlayfilectx(committablefilectx):
-    """Like memfilectx but take an original filectx and optional parameters to
-    override parts of it. This is useful when fctx.data() is expensive (i.e.
-    flag processor is expensive) and raw data, flags, and filenode could be
-    reused (ex. rebase or mode-only amend a REVIDX_EXTSTORED file).
-    """
-
-    def __init__(self, originalfctx, datafunc=None, path=None, flags=None,
-                 copied=None, ctx=None):
-        """originalfctx: filecontext to duplicate
-
-        datafunc: None or a function to override data (file content). It is a
-        function to be lazy. path, flags, copied, ctx: None or overridden value
-
-        copied could be (path, rev), or False. copied could also be just path,
-        and will be converted to (path, nullid). This simplifies some callers.
-        """
-
-        if path is None:
-            path = originalfctx.path()
-        if ctx is None:
-            ctx = originalfctx.changectx()
-            ctxmatch = lambda: True
-        else:
-            ctxmatch = lambda: ctx == originalfctx.changectx()
-
-        repo = originalfctx.repo()
-        flog = originalfctx.filelog()
-        super(overlayfilectx, self).__init__(repo, path, flog, ctx)
-
-        if copied is None:
-            copied = originalfctx.renamed()
-            copiedmatch = lambda: True
-        else:
-            if copied and not isinstance(copied, tuple):
-                # repo._filecommit will recalculate copyrev so nullid is okay
-                copied = (copied, nullid)
-            copiedmatch = lambda: copied == originalfctx.renamed()
-
-        # When data, copied (could affect data), ctx (could affect filelog
-        # parents) are not overridden, rawdata, rawflags, and filenode may be
-        # reused (repo._filecommit should double check filelog parents).
-        #
-        # path, flags are not hashed in filelog (but in manifestlog) so they do
-        # not affect reusable here.
-        #
-        # If ctx or copied is overridden to a same value with originalfctx,
-        # still consider it's reusable. originalfctx.renamed() may be a bit
-        # expensive so it's not called unless necessary. Assuming datafunc is
-        # always expensive, do not call it for this "reusable" test.
-        reusable = datafunc is None and ctxmatch() and copiedmatch()
-
-        if datafunc is None:
-            datafunc = originalfctx.data
-        if flags is None:
-            flags = originalfctx.flags()
-
-        self._datafunc = datafunc
-        self._flags = flags
-        self._copied = copied
-
-        if reusable:
-            # copy extra fields from originalfctx
-            attrs = ['rawdata', 'rawflags', '_filenode', '_filerev']
-            for attr_ in attrs:
-                if util.safehasattr(originalfctx, attr_):
-                    setattr(self, attr_, getattr(originalfctx, attr_))
-
-    def data(self):
-        return self._datafunc()
 
 class metadataonlyctx(committablectx):
     """Like memctx but it's reusing the manifest of different commit.