[PATCH 10 of 10] store: remove uneeded startswith('data/') checks in encodedir() and decodedir()
Adrian Buehlmann
adrian at cadifra.com
Sat Sep 15 16:01:51 CDT 2012
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1347738248 -7200
# Node ID 635677490a48978dd730f17c01fabf38a9a20c1e
# Parent ae4c4fab9e23816a243ce844efbc168b83902551
store: remove uneeded startswith('data/') checks in encodedir() and decodedir()
I don't think we will ever have anything in the store that resides inside a
directory that ends in .i or .d under store/ that we wouldn't want to have
direncoded. The files not under data/ surely don't need direncoding, but it
doesn't harm to let these few run through it. It hurts more to check whether the
thousands of other files start with 'data/'. They do anyway.
See also 810387f59696 (fixed with c31fe74a6633), which moved the direncoding
from filelog into store
diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -22,8 +22,6 @@
>>> encodedir('data/foo.i.hg/bla.i')
'data/foo.i.hg.hg/bla.i'
'''
- if not path.startswith('data/'):
- return path
return (path
.replace(".hg/", ".hg.hg/")
.replace(".i/", ".i.hg/")
@@ -38,7 +36,7 @@
>>> decodedir('data/foo.i.hg.hg/bla.i')
'data/foo.i.hg/bla.i'
'''
- if not path.startswith('data/') or ".hg/" not in path:
+ if ".hg/" not in path:
return path
return (path
.replace(".d.hg/", ".d/")
More information about the Mercurial-devel
mailing list