[PATCH 04 of 18 V2] bundlerepo: enforce reading from core repo only

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Jan 3 19:04:07 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1356658367 -3600
# Node ID 7defb8a8e87dbfaacbcbf51c68e50f33c5a403c2
# Parent  3152faab1da3699af0637d78e6b9b3b74a9e3fab
bundlerepo: enforce reading from core repo only

We do not want anything computed with the bundle overlay to be written back in
the repo. Such write will likely contains invalid data.

The short terms goal of this change is to drop use of `_cacheabletip` in bundle
repo.

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -12,11 +12,11 @@ were part of the actual repository.
 """
 
 from node import nullid
 from i18n import _
 import os, tempfile, shutil
-import changegroup, util, mdiff, discovery, cmdutil
+import changegroup, util, mdiff, discovery, cmdutil, scmutil
 import localrepo, changelog, manifest, filelog, revlog, error
 
 class bundlerevlog(revlog.revlog):
     def __init__(self, opener, indexfile, bundle, linkmapper):
         # How it works:
@@ -26,10 +26,11 @@ class bundlerevlog(revlog.revlog):
         # We store this offset in the index (start), to differentiate a
         # rev in the bundle and from a rev in the revlog, we check
         # len(index[r]). If the tuple is bigger than 7, it is a bundle
         # (it is bigger since we store the node to which the delta is)
         #
+        opener = scmutil.readonlyvfs(opener)
         revlog.revlog.__init__(self, opener, indexfile)
         self.bundle = bundle
         self.basemap = {}
         n = len(self)
         self.disktiprev = n - 1


More information about the Mercurial-devel mailing list