# HG changeset patch # User Pierre-Yves David # Date 2021-05-03 10:27:31 # Node ID 100f061d88f610c1952333c59e1a297b3922bdda # Parent 0cf537d85f4c7029b46494c2775d05b3627d8876 revlog: preindent some code in _enforceinlinesize Indenting this beforehand will make a future changeset much simpler. Differential Revision: https://phab.mercurial-scm.org/D10604 diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1982,29 +1982,30 @@ class revlog(object): # its usage. self._writinghandles = None - with self._indexfp(b'r') as ifh, self._datafp(b'w') as dfh: - for r in self: - dfh.write(self._getsegmentforrevs(r, r, df=ifh)[1]) - if troffset <= self.start(r): - trindex = r - - with self._indexfp(b'w') as fp: - self._format_flags &= ~FLAG_INLINE_DATA - self._inline = False - for i in self: - e = self.index.entry_binary(i) - if i == 0: - header = self._format_flags | self._format_version - header = self.index.pack_header(header) - e = header + e - fp.write(e) - - # the temp file replace the real index when we exit the context - # manager - - tr.replace(self._indexfile, trindex * self.index.entry_size) - nodemaputil.setup_persistent_nodemap(tr, self) - self._chunkclear() + if True: + with self._indexfp(b'r') as ifh, self._datafp(b'w') as dfh: + for r in self: + dfh.write(self._getsegmentforrevs(r, r, df=ifh)[1]) + if troffset <= self.start(r): + trindex = r + + with self._indexfp(b'w') as fp: + self._format_flags &= ~FLAG_INLINE_DATA + self._inline = False + for i in self: + e = self.index.entry_binary(i) + if i == 0: + header = self._format_flags | self._format_version + header = self.index.pack_header(header) + e = header + e + fp.write(e) + + # the temp file replace the real index when we exit the context + # manager + + tr.replace(self._indexfile, trindex * self.index.entry_size) + nodemaputil.setup_persistent_nodemap(tr, self) + self._chunkclear() def _nodeduplicatecallback(self, transaction, node): """called when trying to add a node already stored."""