##// END OF EJS Templates
revlog: use context manager for index file lifetime in checkinlinesize...
Boris Feld -
r35989:0f2c51af default
parent child Browse files
Show More
@@ -1863,16 +1863,16 b' class revlog(object):'
1863 1863 for r in self:
1864 1864 df.write(self._getsegmentforrevs(r, r)[1])
1865 1865
1866 fp = self._indexfp('w')
1867 self.version &= ~FLAG_INLINE_DATA
1868 self._inline = False
1869 for i in self:
1870 e = self._io.packentry(self.index[i], self.node, self.version, i)
1871 fp.write(e)
1866 with self._indexfp('w') as fp:
1867 self.version &= ~FLAG_INLINE_DATA
1868 self._inline = False
1869 io = self._io
1870 for i in self:
1871 e = io.packentry(self.index[i], self.node, self.version, i)
1872 fp.write(e)
1872 1873
1873 # if we don't call close, the temp file will never replace the
1874 # real index
1875 fp.close()
1874 # the temp file replace the real index when we exit the context
1875 # manager
1876 1876
1877 1877 tr.replace(self.indexfile, trindex * self._io.size)
1878 1878 self._chunkclear()
General Comments 0
You need to be logged in to leave comments. Login now