##// END OF EJS Templates
branchmap: move the cache file name into a dedicated function...
Pierre-Yves David -
r18185:5a047276 default
parent child Browse files
Show More
@@ -9,9 +9,13 b' from node import bin, hex, nullid, nullr'
9 import encoding
9 import encoding
10 import util
10 import util
11
11
12 def _filename(repo):
13 """name of a branchcache file for a given repo"""
14 return "cache/branchheads"
15
12 def read(repo):
16 def read(repo):
13 try:
17 try:
14 f = repo.opener("cache/branchheads")
18 f = repo.opener(_filename(repo))
15 lines = f.read().split('\n')
19 lines = f.read().split('\n')
16 f.close()
20 f.close()
17 except (IOError, OSError):
21 except (IOError, OSError):
@@ -117,7 +121,7 b' class branchcache(dict):'
117
121
118 def write(self, repo):
122 def write(self, repo):
119 try:
123 try:
120 f = repo.opener("cache/branchheads", "w", atomictemp=True)
124 f = repo.opener(_filename(repo), "w", atomictemp=True)
121 cachekey = [hex(self.tipnode), str(self.tiprev)]
125 cachekey = [hex(self.tipnode), str(self.tiprev)]
122 if self.filteredhash is not None:
126 if self.filteredhash is not None:
123 cachekey.append(hex(self.filteredhash))
127 cachekey.append(hex(self.filteredhash))
General Comments 0
You need to be logged in to leave comments. Login now