changeset 13341:4e33ef68b1f8

remove pointless os.path.join calls when opening files in .hg/cache Windows deals just fine with '/' in paths and Mercurial on Windows already does file accesses elsewhere with mixed \ and / in file paths anyway. This patch also makes the static-http repo case use proper URLs of the form http://example.com/repo/.hg/cache/branchheads http://example.com/repo/.hg/cache/tags instead of the entirely pointless http://example.com/repo/.hg/cache%5Cbranchheads http://example.com/repo/.hg/cache%5tags (as introduced by 5ccdca7df211)
author Adrian Buehlmann <adrian@cadifra.com>
date Mon, 17 Jan 2011 09:37:20 +0100
parents 8f5c865b7b4a
children 2dc7a2a96cfd
files mercurial/localrepo.py mercurial/tags.py
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Feb 01 17:53:50 2011 -0600
+++ b/mercurial/localrepo.py	Mon Jan 17 09:37:20 2011 +0100
@@ -439,7 +439,7 @@
     def _readbranchcache(self):
         partial = {}
         try:
-            f = self.opener(os.path.join("cache", "branchheads"))
+            f = self.opener("cache/branchheads")
             lines = f.read().split('\n')
             f.close()
         except (IOError, OSError):
@@ -467,8 +467,7 @@
 
     def _writebranchcache(self, branches, tip, tiprev):
         try:
-            f = self.opener(os.path.join("cache", "branchheads"), "w",
-                            atomictemp=True)
+            f = self.opener("cache/branchheads", "w", atomictemp=True)
             f.write("%s %s\n" % (hex(tip), tiprev))
             for label, nodes in branches.iteritems():
                 for node in nodes:
--- a/mercurial/tags.py	Tue Feb 01 17:53:50 2011 -0600
+++ b/mercurial/tags.py	Mon Jan 17 09:37:20 2011 +0100
@@ -152,7 +152,7 @@
     set, caller is responsible for reading tag info from each head.'''
 
     try:
-        cachefile = repo.opener(os.path.join('cache', 'tags'), 'r')
+        cachefile = repo.opener('cache/tags', 'r')
         # force reading the file for static-http
         cachelines = iter(cachefile)
     except IOError:
@@ -249,8 +249,7 @@
 def _writetagcache(ui, repo, heads, tagfnode, cachetags):
 
     try:
-        cachefile = repo.opener(os.path.join('cache', 'tags'), 'w',
-                                atomictemp=True)
+        cachefile = repo.opener('cache/tags', 'w', atomictemp=True)
     except (OSError, IOError):
         return