store: remove uneeded startswith('data/') checks in encodedir() and decodedir()
authorAdrian Buehlmann <adrian@cadifra.com>
Sat, 15 Sep 2012 21:44:08 +0200
changeset 17586 2f1475da1940
parent 17585 8ed2783f338f
child 17587 5fb8cf6f4f58
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
mercurial/store.py
--- a/mercurial/store.py	Sat Sep 15 21:43:56 2012 +0200
+++ b/mercurial/store.py	Sat Sep 15 21:44:08 2012 +0200
@@ -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/")