indygreg created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This functionality is now handled by core as of the previous commit.
  
  I wanted this to be a standalone commit because the deleted code
  makes a reference to remotefilelog's file type missing a node() method
  and this may have implications to narrow+remotefilelog usage. The code
  in core doesn't perform this check and therefore behavior may be subtly
  different and buggy.
  
  But I /think/ the check is merely a performance optimization and
  nothing more. So I'm optimistic this will continue to "just work."

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4644

AFFECTED FILES
  hgext/narrow/narrowrepo.py
  hgext/narrow/narrowrevlog.py

CHANGE DETAILS

diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py
--- a/hgext/narrow/narrowrevlog.py
+++ b/hgext/narrow/narrowrevlog.py
@@ -9,7 +9,6 @@
 
 from mercurial import (
    revlog,
-   util,
 )
 
 def readtransform(self, text):
@@ -28,53 +27,3 @@
     # We just wanted to add the flag processor, which is done at module
     # load time.
     pass
-
-def makenarrowfilelog(fl, narrowmatch):
-    class narrowfilelog(fl.__class__):
-        def renamed(self, node):
-            # Renames that come from outside the narrowspec are
-            # problematic at least for git-diffs, because we lack the
-            # base text for the rename. This logic was introduced in
-            # 3cd72b1 of narrowhg (authored by martinvonz, reviewed by
-            # adgar), but that revision doesn't have any additional
-            # commentary on what problems we can encounter.
-            m = super(narrowfilelog, self).renamed(node)
-            if m and not narrowmatch(m[0]):
-                return None
-            return m
-
-        def size(self, rev):
-            # We take advantage of the fact that remotefilelog
-            # lacks a node() method to just skip the
-            # rename-checking logic when on remotefilelog. This
-            # might be incorrect on other non-revlog-based storage
-            # engines, but for now this seems to be fine.
-            #
-            # TODO: when remotefilelog is in core, improve this to
-            # explicitly look for remotefilelog instead of cheating
-            # with a hasattr check.
-            if util.safehasattr(self, 'node'):
-                node = self.node(rev)
-                # Because renamed() is overridden above to
-                # sometimes return None even if there is metadata
-                # in the revlog, size can be incorrect for
-                # copies/renames, so we need to make sure we call
-                # the super class's implementation of renamed()
-                # for the purpose of size calculation.
-                if super(narrowfilelog, self).renamed(node):
-                    return len(self.read(node))
-            return super(narrowfilelog, self).size(rev)
-
-        def cmp(self, node, text):
-            different = super(narrowfilelog, self).cmp(node, text)
-            if different:
-                # Similar to size() above, if the file was copied from
-                # a file outside the narrowspec, the super class's
-                # would have returned True because we tricked it into
-                # thinking that the file was not renamed.
-                if super(narrowfilelog, self).renamed(node):
-                    t2 = self.read(node)
-                    return t2 != text
-            return different
-
-    fl.__class__ = narrowfilelog
diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py
--- a/hgext/narrow/narrowrepo.py
+++ b/hgext/narrow/narrowrepo.py
@@ -9,20 +9,14 @@
 
 from . import (
     narrowdirstate,
-    narrowrevlog,
     narrowwirepeer,
 )
 
 def wraprepo(repo):
     """Enables narrow clone functionality on a single local repository."""
 
     class narrowrepository(repo.__class__):
 
-        def file(self, f):
-            fl = super(narrowrepository, self).file(f)
-            narrowrevlog.makenarrowfilelog(fl, self.narrowmatch())
-            return fl
-
         def _makedirstate(self):
             dirstate = super(narrowrepository, self)._makedirstate()
             return narrowdirstate.wrapdirstate(self, dirstate)



To: indygreg, durin42, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to