/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.205.34 by Jelmer Vernooij
s/get_revision/get_inventory.
1
# Copyright (C) 2005-2009 Jelmer Vernooij <jelmer@samba.org>
0.205.5 by Jelmer Vernooij
Import virtual versionedfiles code.
2
 
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3 of the License, or
6
# (at your option) any later version.
7
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
13
# You should have received a copy of the GNU General Public License
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
0.205.19 by Jelmer Vernooij
import bzr-svn improvements.
16
from bzrlib import osutils
17
from bzrlib.versionedfile import VirtualVersionedFiles
0.205.5 by Jelmer Vernooij
Import virtual versionedfiles code.
18
0.205.30 by Jelmer Vernooij
Properly return None if a key wasn't found.
19
from bzrlib.errors import NoSuchRevision
20
0.205.5 by Jelmer Vernooij
Import virtual versionedfiles code.
21
22
class VirtualRevisionTexts(VirtualVersionedFiles):
23
    """Virtual revisions backend."""
24
    def __init__(self, repository):
25
        self.repository = repository
26
        super(VirtualRevisionTexts, self).__init__(self.repository._make_parents_provider().get_parent_map, self.get_lines)
27
28
    def get_lines(self, key):
0.205.30 by Jelmer Vernooij
Properly return None if a key wasn't found.
29
        try:
30
            return osutils.split_lines(self.repository.get_revision_xml(key))
31
        except NoSuchRevision:
32
            return None
0.205.5 by Jelmer Vernooij
Import virtual versionedfiles code.
33
0.205.43 by Jelmer Vernooij
Add keys to virtual VersionedFiles.
34
    # TODO: annotate
35
36
    def keys(self):
37
        return self.repository.all_revision_ids()
0.205.5 by Jelmer Vernooij
Import virtual versionedfiles code.
38
39
40
class VirtualInventoryTexts(VirtualVersionedFiles):
41
    """Virtual inventories backend."""
42
    def __init__(self, repository):
43
        self.repository = repository
44
        super(VirtualInventoryTexts, self).__init__(self.repository._make_parents_provider().get_parent_map, self.get_lines)
45
46
    def get_lines(self, key):
0.205.30 by Jelmer Vernooij
Properly return None if a key wasn't found.
47
        try:
48
            return osutils.split_lines(self.repository.get_inventory_xml(key))
49
        except NoSuchRevision:
50
            return None
0.205.5 by Jelmer Vernooij
Import virtual versionedfiles code.
51
0.205.43 by Jelmer Vernooij
Add keys to virtual VersionedFiles.
52
    def keys(self):
53
        return self.repository.all_revision_ids()
54
55
    # TODO: annotate
0.205.5 by Jelmer Vernooij
Import virtual versionedfiles code.
56
57
58
class VirtualSignatureTexts(VirtualVersionedFiles):
59
    """Virtual signatures backend."""
60
    def __init__(self, repository):
61
        self.repository = repository
62
        super(VirtualSignatureTexts, self).__init__(self.repository._make_parents_provider().get_parent_map, self.get_lines)
63
64
    def get_lines(self, key):
0.205.30 by Jelmer Vernooij
Properly return None if a key wasn't found.
65
        try:
66
            return osutils.split_lines(self.repository.get_signature_text(key))
67
        except NoSuchRevision:
68
            return None
0.205.5 by Jelmer Vernooij
Import virtual versionedfiles code.
69
0.205.43 by Jelmer Vernooij
Add keys to virtual VersionedFiles.
70
    def keys(self):
71
        return self.repository.all_revision_ids()
72
73
    # TODO: annotate
0.205.5 by Jelmer Vernooij
Import virtual versionedfiles code.
74