# HG changeset patch # User Adrian Buehlmann # Date 2012-09-30 21:53:56 # Node ID 0c6de45e12127d5f64327775f734cedb5d5ef2ff # Parent fb458b3e72fc220d02b9394a0951842cb406002a 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. diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -255,6 +255,8 @@ def _hybridencode(path, dotencode): 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: