Patchwork [03,of,16] bundlerepo: enforce reading from core repo only

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 2, 2013, 1:09 a.m.
Message ID <de5ef8a195d3cfc307da.1357088965@yamac.lan>
Download mbox | patch
Permalink /patch/348/
State Superseded, archived
Commit 5e851ca541894418740cd7ba39fc6929e753e11c
Headers show

Comments

Pierre-Yves David - Jan. 2, 2013, 1:09 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1356658367 -3600
# Node ID de5ef8a195d3cfc307dac4d56ad52b431392a3a0
# Parent  f347244a1d604ed96f3a4231e1bb1868fb60c533
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.

Patch

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