narrow: filter copies in core
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 17 May 2018 15:33:28 -0700
changeset 38046 ee7b6fa52d9d
parent 38045 18e6ea9ba81d
child 38047 dabc2237963c
narrow: filter copies in core Differential Revision: https://phab.mercurial-scm.org/D3576
hgext/narrow/__init__.py
hgext/narrow/narrowmerge.py
mercurial/copies.py
--- a/hgext/narrow/__init__.py	Thu May 17 15:25:52 2018 -0700
+++ b/hgext/narrow/__init__.py	Thu May 17 15:33:28 2018 -0700
@@ -29,7 +29,6 @@
     narrowcommands,
     narrowcopies,
     narrowdirstate,
-    narrowmerge,
     narrowpatch,
     narrowrepo,
     narrowrevlog,
@@ -64,7 +63,6 @@
     localrepo.featuresetupfuncs.add(featuresetup)
     narrowrevlog.setup()
     narrowbundle2.setup()
-    narrowmerge.setup()
     narrowcommands.setup()
     narrowchangegroup.setup()
     narrowwirepeer.uisetup()
--- a/hgext/narrow/narrowmerge.py	Thu May 17 15:25:52 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-# narrowmerge.py - extensions to mercurial merge module to support narrow clones
-#
-# Copyright 2017 Google, Inc.
-#
-# This software may be used and distributed according to the terms of the
-# GNU General Public License version 2 or any later version.
-
-from __future__ import absolute_import
-
-from mercurial import (
-    copies,
-    extensions,
-)
-
-def setup():
-    def _computenonoverlap(orig, repo, *args, **kwargs):
-        u1, u2 = orig(repo, *args, **kwargs)
-        narrowmatch = repo.narrowmatch()
-        if narrowmatch.always():
-            return u1, u2
-
-        u1 = [f for f in u1 if narrowmatch(f)]
-        u2 = [f for f in u2 if narrowmatch(f)]
-        return u1, u2
-    extensions.wrapfunction(copies, '_computenonoverlap', _computenonoverlap)
--- a/mercurial/copies.py	Thu May 17 15:25:52 2018 -0700
+++ b/mercurial/copies.py	Thu May 17 15:33:28 2018 -0700
@@ -254,6 +254,11 @@
         repo.ui.debug("%s:\n   %s\n" % (header % 'local', "\n   ".join(u1)))
     if u2:
         repo.ui.debug("%s:\n   %s\n" % (header % 'other', "\n   ".join(u2)))
+
+    narrowmatch = repo.narrowmatch()
+    if not narrowmatch.always():
+        u1 = [f for f in u1 if narrowmatch(f)]
+        u2 = [f for f in u2 if narrowmatch(f)]
     return u1, u2
 
 def _makegetfctx(ctx):