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
 | 
|
| 
0.205.44
by Jelmer Vernooij
 Fix formatting.  | 
5  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
| 
0.205.5
by Jelmer Vernooij
 Import virtual versionedfiles code.  | 
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.44
by Jelmer Vernooij
 Fix formatting.  | 
16  | 
from bzrlib import (  | 
17  | 
osutils,  | 
|
18  | 
    )
 | 
|
19  | 
from bzrlib.versionedfile import (  | 
|
20  | 
VirtualVersionedFiles,  | 
|
21  | 
    )
 | 
|
| 
0.205.5
by Jelmer Vernooij
 Import virtual versionedfiles code.  | 
22  | 
|
| 
0.205.44
by Jelmer Vernooij
 Fix formatting.  | 
23  | 
from bzrlib.errors import (  | 
24  | 
NoSuchRevision,  | 
|
25  | 
    )
 | 
|
| 
0.205.30
by Jelmer Vernooij
 Properly return None if a key wasn't found.  | 
26  | 
|
| 
0.205.5
by Jelmer Vernooij
 Import virtual versionedfiles code.  | 
27  | 
|
28  | 
class VirtualRevisionTexts(VirtualVersionedFiles):  | 
|
29  | 
"""Virtual revisions backend."""  | 
|
30  | 
def __init__(self, repository):  | 
|
31  | 
self.repository = repository  | 
|
32  | 
super(VirtualRevisionTexts, self).__init__(self.repository._make_parents_provider().get_parent_map, self.get_lines)  | 
|
33  | 
||
34  | 
def get_lines(self, key):  | 
|
| 
0.205.30
by Jelmer Vernooij
 Properly return None if a key wasn't found.  | 
35  | 
try:  | 
36  | 
return osutils.split_lines(self.repository.get_revision_xml(key))  | 
|
37  | 
except NoSuchRevision:  | 
|
38  | 
return None  | 
|
| 
0.205.5
by Jelmer Vernooij
 Import virtual versionedfiles code.  | 
39  | 
|
| 
0.205.43
by Jelmer Vernooij
 Add keys to virtual VersionedFiles.  | 
40  | 
    # TODO: annotate
 | 
41  | 
||
42  | 
def keys(self):  | 
|
43  | 
return self.repository.all_revision_ids()  | 
|
| 
0.205.5
by Jelmer Vernooij
 Import virtual versionedfiles code.  | 
44  | 
|
45  | 
||
46  | 
class VirtualInventoryTexts(VirtualVersionedFiles):  | 
|
47  | 
"""Virtual inventories backend."""  | 
|
48  | 
def __init__(self, repository):  | 
|
49  | 
self.repository = repository  | 
|
50  | 
super(VirtualInventoryTexts, self).__init__(self.repository._make_parents_provider().get_parent_map, self.get_lines)  | 
|
51  | 
||
52  | 
def get_lines(self, key):  | 
|
| 
0.205.30
by Jelmer Vernooij
 Properly return None if a key wasn't found.  | 
53  | 
try:  | 
54  | 
return osutils.split_lines(self.repository.get_inventory_xml(key))  | 
|
55  | 
except NoSuchRevision:  | 
|
56  | 
return None  | 
|
| 
0.205.5
by Jelmer Vernooij
 Import virtual versionedfiles code.  | 
57  | 
|
| 
0.205.43
by Jelmer Vernooij
 Add keys to virtual VersionedFiles.  | 
58  | 
def keys(self):  | 
59  | 
return self.repository.all_revision_ids()  | 
|
60  | 
||
61  | 
    # TODO: annotate
 | 
|
| 
0.205.5
by Jelmer Vernooij
 Import virtual versionedfiles code.  | 
62  | 
|
63  | 
||
64  | 
class VirtualSignatureTexts(VirtualVersionedFiles):  | 
|
65  | 
"""Virtual signatures backend."""  | 
|
66  | 
def __init__(self, repository):  | 
|
67  | 
self.repository = repository  | 
|
68  | 
super(VirtualSignatureTexts, self).__init__(self.repository._make_parents_provider().get_parent_map, self.get_lines)  | 
|
69  | 
||
70  | 
def get_lines(self, key):  | 
|
| 
0.205.30
by Jelmer Vernooij
 Properly return None if a key wasn't found.  | 
71  | 
try:  | 
72  | 
return osutils.split_lines(self.repository.get_signature_text(key))  | 
|
73  | 
except NoSuchRevision:  | 
|
74  | 
return None  | 
|
| 
0.205.5
by Jelmer Vernooij
 Import virtual versionedfiles code.  | 
75  | 
|
| 
0.205.43
by Jelmer Vernooij
 Add keys to virtual VersionedFiles.  | 
76  | 
def keys(self):  | 
77  | 
return self.repository.all_revision_ids()  | 
|
78  | 
||
79  | 
    # TODO: annotate
 | 
|
| 
0.205.5
by Jelmer Vernooij
 Import virtual versionedfiles code.  | 
80  |