~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2010-10-13 08:01:36 UTC
  • mfrom: (5447.5.1 config-read)
  • mto: This revision was merged to the branch mainline in revision 5499.
  • Revision ID: v.ladeuil+lp@free.fr-20101013080136-7o5qbbwgxhgncsj8
Merge config-read into config-modify

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
        sr = ScriptRunner()
78
78
        sr.run_script(self, '''
79
79
$ bzr add file
 
80
adding file
80
81
$ bzr shelve --all -m Foo
 
82
2>Selected changes:
 
83
2>-D  file
 
84
2>Changes shelved with id "1".
81
85
$ bzr shelve --list
82
86
  1: Foo
83
87
$ bzr unshelve --keep
 
88
2>Using changes with id "1".
 
89
2>Message: Foo
 
90
2>+N  file
 
91
2>All changes applied successfully.
84
92
$ bzr shelve --list
85
93
  1: Foo
86
94
$ cat file
87
95
contents of file
88
96
''')
89
97
 
 
98
class TestUnshelvePreview(TestCaseWithTransport):
 
99
    
 
100
    def test_non_ascii(self):
 
101
        """Test that we can show a non-ascii diff that would result from unshelving"""
 
102
        
 
103
        init_content = u'Initial: \u0418\u0437\u043d\u0430\u0447\n'.encode('utf-8')
 
104
        more_content = u'More: \u0415\u0449\u0451\n'.encode('utf-8')
 
105
        next_content = init_content + more_content
 
106
        diff_part = '@@ -1,1 +1,2 @@\n %s+%s' % (init_content, more_content)
 
107
        
 
108
        tree = self.make_branch_and_tree('.')
 
109
        self.build_tree_contents([('a_file', init_content)])
 
110
        tree.add('a_file')
 
111
        tree.commit(message='committed')
 
112
        self.build_tree_contents([('a_file', next_content)])
 
113
        self.run_bzr(['shelve', '--all'])
 
114
        out, err = self.run_bzr(['unshelve', '--preview'], encoding='latin-1')
 
115
        
 
116
        self.assertContainsString(out, diff_part)
90
117
 
91
118
 
92
119
class TestShelveRelpath(TestCaseWithTransport):