~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_foreign.py

  • Committer: Patch Queue Manager
  • Date: 2012-02-25 15:28:53 UTC
  • mfrom: (6475.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20120225152853-nz1w2gsfv7lc1yq4
(jelmer) Update documentation to mention command hooks landed in bzr 2.6
 rather than 2.5. (Brian de Alwis)

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
class DummyForeignVcsBranch(branch.BzrBranch6,foreign.ForeignBranch):
92
92
    """A Dummy VCS Branch."""
93
93
 
 
94
    @property
 
95
    def user_transport(self):
 
96
        return self.bzrdir.user_transport
 
97
 
94
98
    def __init__(self, _format, _control_files, a_bzrdir, *args, **kwargs):
95
99
        self._format = _format
96
100
        self._base = a_bzrdir.transport.base
141
145
    repository_class = DummyForeignVcsRepository
142
146
    _commit_builder_class = DummyForeignCommitBuilder
143
147
 
144
 
    def get_format_string(self):
 
148
    @classmethod
 
149
    def get_format_string(cls):
145
150
        return "Dummy Foreign Vcs Repository"
146
151
 
147
152
    def get_format_description(self):
196
201
                else:
197
202
                    parent_revids = [parent_revid]
198
203
                builder = self.target.get_commit_builder(parent_revids, 
199
 
                        self.target.get_config(), rev.timestamp,
 
204
                        self.target.get_config_stack(), rev.timestamp,
200
205
                        rev.timezone, rev.committer, rev.properties,
201
206
                        new_revid)
202
207
                try:
203
 
                    for path, ie in tree.inventory.iter_entries():
 
208
                    parent_tree = self.target.repository.revision_tree(
 
209
                        parent_revid)
 
210
                    for path, ie in tree.iter_entries_by_dir():
204
211
                        new_ie = ie.copy()
205
212
                        new_ie.revision = None
206
213
                        builder.record_entry_contents(new_ie, 
207
 
                            [self.target.repository.revision_tree(parent_revid).inventory],
 
214
                            [parent_tree.root_inventory],
208
215
                            path, tree, 
209
216
                            (ie.kind, ie.text_size, ie.executable, ie.text_sha1))
210
217
                    builder.finish_inventory()
225
232
 
226
233
class DummyForeignVcsBranchFormat(branch.BzrBranchFormat6):
227
234
 
228
 
    def get_format_string(self):
 
235
    @classmethod
 
236
    def get_format_string(cls):
229
237
        return "Branch for Testing"
230
238
 
231
239
    @property
234
242
 
235
243
    def open(self, a_bzrdir, name=None, _found=False, ignore_fallbacks=False,
236
244
            found_repository=None):
 
245
        if name is None:
 
246
            name = a_bzrdir._get_selected_branch()
237
247
        if not _found:
238
248
            raise NotImplementedError
239
249
        try:
245
255
            return DummyForeignVcsBranch(_format=self,
246
256
                              _control_files=control_files,
247
257
                              a_bzrdir=a_bzrdir,
248
 
                              _repository=found_repository)
 
258
                              _repository=found_repository,
 
259
                              name=name)
249
260
        except errors.NoSuchFile:
250
261
            raise errors.NotBranchError(path=transport.base)
251
262
 
309
320
        self.root_transport.put_bytes(".bzr", "foo")
310
321
        return super(DummyForeignVcsDir, self).create_workingtree()
311
322
 
312
 
    def open_branch(self, name=None, unsupported=False, ignore_fallbacks=True):
313
 
        if name is not None:
 
323
    def open_branch(self, name=None, unsupported=False, ignore_fallbacks=True,
 
324
            possible_transports=None):
 
325
        if name is None:
 
326
            name = self._get_selected_branch()
 
327
        if name != "":
314
328
            raise errors.NoColocatedBranchSupport(self)
315
329
        return self._format.get_branch_format().open(self, _found=True)
316
330
 
417
431
        foreign.update_workingtree_fileids(wt, target_basis)
418
432
        wt.lock_read()
419
433
        try:
420
 
            self.assertEquals(set([root_id, "bla-b"]), set(wt.inventory))
 
434
            self.assertEquals(set([root_id, "bla-b"]), set(wt.all_file_ids()))
421
435
        finally:
422
436
            wt.unlock()
423
437