[PATCH 1 of 2 Repost] move tags.cache and branchheads.cache to a collected cache folder .hg/caches/

Adrian Buehlmann adrian at cadifra.com
Sun Jan 16 17:07:09 CST 2011


On 2011-01-16 23:34, Benoit Boissinot wrote:
> On Sun, Jan 16, 2011 at 11:24:36PM +0100, Adrian Buehlmann wrote:
>> On 2011-01-16 19:54, Benoit Boissinot wrote:
>>> On Sun, Jan 16, 2011 at 05:54:13PM +0100, Adrian Buehlmann wrote:
>>>> On 2011-01-16 17:42, Benoit Boissinot wrote:
>>>>> On Sun, Jan 16, 2011 at 02:18:02AM +0100, Jason Harris wrote:
>>>>>> # HG changeset patch
>>>>>> # User jfh <jason at jasonfharris.com>
>>>>>> # Date 1294118948 -3600
>>>>>> # Node ID 65a39818367f9657a291cade204e7f574e919dbc
>>>>>> # Parent  1f4721de2ca9744b3488bf050a11ed23e89889d6
>>>>>> move tags.cache and branchheads.cache to a collected cache folder .hg/caches/
>>>>>
>>>>> I slightly edited it:
>>>>> - changed to .hg/cache (like others, I find .hg/cache/ more natural on unix)
>>>>> - removed the .cache suffix as suggested by Adrian (it's redundant)
>>>>>
>>>>> queued, thanks!
>>>>>
>>>>> Benoit
>>>>
>>>> Did you consider that using os.path.join is wrong on Windows for forming
>>>> paths for e.g. static-http?
>>>
>>> Yes, although the harm isn't very big, since static-http isn't widely
>>> used and is already pretty slow.
>>
>> I was more concerned about working correct than speed.
> 
> It is obviously not optimal, but I think it will not do any "incorrect"
> thing. That is, it will get a 404 instead of accessing the file, which
> isn't "incorrect" since the file is just a cache.
>

Sure, but then what is the point of inserting 'os.path.join("caches",
..)' wherever there is an access to a cache file?

We might (for example) as well just do

--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -439,7 +439,7 @@
     def _readbranchcache(self):
         partial = {}
         try:
-            f = self.opener("branchheads.cache")
+            f = self.opener("cache/branchheads")
             lines = f.read().split('\n')
             f.close()
         except (IOError, OSError):

instead of (as pushed to crew):

--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -439,7 +439,7 @@
     def _readbranchcache(self):
         partial = {}
         try:
-            f = self.opener("branchheads.cache")
+            f = self.opener(os.path.join("cache", "branchheads"))
             lines = f.read().split('\n')
             f.close()
         except (IOError, OSError):

Windows can deal with / in path just fine and mercurial on Windows
anyway already does file accesses with mixed \ and / in path.

>> (BTW, I found this repo by google-ing for some static-http repo. Maybe
>> someone knows of a better static-http testrepo with some branch names !=
>> default)
> 
> use "python -m BaseHTTPServer" in the root of a repo. Then
> http://localhost:8000 should be a static-http repo.


More information about the Mercurial-devel mailing list