# HG changeset patch # User Adrian Buehlmann # Date 2012-09-30 21:53:56 # Node ID fb458b3e72fc220d02b9394a0951842cb406002a # Parent c6c7e466dd3a1d6af55b7f270530b64a7cf2927d pathencode: skip encoding if input is already longer than maxstorepathlen Calling basicencode may make the path longer, never shorter. If it's already too long before, then we don't even need to basicencode it. diff --git a/mercurial/pathencode.c b/mercurial/pathencode.c --- a/mercurial/pathencode.c +++ b/mercurial/pathencode.c @@ -501,6 +501,12 @@ PyObject *pathencode(PyObject *self, PyO return NULL; } + if (len > maxstorepathlen) { + newobj = Py_None; + Py_INCREF(newobj); + return newobj; + } + newlen = len ? basicencode(NULL, 0, path, len + 1) : 1; if (newlen <= maxstorepathlen + 1) {