mercurial/bundlerepo.py
changeset 18410 de7dac2a58e8
parent 18216 46f624780ee8
child 18411 8b0f0dd56cec
equal deleted inserted replaced
18409:e3f5cef11d6a 18410:de7dac2a58e8
    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:
    23         # to retrieve a revision, we need to know the offset of
    23         # To retrieve a revision, we need to know the offset of the revision in
    24         # the revision in the bundle (an unbundle object).
    24         # the bundle (an unbundle object). We store this offset in the index
       
    25         # (start).
    25         #
    26         #
    26         # We store this offset in the index (start), to differentiate a
    27         # basemap is indexed with revisions coming from the bundle, and it
    27         # rev in the bundle and from a rev in the revlog, we check
    28         # maps to the corresponding node that is the base of the corresponding
    28         # len(index[r]). If the tuple is bigger than 7, it is a bundle
    29         # delta.
    29         # (it is bigger since we store the node to which the delta is)
       
    30         #
    30         #
       
    31         # To differentiate a rev in the bundle from a rev in the revlog, we
       
    32         # check revision against basemap.
    31         opener = scmutil.readonlyvfs(opener)
    33         opener = scmutil.readonlyvfs(opener)
    32         revlog.revlog.__init__(self, opener, indexfile)
    34         revlog.revlog.__init__(self, opener, indexfile)
    33         self.bundle = bundle
    35         self.bundle = bundle
    34         self.basemap = {}
    36         self.basemap = {}
    35         n = len(self)
    37         n = len(self)
   383         if bundle:
   385         if bundle:
   384             os.unlink(bundle)
   386             os.unlink(bundle)
   385         other.close()
   387         other.close()
   386 
   388 
   387     return (localrepo, csets, cleanup)
   389     return (localrepo, csets, cleanup)
   388