mercurial/filelog.py
author Gregory Szorc <gregory.szorc@gmail.com>
Thu, 30 Nov 2017 21:19:46 -0500
branchstable
changeset 37833 6614cac550ae
parent 37810 856f381ad74b
child 38736 93777d16a25d
permissions -rw-r--r--
filelog: don't crash on invalid copy metadata (issue5748) "copy" and "copyrev" are both supposed to appear next to each other. However, a user report demonstrated a crash that indicates that something in the wild is producing "copy" without "copyrev" (probably `hg convert`). While we should definitely fix the source of the bad metadata, the bad code causing the crash is already in the wild and who knows how many repositories are impacted. So let's be more defensive when accessing the file revision metadata.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1089
142b5d5ec9cc Break apart hg.py
mpm@selenic.com
parents: 1072
diff changeset
     1
# filelog.py - file history class for mercurial
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     2
#
4635
63b9d2deed48 Updated copyright notices and add "and others" to "hg version"
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4258
diff changeset
     3
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     4
#
8225
46293a0c7e9f updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents: 7634
diff changeset
     5
# This software may be used and distributed according to the terms of the
10263
25e572394f5c Update license to GPLv2+
Matt Mackall <mpm@selenic.com>
parents: 8531
diff changeset
     6
# GNU General Public License version 2 or any later version.
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     7
25948
34bd1a5eef5b filelog: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24255
diff changeset
     8
from __future__ import absolute_import
34bd1a5eef5b filelog: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24255
diff changeset
     9
34bd1a5eef5b filelog: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24255
diff changeset
    10
from . import (
37497
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    11
    error,
37441
a3202fa83aff filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35567
diff changeset
    12
    repository,
25948
34bd1a5eef5b filelog: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24255
diff changeset
    13
    revlog,
34bd1a5eef5b filelog: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24255
diff changeset
    14
)
37810
856f381ad74b interfaceutil: module to stub out zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37497
diff changeset
    15
from .utils import (
856f381ad74b interfaceutil: module to stub out zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37497
diff changeset
    16
    interfaceutil,
856f381ad74b interfaceutil: module to stub out zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37497
diff changeset
    17
)
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    18
37810
856f381ad74b interfaceutil: module to stub out zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37497
diff changeset
    19
@interfaceutil.implementer(repository.ifilestorage)
37497
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    20
class filelog(object):
4258
b11a2fb59cf5 revlog: simplify revlog version handling
Matt Mackall <mpm@selenic.com>
parents: 4257
diff changeset
    21
    def __init__(self, opener, path):
37497
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    22
        self._revlog = revlog.revlog(opener,
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    23
                                     '/'.join(('data', path + '.i')),
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    24
                                     censorable=True)
35567
07769a04bc66 filelog: add the ability to report the user facing name
Matt Harbison <matt_harbison@yahoo.com>
parents: 34023
diff changeset
    25
        # full name of the user visible file, relative to the repository root
07769a04bc66 filelog: add the ability to report the user facing name
Matt Harbison <matt_harbison@yahoo.com>
parents: 34023
diff changeset
    26
        self.filename = path
