/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to versionedfiles.py

  • Committer: Jelmer Vernooij
  • Date: 2009-02-18 22:34:29 UTC
  • mto: (0.436.139 foreign)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090218223429-50yrdm9kf6c9635d
Fix one-line summary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2005-2009 Jelmer Vernooij <jelmer@samba.org>
 
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
 
 
16
from bzrlib import osutils
 
17
from bzrlib.versionedfile import VirtualVersionedFiles
 
18
 
 
19
from bzrlib.errors import NoSuchRevision
 
20
 
 
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):
 
29
        try:
 
30
            return osutils.split_lines(self.repository.get_revision_xml(key))
 
31
        except NoSuchRevision:
 
32
            return None
 
33
 
 
34
    # TODO: annotate, keys
 
35
 
 
36
 
 
37
class VirtualInventoryTexts(VirtualVersionedFiles):
 
38
    """Virtual inventories backend."""
 
39
    def __init__(self, repository):
 
40
        self.repository = repository
 
41
        super(VirtualInventoryTexts, self).__init__(self.repository._make_parents_provider().get_parent_map, self.get_lines)
 
42
 
 
43
    def get_lines(self, key):
 
44
        try:
 
45
            return osutils.split_lines(self.repository.get_inventory_xml(key))
 
46
        except NoSuchRevision:
 
47
            return None
 
48
 
 
49
    # TODO: annotate, keys
 
50
 
 
51
 
 
52
class VirtualSignatureTexts(VirtualVersionedFiles):
 
53
    """Virtual signatures backend."""
 
54
    def __init__(self, repository):
 
55
        self.repository = repository
 
56
        super(VirtualSignatureTexts, self).__init__(self.repository._make_parents_provider().get_parent_map, self.get_lines)
 
57
 
 
58
    def get_lines(self, key):
 
59
        try:
 
60
            return osutils.split_lines(self.repository.get_signature_text(key))
 
61
        except NoSuchRevision:
 
62
            return None
 
63
 
 
64
    # TODO: annotate, keys
 
65