# HG changeset patch # User Mads Kiilerich # Date 1355422746 -3600 # Node ID 90ad387d924521272eb835b81531268094c7ca4e # Parent 14e31a631e413fdd9a22d90ff7065357c08a603b largefiles: use constant for '.hglf/' Problem: '.hglf' + '/' was computed in some tight loops. There is no need for that. diff -r 14e31a631e41 -r 90ad387d9245 hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py Thu Dec 13 19:19:06 2012 +0100 +++ b/hgext/largefiles/lfutil.py Thu Dec 13 19:19:06 2012 +0100 @@ -18,6 +18,7 @@ from mercurial.i18n import _ shortname = '.hglf' +shortnameslash = shortname + '/' longname = 'largefiles' @@ -291,12 +292,12 @@ # 2) Join with '/' because that's what dirstate always uses, even on # Windows. Change existing separator to '/' first in case we are # passed filenames from an external source (like the command line). - return shortname + '/' + util.pconvert(filename) + return shortnameslash + util.pconvert(filename) def isstandin(filename): '''Return true if filename is a big file standin. filename must be in Mercurial's internal form (slash-separated).''' - return filename.startswith(shortname + '/') + return filename.startswith(shortnameslash) def splitstandin(filename): # Split on / because that's what dirstate always uses, even on Windows. @@ -425,7 +426,7 @@ def islfilesrepo(repo): if ('largefiles' in repo.requirements and - util.any(shortname + '/' in f[0] for f in repo.store.datafiles())): + util.any(shortnameslash in f[0] for f in repo.store.datafiles())): return True return util.any(openlfdirstate(repo.ui, repo, False))