1
# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
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.
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.
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/>.
16
from bzrlib import osutils, urlutils
17
from bzrlib.versionedfile import FulltextContentFactory, VersionedFiles, VirtualVersionedFiles
19
from cStringIO import StringIO
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)
28
def get_lines(self, key):
29
return osutils.split_lines(self.repository.get_revision_xml(key))
31
# TODO: annotate, iter_lines_added_or_present_in_keys, keys
34
class VirtualInventoryTexts(VirtualVersionedFiles):
35
"""Virtual inventories backend."""
36
def __init__(self, repository):
37
self.repository = repository
38
super(VirtualInventoryTexts, self).__init__(self.repository._make_parents_provider().get_parent_map, self.get_lines)
40
def get_lines(self, key):
41
return osutils.split_lines(self.repository.get_inventory_xml(key))
43
# TODO: annotate, iter_lines_added_or_present_in_keys, keys
46
class VirtualSignatureTexts(VirtualVersionedFiles):
47
"""Virtual signatures backend."""
48
def __init__(self, repository):
49
self.repository = repository
50
super(VirtualSignatureTexts, self).__init__(self.repository._make_parents_provider().get_parent_map, self.get_lines)
52
def get_lines(self, key):
53
return osutils.split_lines(self.repository.get_signature_text(key))
55
# TODO: annotate, iter_lines_added_or_present_in_keys, keys