comparison mercurial/bundlerepo.py @ 18215:5e851ca54189

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.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 28 Dec 2012 02:32:47 +0100
parents 11d1a9143adb
children 46f624780ee8
comparison
equal deleted inserted replaced
18214:cd4c75200206 18215:5e851ca54189
12 """ 12 """
13 13
14 from node import nullid 14 from node import nullid
15 from i18n import _ 15 from i18n import _
16 import os, tempfile, shutil 16 import os, tempfile, shutil
17 import changegroup, util, mdiff, discovery, cmdutil 17 import changegroup, util, mdiff, discovery, cmdutil, scmutil
18 import localrepo, changelog, manifest, filelog, revlog, error 18 import localrepo, changelog, manifest, filelog, revlog, error
19 19
20 class bundlerevlog(revlog.revlog): 20 class bundlerevlog(revlog.revlog):
21 def __init__(self, opener, indexfile, bundle, linkmapper): 21 def __init__(self, opener, indexfile, bundle, linkmapper):
22 # How it works: 22 # How it works:
26 # We store this offset in the index (start), to differentiate a 26 # We store this offset in the index (start), to differentiate a
27 # rev in the bundle and from a rev in the revlog, we check 27 # rev in the bundle and from a rev in the revlog, we check
28 # len(index[r]). If the tuple is bigger than 7, it is a bundle 28 # len(index[r]). If the tuple is bigger than 7, it is a bundle
29 # (it is bigger since we store the node to which the delta is) 29 # (it is bigger since we store the node to which the delta is)
30 # 30 #
31 opener = scmutil.readonlyvfs(opener)
31 revlog.revlog.__init__(self, opener, indexfile) 32 revlog.revlog.__init__(self, opener, indexfile)
32 self.bundle = bundle 33 self.bundle = bundle
33 self.basemap = {} 34 self.basemap = {}
34 n = len(self) 35 n = len(self)
35 self.disktiprev = n - 1 36 self.disktiprev = n - 1