~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_foreign.py

  • Committer: Martin Packman
  • Date: 2011-12-08 19:00:14 UTC
  • mto: This revision was merged to the branch mainline in revision 6359.
  • Revision ID: martin.packman@canonical.com-20111208190014-mi8jm6v7jygmhb0r
Use --include-duplicates for make update-pot which already combines multiple msgid strings prettily

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
    repository_class = DummyForeignVcsRepository
146
146
    _commit_builder_class = DummyForeignCommitBuilder
147
147
 
148
 
    @classmethod
149
 
    def get_format_string(cls):
 
148
    def get_format_string(self):
150
149
        return "Dummy Foreign Vcs Repository"
151
150
 
152
151
    def get_format_description(self):
201
200
                else:
202
201
                    parent_revids = [parent_revid]
203
202
                builder = self.target.get_commit_builder(parent_revids, 
204
 
                        self.target.get_config_stack(), rev.timestamp,
 
203
                        self.target.get_config(), rev.timestamp,
205
204
                        rev.timezone, rev.committer, rev.properties,
206
205
                        new_revid)
207
206
                try:
208
 
                    parent_tree = self.target.repository.revision_tree(
209
 
                        parent_revid)
210
 
                    for path, ie in tree.iter_entries_by_dir():
 
207
                    for path, ie in tree.inventory.iter_entries():
211
208
                        new_ie = ie.copy()
212
209
                        new_ie.revision = None
213
210
                        builder.record_entry_contents(new_ie, 
214
 
                            [parent_tree.root_inventory],
 
211
                            [self.target.repository.revision_tree(parent_revid).inventory],
215
212
                            path, tree, 
216
213
                            (ie.kind, ie.text_size, ie.executable, ie.text_sha1))
217
214
                    builder.finish_inventory()
232
229
 
233
230
class DummyForeignVcsBranchFormat(branch.BzrBranchFormat6):
234
231
 
235
 
    @classmethod
236
 
    def get_format_string(cls):
 
232
    def get_format_string(self):
237
233
        return "Branch for Testing"
238
234
 
239
235
    @property
242
238
 
243
239
    def open(self, a_bzrdir, name=None, _found=False, ignore_fallbacks=False,
244
240
            found_repository=None):
245
 
        if name is None:
246
 
            name = a_bzrdir._get_selected_branch()
247
241
        if not _found:
248
242
            raise NotImplementedError
249
243
        try:
255
249
            return DummyForeignVcsBranch(_format=self,
256
250
                              _control_files=control_files,
257
251
                              a_bzrdir=a_bzrdir,
258
 
                              _repository=found_repository,
259
 
                              name=name)
 
252
                              _repository=found_repository)
260
253
        except errors.NoSuchFile:
261
254
            raise errors.NotBranchError(path=transport.base)
262
255
 
322
315
 
323
316
    def open_branch(self, name=None, unsupported=False, ignore_fallbacks=True,
324
317
            possible_transports=None):
325
 
        if name is None:
326
 
            name = self._get_selected_branch()
327
 
        if name != "":
 
318
        if name is not None:
328
319
            raise errors.NoColocatedBranchSupport(self)
329
320
        return self._format.get_branch_format().open(self, _found=True)
330
321
 
431
422
        foreign.update_workingtree_fileids(wt, target_basis)
432
423
        wt.lock_read()
433
424
        try:
434
 
            self.assertEquals(set([root_id, "bla-b"]), set(wt.all_file_ids()))
 
425
            self.assertEquals(set([root_id, "bla-b"]), set(wt.inventory))
435
426
        finally:
436
427
            wt.unlock()
437
428