Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 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 | dc11e30b48a3 |
children | cce2e7b77e36 |
comparison
equal
deleted
inserted
replaced
13338:8f5c865b7b4a | 13341:4e33ef68b1f8 |
---|---|
437 return bt | 437 return bt |
438 | 438 |
439 def _readbranchcache(self): | 439 def _readbranchcache(self): |
440 partial = {} | 440 partial = {} |
441 try: | 441 try: |
442 f = self.opener(os.path.join("cache", "branchheads")) | 442 f = self.opener("cache/branchheads") |
443 lines = f.read().split('\n') | 443 lines = f.read().split('\n') |
444 f.close() | 444 f.close() |
445 except (IOError, OSError): | 445 except (IOError, OSError): |
446 return {}, nullid, nullrev | 446 return {}, nullid, nullrev |
447 | 447 |
465 partial, last, lrev = {}, nullid, nullrev | 465 partial, last, lrev = {}, nullid, nullrev |
466 return partial, last, lrev | 466 return partial, last, lrev |
467 | 467 |
468 def _writebranchcache(self, branches, tip, tiprev): | 468 def _writebranchcache(self, branches, tip, tiprev): |
469 try: | 469 try: |
470 f = self.opener(os.path.join("cache", "branchheads"), "w", | 470 f = self.opener("cache/branchheads", "w", atomictemp=True) |
471 atomictemp=True) | |
472 f.write("%s %s\n" % (hex(tip), tiprev)) | 471 f.write("%s %s\n" % (hex(tip), tiprev)) |
473 for label, nodes in branches.iteritems(): | 472 for label, nodes in branches.iteritems(): |
474 for node in nodes: | 473 for node in nodes: |
475 f.write("%s %s\n" % (hex(node), encoding.fromlocal(label))) | 474 f.write("%s %s\n" % (hex(node), encoding.fromlocal(label))) |
476 f.rename() | 475 f.rename() |