changeset 26378:e749707f0afb

revlog: always open revlogs for reading and appending An upcoming patch will teach revlogs to use the existing file handle to read revision data instead of opening a new file handle just for quick reads. For this to work, files must be opened for reading as well. This patch is merely cosmetic: there are no behavior changes.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 27 Sep 2015 15:59:19 -0700
parents dfef0d3be65e
children 39d643252b9f
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Sun Sep 27 15:48:35 2015 -0700
+++ b/mercurial/revlog.py	Sun Sep 27 15:59:19 2015 -0700
@@ -1218,7 +1218,7 @@
 
         dfh = None
         if not self._inline:
-            dfh = self.opener(self.datafile, "a")
+            dfh = self.opener(self.datafile, "a+")
         ifh = self.opener(self.indexfile, "a+")
         try:
             return self._addrevision(node, text, transaction, link, p1, p2,
@@ -1467,7 +1467,7 @@
         else:
             transaction.add(self.indexfile, isize, r)
             transaction.add(self.datafile, end)
-            dfh = self.opener(self.datafile, "a")
+            dfh = self.opener(self.datafile, "a+")
         def flush():
             if dfh:
                 dfh.flush()
@@ -1535,8 +1535,8 @@
                     # addrevision switched from inline to conventional
                     # reopen the index
                     ifh.close()
-                    dfh = self.opener(self.datafile, "a")
-                    ifh = self.opener(self.indexfile, "a")
+                    dfh = self.opener(self.datafile, "a+")
+                    ifh = self.opener(self.indexfile, "a+")
         finally:
             if dfh:
                 dfh.close()