On Mon, 16 Apr 2018 10:24:51 -0400, Matt Harbison wrote: > > > On Apr 16, 2018, at 7:31 AM, Yuya Nishihara <y...@tcha.org> wrote: > > > >> On Sun, 15 Apr 2018 02:44:06 -0400, Matt Harbison wrote: > >> # HG changeset patch > >> # User Matt Harbison <matt_harbi...@yahoo.com> > >> # Date 1523749425 14400 > >> # Sat Apr 14 19:43:45 2018 -0400 > >> # Node ID 1c3654f7ed31e6770cbd97681083bab834554056 > >> # Parent de2975df3997148a832ef41425b069fc6f8ff3bc > >> export: invoke the file prefetch hook > >> > >> cmdutil.exportfile() is only called by shelve, mq and patchbomb. Those are > >> unlikely to mix with lfs, but it may as well be invoked there for > >> completeness. > >> > >> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py > >> --- a/mercurial/cmdutil.py > >> +++ b/mercurial/cmdutil.py > >> @@ -1619,6 +1619,12 @@ def export(repo, revs, basefm, fntemplat > >> the given template. > >> Otherwise: All revs will be written to basefm. > >> ''' > >> + files = None > >> + ctxs = [repo[r] for r in revs] > >> + if match: > >> + files = set([f for ctx in ctxs for f in ctx if match(f)]) > >> + scmutil.fileprefetchhooks(repo, ctxs, files) > > > > Perhaps we'll need > > > > fileprefetchhooks(repo, revs, match) > > > > since it may take some time to build a list of ctxs and files. > > All of the callers other than export and verify already have ctx. Does it > make sense to ctx -> rev -> ctx like that?
I don't think the cost of repo[ctx.rev()] matters here. We could have two variants of fileprefetchhooks, but I have no preference. > I really like the idea of using match (in fact, I started coding it up). But > I stopped when either diff or export printed a “no such file in rev $hash” > message. I was also a little concerned with not undermining how cat will > extract a single file from the matcher as an optimization. But I guess we > can fix that later. > > Wrapping in match.badmatch() works, so I’ll try that again. > > > We can reconstruct a matcher from files by scmutil.matchfiles(). > > Presumably we should only do that for things like revert, that are building > their own file list? I’m assuming that using the available matcher for > commands where there is one is ok. Yeah, we should reuse the matcher if possible. _______________________________________________ Mercurial-devel mailing list Mercurialfirstname.lastname@example.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel