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

mail settings
Submitter Pierre-Yves David
Date Jan. 4, 2013, 1:04 a.m.
Message ID <7defb8a8e87dbfaacbcb.1357261447@yamac.lan>
Download mbox | patch
Permalink /patch/373/
State Accepted
Commit 5e851ca541894418740cd7ba39fc6929e753e11c
Headers show


Pierre-Yves David - Jan. 4, 2013, 1:04 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at>
# 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


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -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