##// END OF EJS Templates
changelog: swap opener to switch delay modes
Matt Mackall -
r9165:07f9b2f4 default
parent child Browse files
Show More
@@ -89,20 +89,22 b' class appender(object):'
89 89
90 90 class changelog(revlog.revlog):
91 91 def __init__(self, opener):
92 revlog.revlog.__init__(self, opener, "00changelog.i")
92 93 self._realopener = opener
93 94 self._delayed = False
94 95 self._divert = False
95 revlog.revlog.__init__(self, self._delayopener, "00changelog.i")
96 96
97 97 def delayupdate(self):
98 98 "delay visibility of index updates to other readers"
99 99 self._delayed = True
100 100 self._divert = (len(self) == 0)
101 101 self._delaybuf = []
102 self.opener = self._delayopener
102 103
103 104 def finalize(self, tr):
104 105 "finalize index updates"
105 106 self._delayed = False
107 self.opener = self._realopener
106 108 # move redirected index data back into place
107 109 if self._divert:
108 110 n = self._realopener(self.indexfile).name
@@ -118,7 +120,7 b' class changelog(revlog.revlog):'
118 120 def _delayopener(self, name, mode='r'):
119 121 fp = self._realopener(name, mode)
120 122 # only divert the index
121 if not self._delayed or not name == self.indexfile:
123 if not name == self.indexfile:
122 124 return fp
123 125 # if we're doing an initial clone, divert to another file
124 126 if self._divert:
@@ -155,9 +157,8 b' class changelog(revlog.revlog):'
155 157 return False
156 158
157 159 def checkinlinesize(self, tr, fp=None):
158 if self.opener == self._delayopener:
159 return
160 return revlog.revlog.checkinlinesize(self, tr, fp)
160 if not self._delayed:
161 revlog.revlog.checkinlinesize(self, tr, fp)
161 162
162 163 def read(self, node):
163 164 """
General Comments 0
You need to be logged in to leave comments. Login now