37497
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    27
        self.index = self._revlog.index
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    28
        self.version = self._revlog.version
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    29
        self.storedeltachains = self._revlog.storedeltachains
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    30
        self._generaldelta = self._revlog._generaldelta
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    31
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    32
    def __len__(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    33
        return len(self._revlog)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    34
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    35
    def __iter__(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    36
        return self._revlog.__iter__()
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    37
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    38
    def revs(self, start=0, stop=None):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    39
        return self._revlog.revs(start=start, stop=stop)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    40
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    41
    def parents(self, node):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    42
        return self._revlog.parents(node)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    43
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    44
    def parentrevs(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    45
        return self._revlog.parentrevs(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    46
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    47
    def rev(self, node):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    48
        return self._revlog.rev(node)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    49
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    50
    def node(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    51
        return self._revlog.node(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    52
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    53
    def lookup(self, node):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    54
        return self._revlog.lookup(node)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    55
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    56
    def linkrev(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    57
        return self._revlog.linkrev(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    58
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    59
    def flags(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    60
        return self._revlog.flags(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    61
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    62
    def commonancestorsheads(self, node1, node2):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    63
        return self._revlog.commonancestorsheads(node1, node2)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    64
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    65
    def descendants(self, revs):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    66
        return self._revlog.descendants(revs)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    67
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    68
    def headrevs(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    69
        return self._revlog.headrevs()
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    70
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    71
    def heads(self, start=None, stop=None):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    72
        return self._revlog.heads(start, stop)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    73
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    74
    def children(self, node):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    75
        return self._revlog.children(node)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    76
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    77
    def deltaparent(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    78
        return self._revlog.deltaparent(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    79
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    80
    def candelta(self, baserev, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    81
        return self._revlog.candelta(baserev, rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    82
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    83
    def iscensored(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    84
        return self._revlog.iscensored(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    85
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    86
    def rawsize(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    87
        return self._revlog.rawsize(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    88
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    89
    def checkhash(self, text, node, p1=None, p2=None, rev=None):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    90
        return self._revlog.checkhash(text, node, p1=p1, p2=p2, rev=rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    91
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    92
    def revision(self, node, _df=None, raw=False):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    93
        return self._revlog.revision(node, _df=_df, raw=raw)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    94
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    95
    def revdiff(self, rev1, rev2):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    96
        return self._revlog.revdiff(rev1, rev2)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    97
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    98
    def addrevision(self, revisiondata, transaction, linkrev, p1, p2,
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
    99
                    node=None, flags=revlog.REVIDX_DEFAULT_FLAGS,
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   100
                    cachedelta=None):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   101
        return self._revlog.addrevision(revisiondata, transaction, linkrev,
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   102
                                    p1, p2, node=node, flags=flags,
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   103
                                    cachedelta=cachedelta)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   104
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   105
    def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   106
        return self._revlog.addgroup(deltas, linkmapper, transaction,
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   107
                                 addrevisioncb=addrevisioncb)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   108
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   109
    def getstrippoint(self, minlink):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   110
        return self._revlog.getstrippoint(minlink)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   111
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   112
    def strip(self, minlink, transaction):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   113
        return self._revlog.strip(minlink, transaction)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   114
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   115
    def files(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   116
        return self._revlog.files()
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   117
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   118
    def checksize(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   119
        return self._revlog.checksize()
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
   120
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
   121
    def read(self, node):
360
10519e4cbd02 filelog: add metadata support
mpm@selenic.com
parents: 358
diff changeset
   122
        t = self.revision(node)
686
d7d68d27ebe5 Reapply startswith() changes that got lost with stale edit
Matt Mackall <mpm@selenic.com>
parents: 681
diff changeset
   123
        if not t.startswith('\1\n'):
360
10519e4cbd02 filelog: add metadata support
mpm@selenic.com
parents: 358
diff changeset
   124
            return t
2579
0875cda033fd use __contains__, index or split instead of str.find
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2470
diff changeset
   125
        s = t.index('\1\n', 2)
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
   126
        return t[s + 2:]
360
10519e4cbd02 filelog: add metadata support
mpm@selenic.com
parents: 358
diff changeset
   127
10519e4cbd02 filelog: add metadata support
mpm@selenic.com
parents: 358
diff changeset
   128
    def add(self, text, meta, transaction, link, p1=None, p2=None):
686
d7d68d27ebe5 Reapply startswith() changes that got lost with stale edit
Matt Mackall <mpm@selenic.com>
parents: 681
diff changeset
   129
        if meta or text.startswith('\1\n'):
37442
0596d27457c6 revlog: move parsemeta() and packmeta() from filelog (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37441
diff changeset
   130
            text = revlog.packmeta(meta, text)
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
   131
        return self.addrevision(text, transaction, link, p1, p2)
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
   132
1116
0cdd73b0767c Add some rename debugging support
mpm@selenic.com
parents: 1089
diff changeset
   133
    def renamed(self, node):
7634
14a4337a9b9b revlog: kill from-style imports
Matt Mackall <mpm@selenic.com>
parents: 7622
diff changeset
   134
        if self.parents(node)[0] != revlog.nullid:
1116
0cdd73b0767c Add some rename debugging support
mpm@selenic.com
parents: 1089
diff changeset
   135
            return False
13240
e5060aa22043 filelog: move metadata parsing to a helper function
Matt Mackall <mpm@selenic.com>
parents: 11541
diff changeset
   136
        t = self.revision(node)
37442
0596d27457c6 revlog: move parsemeta() and packmeta() from filelog (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37441
diff changeset
   137
        m = revlog.parsemeta(t)[0]
37833
6614cac550ae filelog: don't crash on invalid copy metadata (issue5748)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37810
diff changeset
   138
        # copy and copyrev occur in pairs. In rare cases due to bugs,
6614cac550ae filelog: don't crash on invalid copy metadata (issue5748)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37810
diff changeset
   139
        # one can occur without the other.
6614cac550ae filelog: don't crash on invalid copy metadata (issue5748)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37810
diff changeset
   140
        if m and "copy" in m and "copyrev" in m:
7634
14a4337a9b9b revlog: kill from-style imports
Matt Mackall <mpm@selenic.com>
parents: 7622
diff changeset
   141
            return (m["copy"], revlog.bin(m["copyrev"]))
1116
0cdd73b0767c Add some rename debugging support
mpm@selenic.com
parents: 1089
diff changeset
   142
        return False
0cdd73b0767c Add some rename debugging support
mpm@selenic.com
parents: 1089
diff changeset
   143
2898
db397c38005d merge: use file size stored in revlog index
Matt Mackall <mpm@selenic.com>
parents: 2895
diff changeset
   144
    def size(self, rev):
db397c38005d merge: use file size stored in revlog index
Matt Mackall <mpm@selenic.com>
parents: 2895
diff changeset
   145
        """return the size of a given revision"""
db397c38005d merge: use file size stored in revlog index
Matt Mackall <mpm@selenic.com>
parents: 2895
diff changeset
   146
db397c38005d merge: use file size stored in revlog index
Matt Mackall <mpm@selenic.com>
parents: 2895
diff changeset
   147
        # for revisions with renames, we have to go the slow way
db397c38005d merge: use file size stored in revlog index
Matt Mackall <mpm@selenic.com>
parents: 2895
diff changeset
   148
        node = self.node(rev)
db397c38005d merge: use file size stored in revlog index
Matt Mackall <mpm@selenic.com>
parents: 2895
diff changeset
   149
        if self.renamed(node):
db397c38005d merge: use file size stored in revlog index
Matt Mackall <mpm@selenic.com>
parents: 2895
diff changeset
   150
            return len(self.read(node))
24118
76f6ae06ddf5 revlog: add "iscensored()" to revlog public API
Mike Edgar <adgar@google.com>
parents: 24117
diff changeset
   151
        if self.iscensored(rev):
22597
58ec36686f0e filelog: censored files compare against empty data, have 0 size
Mike Edgar <adgar@google.com>
parents: 22596
diff changeset
   152
            return 0
2898
db397c38005d merge: use file size stored in revlog index
Matt Mackall <mpm@selenic.com>
parents: 2895
diff changeset
   153
11540
2370e270a29a filelog: test behaviour for data starting with "\1\n"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11539
diff changeset
   154
        # XXX if self.read(node).startswith("\1\n"), this returns (size+4)
37497
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   155
        return self._revlog.size(rev)
2898
db397c38005d merge: use file size stored in revlog index
Matt Mackall <mpm@selenic.com>
parents: 2895
diff changeset
   156
2887
05257fd28591 filelog: add hash-based comparisons
Matt Mackall <mpm@selenic.com>
parents: 2859
diff changeset
   157
    def cmp(self, node, text):
11539
a463e3c50212 cmp: document the fact that we return True if content is different
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10706
diff changeset
   158
        """compare text with a given file revision
a463e3c50212 cmp: document the fact that we return True if content is different
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10706
diff changeset
   159
a463e3c50212 cmp: document the fact that we return True if content is different
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10706
diff changeset
   160
        returns True if text is different than what is stored.
a463e3c50212 cmp: document the fact that we return True if content is different
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10706
diff changeset
   161
        """
2887
05257fd28591 filelog: add hash-based comparisons
Matt Mackall <mpm@selenic.com>
parents: 2859
diff changeset
   162
11541
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   163
        t = text
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   164
        if text.startswith('\1\n'):
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   165
            t = '\1\n\1\n' + text
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   166
37497
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   167
        samehashes = not self._revlog.cmp(node, t)
11541
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   168
        if samehashes:
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   169
            return False
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   170
22597
58ec36686f0e filelog: censored files compare against empty data, have 0 size
Mike Edgar <adgar@google.com>
parents: 22596
diff changeset
   171
        # censored files compare against the empty file
24118
76f6ae06ddf5 revlog: add "iscensored()" to revlog public API
Mike Edgar <adgar@google.com>
parents: 24117
diff changeset
   172
        if self.iscensored(self.rev(node)):
22597
58ec36686f0e filelog: censored files compare against empty data, have 0 size
Mike Edgar <adgar@google.com>
parents: 22596
diff changeset
   173
            return text != ''
58ec36686f0e filelog: censored files compare against empty data, have 0 size
Mike Edgar <adgar@google.com>
parents: 22596
diff changeset
   174
11541
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   175
        # renaming a file produces a different hash, even if the data
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   176
        # remains unchanged. Check if it's the case (slow):
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   177
        if self.renamed(node):
2887
05257fd28591 filelog: add hash-based comparisons
Matt Mackall <mpm@selenic.com>
parents: 2859
diff changeset
   178
            t2 = self.read(node)
2895
21631c2c09a5 filelog.cmp: return 0 for equality
Matt Mackall <mpm@selenic.com>
parents: 2890
diff changeset
   179
            return t2 != text
2887
05257fd28591 filelog: add hash-based comparisons
Matt Mackall <mpm@selenic.com>
parents: 2859
diff changeset
   180
11541
ab9fa7a85dd9 filelog: cmp: don't read data if hashes are identical (issue2273)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11540
diff changeset
   181
        return True
37497
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   182
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   183
    @property
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   184
    def filename(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   185
        return self._revlog.filename
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   186
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   187
    @filename.setter
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   188
    def filename(self, value):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   189
        self._revlog.filename = value
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   190
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   191
    # TODO these aren't part of the interface and aren't internal methods.
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   192
    # Callers should be fixed to not use them.
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   193
    @property
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   194
    def indexfile(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   195
        return self._revlog.indexfile
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   196
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   197
    @indexfile.setter
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   198
    def indexfile(self, value):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   199
        self._revlog.indexfile = value
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   200
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   201
    @property
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   202
    def datafile(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   203
        return self._revlog.datafile
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   204
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   205
    @property
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   206
    def opener(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   207
        return self._revlog.opener
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   208
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   209
    @property
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   210
    def _lazydeltabase(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   211
        return self._revlog._lazydeltabase
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   212
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   213
    @_lazydeltabase.setter
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   214
    def _lazydeltabase(self, value):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   215
        self._revlog._lazydeltabase = value
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   216
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   217
    @property
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   218
    def _aggressivemergedeltas(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   219
        return self._revlog._aggressivemergedeltas
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   220
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   221
    @_aggressivemergedeltas.setter
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   222
    def _aggressivemergedeltas(self, value):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   223
        self._revlog._aggressivemergedeltas = value
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   224
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   225
    @property
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   226
    def _inline(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   227
        return self._revlog._inline
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   228
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   229
    @property
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   230
    def _withsparseread(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   231
        return getattr(self._revlog, '_withsparseread', False)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   232
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   233
    @property
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   234
    def _srmingapsize(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   235
        return self._revlog._srmingapsize
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   236
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   237
    @property
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   238
    def _srdensitythreshold(self):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   239
        return self._revlog._srdensitythreshold
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   240
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   241
    def _deltachain(self, rev, stoprev=None):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   242
        return self._revlog._deltachain(rev, stoprev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   243
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   244
    def chainbase(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   245
        return self._revlog.chainbase(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   246
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   247
    def chainlen(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   248
        return self._revlog.chainlen(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   249
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   250
    def clone(self, tr, destrevlog, **kwargs):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   251
        if not isinstance(destrevlog, filelog):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   252
            raise error.ProgrammingError('expected filelog to clone()')
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   253
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   254
        return self._revlog.clone(tr, destrevlog._revlog, **kwargs)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   255
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   256
    def start(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   257
        return self._revlog.start(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   258
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   259
    def end(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   260
        return self._revlog.end(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   261
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   262
    def length(self, rev):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   263
        return self._revlog.length(rev)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   264
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   265
    def compress(self, data):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   266
        return self._revlog.compress(data)
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   267
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   268
    def _addrevision(self, *args, **kwargs):
1541e1a8e87d filelog: wrap revlog instead of inheriting it (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37443
diff changeset
   269
        return self._revlog._addrevision(*args, **kwargs)