~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_shelve.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-10-01 07:40:20 UTC
  • mfrom: (5433.2.4 BUG_FIX_518916__NEW)
  • Revision ID: pqm@pqm.ubuntu.com-20101001074020-arbz6k0sl3w7nlrm
(gz) Allow arbitrary bytes for unshelve diffs rather than throwing
 UnicodeDecodeError on non-ascii contents (Andrej A Antonov)

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
contents of file
88
88
''')
89
89
 
 
90
class TestUnshelvePreview(TestCaseWithTransport):
 
91
    
 
92
    def test_non_ascii(self):
 
93
        """Test that we can show a non-ascii diff that would result from unshelving"""
 
94
        
 
95
        init_content = u'Initial: \u0418\u0437\u043d\u0430\u0447\n'.encode('utf-8')
 
96
        more_content = u'More: \u0415\u0449\u0451\n'.encode('utf-8')
 
97
        next_content = init_content + more_content
 
98
        diff_part = '@@ -1,1 +1,2 @@\n %s+%s' % (init_content, more_content)
 
99
        
 
100
        tree = self.make_branch_and_tree('.')
 
101
        self.build_tree_contents([('a_file', init_content)])
 
102
        tree.add('a_file')
 
103
        tree.commit(message='committed')
 
104
        self.build_tree_contents([('a_file', next_content)])
 
105
        self.run_bzr(['shelve', '--all'])
 
106
        out, err = self.run_bzr(['unshelve', '--preview'], encoding='latin-1')
 
107
        
 
108
        self.assertContainsString(out, diff_part)
90
109
 
91
110
 
92
111
class TestShelveRelpath(TestCaseWithTransport):