/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 tests/__init__.py

RemoveĀ unusedĀ import.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    errors as bzr_errors,
25
25
    tests,
26
26
    )
 
27
try:
 
28
    from bzrlib.tests.features import Feature
 
29
except ImportError: # bzr < 2.5
 
30
    from bzrlib.tests import Feature
27
31
from bzrlib.plugins.git import (
28
32
    import_dulwich,
29
33
    )
 
34
from fastimport import (
 
35
    commands,
 
36
    )
30
37
 
31
38
TestCase = tests.TestCase
32
39
TestCaseInTempDir = tests.TestCaseInTempDir
33
40
TestCaseWithTransport = tests.TestCaseWithTransport
34
41
TestCaseWithMemoryTransport = tests.TestCaseWithMemoryTransport
35
42
 
36
 
class _DulwichFeature(tests.Feature):
 
43
class _DulwichFeature(Feature):
37
44
 
38
45
    def _probe(self):
39
46
        try:
73
80
 
74
81
    def _create_blob(self, content):
75
82
        self._counter += 1
76
 
        self._write('blob\n')
77
 
        self._write('mark :%d\n' % (self._counter,))
78
 
        self._write('data %d\n' % (len(content),))
79
 
        self._write(content)
80
 
        self._write('\n')
 
83
        blob = commands.BlobCommand(str(self._counter), content)
 
84
        self._write(str(blob)+"\n")
81
85
        return self._counter
82
86
 
83
87
    def set_symlink(self, path, content):
136
140
            commit.
137
141
        """
138
142
        self._counter += 1
139
 
        mark = self._counter
 
143
        mark = str(self._counter)
140
144
        if timestamp is None:
141
145
            timestamp = int(time.time())
142
146
        self._write('commit %s\n' % (self._branch,))
143
 
        self._write('mark :%d\n' % (mark,))
 
147
        self._write('mark :%s\n' % (mark,))
144
148
        self._write('committer %s %s %s\n'
145
149
                    % (committer, timestamp, timezone))
146
150
        message = message.encode('UTF-8')
148
152
        self._write(message)
149
153
        self._write('\n')
150
154
        if base is not None:
151
 
            self._write('from :%d\n' % (base,))
 
155
            self._write('from :%s\n' % (base,))
152
156
        if merge is not None:
153
157
            for m in merge:
154
 
                self._write('merge :%d\n' % (m,))
 
158
                self._write('merge :%s\n' % (m,))
155
159
        self._writelines(self.commit_info)
156
160
        self._write('\n')
157
161
        self.commit_info = []
167
171
            ref = self._branch
168
172
        self._write('reset %s\n' % (ref,))
169
173
        if mark is not None:
170
 
            self._write('from :%d\n' % mark)
 
174
            self._write('from :%s\n' % mark)
171
175
        self._write('\n')
172
176
 
173
177
    def finish(self):
176
180
        if self.orig_stream is None:
177
181
            from dulwich.repo import Repo
178
182
            r = Repo(".")
179
 
            from dulwich.fastexport import FastImporter
180
 
            importer = FastImporter(r)
 
183
            from dulwich.fastexport import GitImportProcessor
 
184
            importer = GitImportProcessor(r)
181
185
            return importer.import_stream(self.stream)
182
186
 
183
187
 
201
205
        'test_refs',
202
206
        'test_revspec',
203
207
        'test_roundtrip',
 
208
        'test_server',
204
209
        'test_transportgit',
 
210
        'test_unpeel_map',
 
211
        'test_workingtree',
205
212
        ]
206
213
    testmod_names = ['%s.%s' % (__name__, t) for t in testmod_names]
207
214
    suite.addTests(loader.loadTestsFromModuleNames(testmod_names))