[PATCH 2 of 2] store: reuse direncoded path in _hybridencode

Adrian Buehlmann adrian at cadifra.com
Tue Sep 18 15:03:24 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1347990719 -7200
# Node ID fdee2bb450d86c848195e87e6e86b468ce234211
# Parent  4a376bb49e43372065664d6141c15a70a79f0dd2
store: reuse direncoded path in _hybridencode

For a netbeans clone on Windows 7 x64:

  Before:
    $ hg perffncacheencode
    ! wall 3.516000 comb 3.525623 user 3.525623 sys 0.000000 (best of 3)

  After:
    $ hg perffncacheencode
    ! wall 3.443000 comb 3.447622 user 3.447622 sys 0.000000 (best of 3)

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -215,10 +215,10 @@
     The string 'data/' at the beginning is replaced with 'dh/', if the hashed
     encoding was used.
     '''
-    ef = encodefilename(path).split('/')
+    path = encodedir(path)
+    ef = _encodefname(path).split('/')
     res = '/'.join(_auxencode(ef, dotencode))
     if len(res) > _maxstorepathlen:
-        path = encodedir(path)
         digest = _sha(path).hexdigest()
         le = lowerencode(path).split('/')[1:]
         parts = _auxencode(le, dotencode)


More information about the Mercurial-devel mailing list