[PATCH RESEND] largefiles: speed up the check if largefiles should be added to repo requirements
Matt Mackall
mpm at selenic.com
Fri Oct 28 18:05:41 CDT 2011
On Fri, 2011-10-28 at 14:01 +0200, Dominik Psenner wrote:
> # HG changeset patch
> # User Dominik Psenner <dpsenner at gmail.com>
> # Date 1319803210 -7200
> # Branch stable
> # Node ID d07955510f1e049047ea7e8b85f0e00c25a1f0bf
> # Parent fa44d741c4d488556a113e007948658d5cfdfca2
> 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 fa44d741c4d4 -r d07955510f1e hgext/largefiles/reposetup.py
> --- a/hgext/largefiles/reposetup.py Fri Oct 28 12:57:59 2011 +0200
> +++ b/hgext/largefiles/reposetup.py Fri Oct 28 14:00:10 2011 +0200
> @@ -401,7 +401,7 @@
>
> 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.store.encode('data/'+lfutil.shortname) in f[0] for f in repo.store._walk('data', False)):
> repo.requirements.add('largefiles')
> repo._writerequirements()
I spot two check-code issues which I've resolved thusly:
diff -r 44cbe5967b76 hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py Fri Oct 28 14:00:10 2011 +0200
+++ b/hgext/largefiles/reposetup.py Fri Oct 28 18:01:57 2011 -0500
@@ -400,8 +400,9 @@
repo.__class__ = lfiles_repo
def checkrequireslfiles(ui, repo, **kwargs):
- if 'largefiles' not in repo.requirements and util.any(
- repo.store.encode('data/'+lfutil.shortname) in f[0] for f in repo.store._walk('data', False)):
+ if ('largefiles' not in repo.requirements and
+ util.any(repo.store.encode('data/' + lfutil.shortname)
+ in f[0] for f in repo.store._walk('data', False))):
repo.requirements.add('largefiles')
repo._writerequirements()
but this doesn't work at all on repos that aren't "dot-encoded":
File "/home/mpm/hg/hgext/largefiles/reposetup.py", line 405, in checkrequireslfiles
in f[0] for f in repo.store._walk('data', False))):
File "/home/mpm/hg/hgext/largefiles/reposetup.py", line 405, in <genexpr>
in f[0] for f in repo.store._walk('data', False))):
AttributeError: 'encodedstore' object has no attribute 'encode'
Ironic error message, I know.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list