[PATCH STABLE] lfs: consult the narrow matcher when extracting pointers from ctx (issue5794)
Matt Harbison
mharbison72 at gmail.com
Mon Oct 22 02:50:14 UTC 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1540175160 14400
# Sun Oct 21 22:26:00 2018 -0400
# Node ID 53298a833905d63ff8bde47bb175ddff534d5832
# Parent cc4586749c8c99885619eaaa17e3157176c4523c
lfs: consult the narrow matcher when extracting pointers from ctx (issue5794)
I added a testcase for lfs to all narrow tests, and the following failed:
test-narrow-acl.t
test-narrow-exchange.t
test-narrow-patterns.t
test-narrow-strip.t
test-narrow-trackedcmd.t
test-narrow-widen.t
test-narrow.t
The first two still have errors in the pretxnchangegroup on clone and (receiving
a) push, which I'm still looking into (4d63f3bc1e1a fixed something in this area
already). These two modified tests seem to cover the things that failed in the
remaining narrow tests, i.e. `hg tracked` and `hg strip`, so I didn't bother
enabling the testcases elsewhere. Maybe we should, but it's 68 tests total.
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -16,6 +16,7 @@ from mercurial import (
error,
repository,
revlog,
+ scmutil,
util,
)
@@ -374,7 +375,12 @@ def pointersfromctx(ctx, removed=False):
stored for the path is an empty dict.
"""
result = {}
+ m = ctx.repo().narrowmatch()
+
+ # TODO: consider manifest.fastread() instead
for f in ctx.files():
+ if not m(f):
+ continue
p = pointerfromctx(ctx, f, removed=removed)
if p is not None:
result[f] = p
diff --git a/tests/test-narrow-strip.t b/tests/test-narrow-strip.t
--- a/tests/test-narrow-strip.t
+++ b/tests/test-narrow-strip.t
@@ -1,4 +1,12 @@
#testcases flat tree
+#testcases lfs-on lfs-off
+
+#if lfs-on
+ $ cat >> $HGRCPATH <<EOF
+ > [extensions]
+ > lfs =
+ > EOF
+#endif
$ . "$TESTDIR/narrow-library.sh"
diff --git a/tests/test-narrow.t b/tests/test-narrow.t
--- a/tests/test-narrow.t
+++ b/tests/test-narrow.t
@@ -1,4 +1,12 @@
#testcases flat tree
+#testcases lfs-on lfs-off
+
+#if lfs-on
+ $ cat >> $HGRCPATH <<EOF
+ > [extensions]
+ > lfs =
+ > EOF
+#endif
$ . "$TESTDIR/narrow-library.sh"
More information about the Mercurial-devel
mailing list