[PATCH PREVIEW] largefiles: speed up the check if largefiles should be added to repo requirements

Dominik Psenner dpsenner at gmail.com
Fri Oct 28 03:00:56 CDT 2011


># HG changeset patch
># User DominikP
># Date 1319788476 -7200
># Branch stable
># Node ID 934a2bcf91a83e8abd0961ae19bf8f5e6b841e12
># Parent  b26315ae7f1898aebf03631b36fb93c4c004a6c5
>largefiles: speed up the check if largefiles should be added to repo
>requirements
>
>This patch speeds up things by not recursing into subfolders when searching
>for
>.hglf file in the store.
>
>diff -r b26315ae7f18 -r 934a2bcf91a8 hgext/largefiles/reposetup.py
>--- a/hgext/largefiles/reposetup.py	Thu Oct 27 18:35:07 2011 -0500
>+++ b/hgext/largefiles/reposetup.py	Fri Oct 28 09:54:36 2011 +0200
>@@ -400,10 +400,10 @@
>     repo.__class__ = lfiles_repo
>
>     def checkrequireslfiles(ui, repo, **kwargs):
>-        if 'largefiles' not in repo.requirements and util.any(
>-                lfutil.shortname+'/' in f[0] for f in
>repo.store.datafiles()):
>-            repo.requirements.add('largefiles')
>-            repo._writerequirements()
>+        if 'largefiles' not in repo.requirements:
>+            if util.any(lfutil.shortname+'/' in f[0] for f in
>repo.store._walk('data', False)):

For the final patch I would refactor walk() to have a recurse parameter that
is passed on to _walk.

Cheers



More information about the Mercurial-devel mailing list