~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart.py

  • Committer: John Arbash Meinel
  • Date: 2009-02-23 15:29:35 UTC
  • mfrom: (3943.7.7 bzr.code_style_cleanup)
  • mto: This revision was merged to the branch mainline in revision 4033.
  • Revision ID: john@arbash-meinel.com-20090223152935-oel9m92mwcc6nb4h
Merge the removal of all trailing whitespace, and resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
189
189
            request.execute(''))
190
190
 
191
191
    def test_nonshared_repository(self):
192
 
        # nonshared repositorys only allow 'find' to return a handle when the 
193
 
        # path the repository is being searched on is the same as that that 
 
192
        # nonshared repositorys only allow 'find' to return a handle when the
 
193
        # path the repository is being searched on is the same as that that
194
194
        # the repository is at.
195
195
        backing = self.get_transport()
196
196
        request = self._request_class(backing)
267
267
        self.assertEqual(SmartServerResponse(('ok', )),
268
268
            request.execute(''))
269
269
        made_dir = bzrdir.BzrDir.open_from_transport(backing)
270
 
        # no branch, tree or repository is expected with the current 
 
270
        # no branch, tree or repository is expected with the current
271
271
        # default formart.
272
272
        self.assertRaises(errors.NoWorkingTree, made_dir.open_workingtree)
273
273
        self.assertRaises(errors.NotBranchError, made_dir.open_branch)
405
405
    def test_with_content(self):
406
406
        # SmartServerBranchGetConfigFile should return the content from
407
407
        # branch.control_files.get('branch.conf') for now - in the future it may
408
 
        # perform more complex processing. 
 
408
        # perform more complex processing.
409
409
        backing = self.get_transport()
410
410
        request = smart.branch.SmartServerBranchGetConfigFile(backing)
411
411
        branch = self.make_branch('.')
432
432
 
433
433
    def unlock_branch(self):
434
434
        self.tree.branch.unlock()
435
 
        
 
435
 
436
436
    def set_last_revision(self, revision_id, revno):
437
437
        branch_token, repo_token = self.lock_branch()
438
438
        response = self._set_last_revision(
444
444
        response = self.set_last_revision(revision_id, revno)
445
445
        self.assertEqual(SuccessfulSmartServerResponse(('ok',)), response)
446
446
 
447
 
        
 
447
 
448
448
class TestSetLastRevisionVerbMixin(object):
449
449
    """Mixin test case for verbs that implement set_last_revision."""
450
450
 
555
555
        self.assertEqual(
556
556
            SuccessfulSmartServerResponse(('ok', revno, revision_id)),
557
557
            response)
558
 
        
 
558
 
559
559
    def test_branch_last_revision_info_rewind(self):
560
560
        """A branch's tip can be set to a revision that is an ancestor of the
561
561
        current tip, but only if allow_overwrite_descendant is passed.
604
604
        # child-1.
605
605
        new_r2 = self.tree.commit('2nd commit', rev_id='child-2')
606
606
        self.tree.unlock()
607
 
        
 
607
 
608
608
    def test_not_allow_diverged(self):
609
609
        """If allow_diverged is not passed, then setting a divergent history
610
610
        returns a Diverged error.
851
851
 
852
852
        self.assertEqual(SmartServerResponse(('ok', ), rev_id_utf8),
853
853
            request.execute('', rev_id_utf8))
854
 
    
 
854
 
855
855
    def test_no_such_revision(self):
856
856
        backing = self.get_transport()
857
857
        request = smart.repository.SmartServerRepositoryGetRevisionGraph(backing)
1102
1102
        self.assertEqual(SmartServerResponse(('ok',)), response)
1103
1103
        repo._pack_collection.reload_pack_names()
1104
1104
        self.assertEqual(1, len(repo._pack_collection.names()))
1105
 
    
 
1105
 
1106
1106
    def test_autopack_not_needed(self):
1107
1107
        tree = self.make_branch_and_tree('.', format='pack-0.92')
1108
1108
        repo = tree.branch.repository
1115
1115
        self.assertEqual(SmartServerResponse(('ok',)), response)
1116
1116
        repo._pack_collection.reload_pack_names()
1117
1117
        self.assertEqual(9, len(repo._pack_collection.names()))
1118
 
    
 
1118
 
1119
1119
    def test_autopack_on_nonpack_format(self):
1120
1120
        """A request to autopack a non-pack repo is a no-op."""
1121
1121
        repo = self.make_repository('.', format='knit')
1124
1124
            backing)
1125
1125
        response = request.execute('')
1126
1126
        self.assertEqual(SmartServerResponse(('ok',)), response)
1127
 
        
 
1127
 
1128
1128
 
1129
1129
class TestHandlers(tests.TestCase):
1130
1130
    """Tests for the request.request_handlers object."""