/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

Fix unpeel map.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.plugins.git import (
28
28
    import_dulwich,
29
29
    )
 
30
from fastimport import (
 
31
    commands,
 
32
    )
30
33
 
31
34
TestCase = tests.TestCase
32
35
TestCaseInTempDir = tests.TestCaseInTempDir
73
76
 
74
77
    def _create_blob(self, content):
75
78
        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')
 
79
        blob = commands.BlobCommand(str(self._counter), content)
 
80
        self._write(str(blob)+"\n")
81
81
        return self._counter
82
82
 
83
83
    def set_symlink(self, path, content):
136
136
            commit.
137
137
        """
138
138
        self._counter += 1
139
 
        mark = self._counter
 
139
        mark = str(self._counter)
140
140
        if timestamp is None:
141
141
            timestamp = int(time.time())
142
142
        self._write('commit %s\n' % (self._branch,))
143
 
        self._write('mark :%d\n' % (mark,))
 
143
        self._write('mark :%s\n' % (mark,))
144
144
        self._write('committer %s %s %s\n'
145
145
                    % (committer, timestamp, timezone))
146
146
        message = message.encode('UTF-8')
148
148
        self._write(message)
149
149
        self._write('\n')
150
150
        if base is not None:
151
 
            self._write('from :%d\n' % (base,))
 
151
            self._write('from :%s\n' % (base,))
152
152
        if merge is not None:
153
153
            for m in merge:
154
 
                self._write('merge :%d\n' % (m,))
 
154
                self._write('merge :%s\n' % (m,))
155
155
        self._writelines(self.commit_info)
156
156
        self._write('\n')
157
157
        self.commit_info = []
167
167
            ref = self._branch
168
168
        self._write('reset %s\n' % (ref,))
169
169
        if mark is not None:
170
 
            self._write('from :%d\n' % mark)
 
170
            self._write('from :%s\n' % mark)
171
171
        self._write('\n')
172
172
 
173
173
    def finish(self):
176
176
        if self.orig_stream is None:
177
177
            from dulwich.repo import Repo
178
178
            r = Repo(".")
179
 
            from dulwich.fastexport import FastImporter
180
 
            importer = FastImporter(r)
 
179
            from dulwich.fastexport import GitImportProcessor
 
180
            importer = GitImportProcessor(r)
181
181
            return importer.import_stream(self.stream)
182
182
 
183
183
 
202
202
        'test_revspec',
203
203
        'test_roundtrip',
204
204
        'test_transportgit',
 
205
        'test_unpeel_map',
 
206
        'test_workingtree',
205
207
        ]
206
208
    testmod_names = ['%s.%s' % (__name__, t) for t in testmod_names]
207
209
    suite.addTests(loader.loadTestsFromModuleNames(testmod_names))