[PATCH] largefiles: optimize status when files are specified on the command line (issue3144)
Martin Geisler
mg at aragost.com
Fri Dec 9 17:13:50 UTC 2011
Na'Tosha Bard <natosha at unity3d.com> writes:
> # HG changeset patch
> # User Na'Tosha Bard <natosha at unity3d.com>
> # Date 1323442785 -3600
> # Node ID 46fb85de1dc5e2a9075ec237f0cccb1d136ef760
> # Parent fc8c7a5ccc4a928e7559013ecdf50462c271418c
> largefiles: optimize status when files are specified on the command
> line (issue3144)
The lines in your commit message are very long. I prefer them
hard-wrapped at around 70 characters -- that way they're easier to read
in terminals.
> diff -r fc8c7a5ccc4a -r 46fb85de1dc5 hgext/largefiles/reposetup.py
> --- a/hgext/largefiles/reposetup.py Thu Dec 08 16:01:44 2011 -0600
> +++ b/hgext/largefiles/reposetup.py Fri Dec 09 15:59:45 2011 +0100
> @@ -120,6 +120,23 @@
> if match is None:
> match = match_.always(self.root, self.getcwd())
>
> + # First check if there were files specified on the
> + # command line. If there were, and none of them were
> + # largefiles, we should just bail here and let super
> + # handle it -- thus gaining a big performance boost.
> + lfdirstate = lfutil.openlfdirstate(ui, self)
> + if match._files:
> + matchedfiles = [f for f in match._files if f in lfdirstate]
> + if not matchedfiles:
> + try:
> + return super(lfiles_repo, self).status(node1, node2,
> + match, listignored, listclean,
> + listunknown, listsubrepos)
> + except TypeError:
> + return super(lfiles_repo, self).status(node1, node2,
> + match, listignored, listclean,
> + listunknown)
These TypeErrors wont be thrown -- they were a left-over from when the
code was compatible with pre-1.7 versions of Mercurial. I just removed
the other instances of this pattern I could find.
> # Create a copy of match that matches standins instead
> # of largefiles.
> def tostandin(file):
> @@ -155,7 +172,8 @@
> # taken out or lfdirstate.status will report an error.
> # The status of these files was already computed using
> # super's status.
> - lfdirstate = lfutil.openlfdirstate(ui, self)
> + if not lfdirstate:
> + lfdirstate = lfutil.openlfdirstate(ui, self)
Can lfdirstate be None now? I don't see a change (in your patch) that
would make that possible.
--
Martin Geisler
aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/
More information about the Mercurial-devel
mailing list