~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_shelf_ui.py

  • Committer: Jelmer Vernooij
  • Date: 2009-02-16 16:37:52 UTC
  • mfrom: (3990.4.4 shelf-prompt)
  • mto: This revision was merged to the branch mainline in revision 4015.
  • Revision ID: jelmer@samba.org-20090216163752-hiq812wpsmiuduqp
merge Daniels shelve help patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
        tree = self.create_shelvable_tree()
69
69
        shelver = ExpectShelver(tree, tree.basis_tree())
70
70
        e = self.assertRaises(AssertionError, shelver.run)
71
 
        self.assertEqual('Unexpected prompt: Shelve? [yNfq]', str(e))
 
71
        self.assertEqual('Unexpected prompt: Shelve? [yNfq?]', str(e))
72
72
 
73
73
    def test_wrong_prompt_failure(self):
74
74
        tree = self.create_shelvable_tree()
75
75
        shelver = ExpectShelver(tree, tree.basis_tree())
76
76
        shelver.expect('foo', 'y')
77
77
        e = self.assertRaises(AssertionError, shelver.run)
78
 
        self.assertEqual('Wrong prompt: Shelve? [yNfq]', str(e))
 
78
        self.assertEqual('Wrong prompt: Shelve? [yNfq?]', str(e))
79
79
 
80
80
    def test_shelve_not_diff(self):
81
81
        tree = self.create_shelvable_tree()
82
82
        shelver = ExpectShelver(tree, tree.basis_tree())
83
 
        shelver.expect('Shelve? [yNfq]', 'n')
84
 
        shelver.expect('Shelve? [yNfq]', 'n')
 
83
        shelver.expect('Shelve? [yNfq?]', 'n')
 
84
        shelver.expect('Shelve? [yNfq?]', 'n')
85
85
        # No final shelving prompt because no changes were selected
86
86
        shelver.run()
87
87
        self.assertFileEqual(LINES_ZY, 'tree/foo')
89
89
    def test_shelve_diff_no(self):
90
90
        tree = self.create_shelvable_tree()
91
91
        shelver = ExpectShelver(tree, tree.basis_tree())
92
 
        shelver.expect('Shelve? [yNfq]', 'y')
93
 
        shelver.expect('Shelve? [yNfq]', 'y')
94
 
        shelver.expect('Shelve 2 change(s)? [yNfq]', 'n')
 
92
        shelver.expect('Shelve? [yNfq?]', 'y')
 
93
        shelver.expect('Shelve? [yNfq?]', 'y')
 
94
        shelver.expect('Shelve 2 change(s)? [yNfq?]', 'n')
95
95
        shelver.run()
96
96
        self.assertFileEqual(LINES_ZY, 'tree/foo')
97
97
 
98
98
    def test_shelve_diff(self):
99
99
        tree = self.create_shelvable_tree()
100
100
        shelver = ExpectShelver(tree, tree.basis_tree())
101
 
        shelver.expect('Shelve? [yNfq]', 'y')
102
 
        shelver.expect('Shelve? [yNfq]', 'y')
103
 
        shelver.expect('Shelve 2 change(s)? [yNfq]', 'y')
 
101
        shelver.expect('Shelve? [yNfq?]', 'y')
 
102
        shelver.expect('Shelve? [yNfq?]', 'y')
 
103
        shelver.expect('Shelve 2 change(s)? [yNfq?]', 'y')
104
104
        shelver.run()
105
105
        self.assertFileEqual(LINES_AJ, 'tree/foo')
106
106
 
107
107
    def test_shelve_one_diff(self):
108
108
        tree = self.create_shelvable_tree()
109
109
        shelver = ExpectShelver(tree, tree.basis_tree())
110
 
        shelver.expect('Shelve? [yNfq]', 'y')
111
 
        shelver.expect('Shelve? [yNfq]', 'n')
112
 
        shelver.expect('Shelve 1 change(s)? [yNfq]', 'y')
 
110
        shelver.expect('Shelve? [yNfq?]', 'y')
 
111
        shelver.expect('Shelve? [yNfq?]', 'n')
 
112
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
113
113
        shelver.run()
114
114
        self.assertFileEqual(LINES_AY, 'tree/foo')
115
115
 
117
117
        tree = self.create_shelvable_tree()
118
118
        self.build_tree_contents([('tree/foo', '\x00')])
119
119
        shelver = ExpectShelver(tree, tree.basis_tree())
120
 
        shelver.expect('Shelve binary changes? [yNfq]', 'y')
121
 
        shelver.expect('Shelve 1 change(s)? [yNfq]', 'y')
 
120
        shelver.expect('Shelve binary changes? [yNfq?]', 'y')
 
121
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
122
122
        shelver.run()
123
123
        self.assertFileEqual(LINES_AJ, 'tree/foo')
