/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 bzrlib/tests/test_revisionnamespaces.py

  • Committer: Robert Collins
  • Date: 2007-04-23 02:29:35 UTC
  • mfrom: (2441 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2442.
  • Revision ID: robertc@robertcollins.net-20070423022935-9hhongamvk6bfdso
Resolve conflicts with bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
    def assertInHistoryIs(self, exp_revno, exp_revision_id, revision_spec):
68
68
        rev_info = self.get_in_history(revision_spec)
69
69
        self.assertEqual(exp_revno, rev_info.revno,
70
 
                         'Revision spec: %s returned wrong revno: %s != %s'
 
70
                         'Revision spec: %r returned wrong revno: %r != %r'
71
71
                         % (revision_spec, exp_revno, rev_info.revno))
72
72
        self.assertEqual(exp_revision_id, rev_info.rev_id,
73
 
                         'Revision spec: %s returned wrong revision id:'
74
 
                         ' %s != %s'
 
73
                         'Revision spec: %r returned wrong revision id:'
 
74
                         ' %r != %r'
75
75
                         % (revision_spec, exp_revision_id, rev_info.rev_id))
76
76
 
77
77
    def assertInvalid(self, revision_spec, extra=''):
277
277
                                          revision_id='alt_r3')
278
278
        self.assertInHistoryIs(None, 'alt_r3', 'revid:alt_r3')
279
279
 
 
280
    def test_unicode(self):
 
281
        """We correctly convert a unicode ui string to an encoded revid."""
 
282
        revision_id = u'\N{SNOWMAN}'.encode('utf-8')
 
283
        self.tree.commit('unicode', rev_id=revision_id)
 
284
        self.assertInHistoryIs(3, revision_id, u'revid:\N{SNOWMAN}')
 
285
        self.assertInHistoryIs(3, revision_id, 'revid:' + revision_id)
 
286
 
280
287
 
281
288
class TestRevisionSpec_last(TestRevisionSpec):
282
289
 
477
484
        new_tree = self.make_branch_and_tree('new_tree')
478
485
        self.assertRaises(errors.NoCommits,
479
486
                          self.get_in_history, 'branch:new_tree')
 
487
 
 
488
 
 
489
class TestRevisionSpec_submit(TestRevisionSpec):
 
490
 
 
491
    def test_submit_branch(self):
 
492
        # Common ancestor of trees is 'alt_r2'
 
493
        self.assertRaises(errors.NoSubmitBranch, self.get_in_history,
 
494
                          'submit:')
 
495
        self.tree.branch.set_parent('../tree2')
 
496
        self.assertInHistoryIs(None, 'alt_r2', 'submit:')
 
497
        self.tree.branch.set_parent('bogus')
 
498
        self.assertRaises(errors.NotBranchError, self.get_in_history,
 
499
            'submit:')
 
500
        # submit branch overrides parent branch
 
501
        self.tree.branch.set_submit_branch('tree2')
 
502
        self.assertInHistoryIs(None, 'alt_r2', 'submit:')