1861 |
1861 |
1862 with self._datafp('w') as df: |
1862 with self._datafp('w') as df: |
1863 for r in self: |
1863 for r in self: |
1864 df.write(self._getsegmentforrevs(r, r)[1]) |
1864 df.write(self._getsegmentforrevs(r, r)[1]) |
1865 |
1865 |
1866 fp = self._indexfp('w') |
1866 with self._indexfp('w') as fp: |
1867 self.version &= ~FLAG_INLINE_DATA |
1867 self.version &= ~FLAG_INLINE_DATA |
1868 self._inline = False |
1868 self._inline = False |
1869 for i in self: |
1869 io = self._io |
1870 e = self._io.packentry(self.index[i], self.node, self.version, i) |
1870 for i in self: |
1871 fp.write(e) |
1871 e = io.packentry(self.index[i], self.node, self.version, i) |
1872 |
1872 fp.write(e) |
1873 # if we don't call close, the temp file will never replace the |
1873 |
1874 # real index |
1874 # the temp file replace the real index when we exit the context |
1875 fp.close() |
1875 # manager |
1876 |
1876 |
1877 tr.replace(self.indexfile, trindex * self._io.size) |
1877 tr.replace(self.indexfile, trindex * self._io.size) |
1878 self._chunkclear() |
1878 self._chunkclear() |
1879 |
1879 |
1880 def addrevision(self, text, transaction, link, p1, p2, cachedelta=None, |
1880 def addrevision(self, text, transaction, link, p1, p2, cachedelta=None, |