/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

stgit dependency was removed already

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    tests,
25
25
    trace,
26
26
    )
27
 
from  bzrlib.plugins.git import errors
 
27
from  bzrlib.plugins.git.gitlib import errors
28
28
 
29
29
TestCase = tests.TestCase
30
30
TestCaseInTempDir = tests.TestCaseInTempDir
31
31
TestCaseWithTransport = tests.TestCaseWithTransport
32
 
TestCaseWithMemoryTransport = tests.TestCaseWithMemoryTransport
 
32
 
33
33
 
34
34
class _GitCommandFeature(tests.Feature):
35
35
 
67
67
        self.stream = stream
68
68
        self._process = None
69
69
        self._counter = 0
70
 
        self._branch = 'refs/heads/master'
 
70
        self._branch = 'refs/head/master'
71
71
        if stream is None:
72
72
            # Write the marks file into the git sandbox.
73
73
            self._marks_file_name = osutils.abspath('marks')
127
127
        else:
128
128
            mode = '100644'
129
129
        self.commit_info.append('M %s :%d %s\n'
130
 
                                % (mode, mark, self._encode_path(path)))
 
130
                                % (mode, mark, path.encode('utf-8')))
131
131
 
132
132
    def set_link(self, path, link_target):
133
133
        """Create or update a link at a given path."""
134
134
        mark = self._create_blob(link_target)
135
135
        self.commit_info.append('M 120000 :%d %s\n'
136
 
                                % (mark, self._encode_path(path)))
 
136
                                % (mark, path.encode('utf-8')))
137
137
 
138
138
    def delete_entry(self, path):
139
139
        """This will delete files or symlinks at the given location."""
140
 
        self.commit_info.append('D %s\n' % (self._encode_path(path),))
141
 
 
142
 
    @staticmethod
143
 
    def _encode_path(path):
144
 
        if '\n' in path or path[0] == '"':
145
 
            path = path.replace('\\', '\\\\')
146
 
            path = path.replace('\n', '\\n')
147
 
            path = path.replace('"', '\\"')
148
 
            path = '"' + path + '"'
149
 
        return path.encode('utf-8')
 
140
        self.commit_info.append('D %s\n' % (path.encode('utf-8'),))
150
141
 
151
142
    # TODO: Author
152
143
    # TODO: Author timestamp+timezone
189
180
        self.commit_info = []
190
181
        return mark
191
182
 
192
 
    def reset(self, ref=None, mark=None):
193
 
        """Create or recreate the named branch.
194
 
 
195
 
        :param ref: branch name, defaults to the current branch.
196
 
        :param mark: commit the branch will point to.
197
 
        """
198
 
        if ref is None:
199
 
            ref = self._branch
200
 
        self._write('reset %s\n' % (ref,))
201
 
        if mark is not None:
202
 
            self._write('from :%d\n' % mark)
203
 
        self._write('\n')
204
 
 
205
183
    def finish(self):
206
184
        """We are finished building, close the stream, get the id mapping"""
207
185
        self.stream.close()
228
206
 
229
207
    testmod_names = [
230
208
        'test_builder',
231
 
        'test_branch',
232
 
        'test_dir',
233
 
        'test_repository',
 
209
        'test_git_branch',
 
210
        'test_git_dir',
 
211
        'test_git_repository',
 
212
        'test_model',
234
213
        'test_ids',
235
 
        'test_blackbox',
236
214
        ]
237
215
    testmod_names = ['%s.%s' % (__name__, t) for t in testmod_names]
238
216
    suite.addTests(loader.loadTestsFromModuleNames(testmod_names))