D3576: narrow: filter copies in core

2018-05-17 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/narrow/__init__.py
  hgext/narrow/narrowmerge.py
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -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):
diff --git a/hgext/narrow/narrowmerge.py b/hgext/narrow/narrowmerge.py
deleted file mode 100644
--- a/hgext/narrow/narrowmerge.py
+++ /dev/null
@@ -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)
diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py
--- a/hgext/narrow/__init__.py
+++ b/hgext/narrow/__init__.py
@@ -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()



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


D3576: narrow: filter copies in core

2018-05-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGee7b6fa52d9d: narrow: filter copies in core (authored by 
martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3576?vs=8730&id=8739

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

AFFECTED FILES
  hgext/narrow/__init__.py
  hgext/narrow/narrowmerge.py
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -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):
diff --git a/hgext/narrow/narrowmerge.py b/hgext/narrow/narrowmerge.py
deleted file mode 100644
--- a/hgext/narrow/narrowmerge.py
+++ /dev/null
@@ -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)
diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py
--- a/hgext/narrow/__init__.py
+++ b/hgext/narrow/__init__.py
@@ -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()



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