# HG changeset patch # User Gregory Szorc # Date 2015-09-27 22:59:19 # Node ID e749707f0afbbf9f7bf4969c3d513c0ce4eda22d # Parent dfef0d3be65e28e71d09f2f9cff47c4d23fb03ea 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. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1218,7 +1218,7 @@ class revlog(object): 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 @@ class revlog(object): 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 @@ class revlog(object): # 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()