changeset 47224:100f061d88f6

revlog: preindent some code in _enforceinlinesize Indenting this beforehand will make a future changeset much simpler. Differential Revision: https://phab.mercurial-scm.org/D10604
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 03 May 2021 12:27:31 +0200
parents 0cf537d85f4c
children 906a7bcaac86
files mercurial/revlog.py
diffstat 1 files changed, 24 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Mon May 03 12:27:20 2021 +0200
+++ b/mercurial/revlog.py	Mon May 03 12:27:31 2021 +0200
@@ -1982,29 +1982,30 @@
             # 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."""