/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

More work on roundtrip push support.

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