124
124
 
126
126
        tree = self.create_shelvable_tree()
127
127
        tree.rename_one('foo', 'bar')
128
128
        shelver = ExpectShelver(tree, tree.basis_tree())
129
 
        shelver.expect('Shelve renaming "foo" => "bar"? [yNfq]', 'y')
130
 
        shelver.expect('Shelve? [yNfq]', 'y')
131
 
        shelver.expect('Shelve? [yNfq]', 'y')
132
 
        shelver.expect('Shelve 3 change(s)? [yNfq]', 'y')
 
129
        shelver.expect('Shelve renaming "foo" => "bar"? [yNfq?]', 'y')
 
130
        shelver.expect('Shelve? [yNfq?]', 'y')
 
131
        shelver.expect('Shelve? [yNfq?]', 'y')
 
132
        shelver.expect('Shelve 3 change(s)? [yNfq?]', 'y')
133
133
        shelver.run()
134
134
        self.assertFileEqual(LINES_AJ, 'tree/foo')
135
135
 
137
137
        tree = self.create_shelvable_tree()
138
138
        os.unlink('tree/foo')
139
139
        shelver = ExpectShelver(tree, tree.basis_tree())
140
 
        shelver.expect('Shelve removing file "foo"? [yNfq]', 'y')
141
 
        shelver.expect('Shelve 1 change(s)? [yNfq]', 'y')
 
140
        shelver.expect('Shelve removing file "foo"? [yNfq?]', 'y')
 
141
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
142
142
        shelver.run()
143
143
        self.assertFileEqual(LINES_AJ, 'tree/foo')
144
144
 
148
148
        self.build_tree(['tree/foo'])
149
149
        tree.add('foo')
150
150
        shelver = ExpectShelver(tree, tree.basis_tree())
151
 
        shelver.expect('Shelve adding file "foo"? [yNfq]', 'y')
152
 
        shelver.expect('Shelve 1 change(s)? [yNfq]', 'y')
 
151
        shelver.expect('Shelve adding file "foo"? [yNfq?]', 'y')
 
152
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
153
153
        shelver.run()
154
154
        self.failIfExists('tree/foo')
155
155
 
158
158
        os.unlink('tree/foo')
159
159
        os.mkdir('tree/foo')
160
160
        shelver = ExpectShelver(tree, tree.basis_tree())
161
 
        shelver.expect('Shelve changing "foo" from file to directory? [yNfq]',
 
161
        shelver.expect('Shelve changing "foo" from file to directory? [yNfq?]',
162
162
                       'y')
163
 
        shelver.expect('Shelve 1 change(s)? [yNfq]', 'y')
 
163
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
164
164
 
165
165
    def test_shelve_finish(self):
166
166
        tree = self.create_shelvable_tree()
167
167
        shelver = ExpectShelver(tree, tree.basis_tree())
168
 
        shelver.expect('Shelve? [yNfq]', 'f')
169
 
        shelver.expect('Shelve 2 change(s)? [yNfq]', 'y')
 
168
        shelver.expect('Shelve? [yNfq?]', 'f')
 
169
        shelver.expect('Shelve 2 change(s)? [yNfq?]', 'y')
170
170
        shelver.run()
171
171
        self.assertFileEqual(LINES_AJ, 'tree/foo')
172
172
 
173
173
    def test_shelve_quit(self):
174
174
        tree = self.create_shelvable_tree()
175
175
        shelver = ExpectShelver(tree, tree.basis_tree())
176
 
        shelver.expect('Shelve? [yNfq]', 'q')
 
176
        shelver.expect('Shelve? [yNfq?]', 'q')
177
177
        self.assertRaises(errors.UserAbort, shelver.run)
178
178
        self.assertFileEqual(LINES_ZY, 'tree/foo')
179
179
 
187
187
        self.build_tree(['tree/bar'])
188
188
        tree.add('bar')
189
189
        shelver = ExpectShelver(tree, tree.basis_tree(), file_list=['bar'])
190
 
        shelver.expect('Shelve adding file "bar"? [yNfq]', 'y')
191
 
        shelver.expect('Shelve 1 change(s)? [yNfq]', 'y')
 
190
        shelver.expect('Shelve adding file "bar"? [yNfq?]', 'y')
 
191
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
 
192
        shelver.run()
 
193
 
 
194
    def test_shelve_help(self):
 
195
        tree = self.create_shelvable_tree()
 
196
        shelver = ExpectShelver(tree, tree.basis_tree())
 
197
        shelver.expect('Shelve? [yNfq?]', '?')
 
198
        shelver.expect('Shelve? [(y)es, (N)o, (f)inish, or (q)uit]', 'f')
 
199
        shelver.expect('Shelve 2 change(s)? [yNfq?]', 'y')
192
200
        shelver.run()
193
201
 
194
202