Mercurial > public > mercurial-scm > hg-stable
diff mercurial/store.py @ 17693:0c6de45e1212
store: optimize _pathencode by checking the length of the unencoded path
If the input path is already longer than _maxstorepathlen, then we can skip
doing the basic encoding (encodedir, _encodefname and _auxencode) and directly
proceed to the hashed encoding. Those encodings, if at all, will make the path
only longer.
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Sun, 30 Sep 2012 23:53:56 +0200 |
parents | dacb50696b75 |
children | cf236e3501c3 |
line wrap: on
line diff
--- a/mercurial/store.py Sun Sep 30 23:53:56 2012 +0200 +++ b/mercurial/store.py Sun Sep 30 23:53:56 2012 +0200 @@ -255,6 +255,8 @@ return res def _pathencode(path): + if len(path) > _maxstorepathlen: + return None ef = _encodefname(encodedir(path)).split('/') res = '/'.join(_auxencode(ef, True)) if len(res) > _maxstorepathlen: