~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_shelf_ui.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
from cStringIO import StringIO
19
19
import os
20
20
import sys
 
21
from textwrap import dedent
21
22
 
22
 
from bzrlib import errors, shelf_ui, tests
 
23
from bzrlib import (
 
24
    errors,
 
25
    shelf_ui,
 
26
    revision,
 
27
    tests,
 
28
)
 
29
from bzrlib.tests import script
23
30
 
24
31
 
25
32
class ExpectShelver(shelf_ui.Shelver):
68
75
 
69
76
    def test_unexpected_prompt_failure(self):
70
77
        tree = self.create_shelvable_tree()
 
78
        tree.lock_tree_write()
 
79
        self.addCleanup(tree.unlock)
71
80
        shelver = ExpectShelver(tree, tree.basis_tree())
 
81
        self.addCleanup(shelver.finalize)
72
82
        e = self.assertRaises(AssertionError, shelver.run)
73
83
        self.assertEqual('Unexpected prompt: Shelve? [yNfq?]', str(e))
74
84
 
75
85
    def test_wrong_prompt_failure(self):
76
86
        tree = self.create_shelvable_tree()
 
87
        tree.lock_tree_write()
 
88
        self.addCleanup(tree.unlock)
77
89
        shelver = ExpectShelver(tree, tree.basis_tree())
 
90
        self.addCleanup(shelver.finalize)
78
91
        shelver.expect('foo', 'y')
79
92
        e = self.assertRaises(AssertionError, shelver.run)
80
93
        self.assertEqual('Wrong prompt: Shelve? [yNfq?]', str(e))
81
94
 
82
95
    def test_shelve_not_diff(self):
83
96
        tree = self.create_shelvable_tree()
 
97
        tree.lock_tree_write()
 
98
        self.addCleanup(tree.unlock)
84
99
        shelver = ExpectShelver(tree, tree.basis_tree())
 
100
        self.addCleanup(shelver.finalize)
85
101
        shelver.expect('Shelve? [yNfq?]', 'n')
86
102
        shelver.expect('Shelve? [yNfq?]', 'n')
87
103
        # No final shelving prompt because no changes were selected
90
106
 
91
107
    def test_shelve_diff_no(self):
92
108
        tree = self.create_shelvable_tree()
 
109
        tree.lock_tree_write()
 
110
        self.addCleanup(tree.unlock)
93
111
        shelver = ExpectShelver(tree, tree.basis_tree())
 
112
        self.addCleanup(shelver.finalize)
94
113
        shelver.expect('Shelve? [yNfq?]', 'y')
95
114
        shelver.expect('Shelve? [yNfq?]', 'y')
96
115
        shelver.expect('Shelve 2 change(s)? [yNfq?]', 'n')
99
118
 
100
119
    def test_shelve_diff(self):
101
120
        tree = self.create_shelvable_tree()
 
121
        tree.lock_tree_write()
 
122
        self.addCleanup(tree.unlock)
102
123
        shelver = ExpectShelver(tree, tree.basis_tree())
 
124
        self.addCleanup(shelver.finalize)
103
125
        shelver.expect('Shelve? [yNfq?]', 'y')
104
126
        shelver.expect('Shelve? [yNfq?]', 'y')
105
127
        shelver.expect('Shelve 2 change(s)? [yNfq?]', 'y')
108
130
 
109
131
    def test_shelve_one_diff(self):
110
132
        tree = self.create_shelvable_tree()
 
133
        tree.lock_tree_write()
 
134
        self.addCleanup(tree.unlock)
111
135
        shelver = ExpectShelver(tree, tree.basis_tree())
 
136
        self.addCleanup(shelver.finalize)
112
137
        shelver.expect('Shelve? [yNfq?]', 'y')
113
138
        shelver.expect('Shelve? [yNfq?]', 'n')
114
139
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
118
143
    def test_shelve_binary_change(self):
119
144
        tree = self.create_shelvable_tree()
120
145
        self.build_tree_contents([('tree/foo', '\x00')])
 
146
        tree.lock_tree_write()
 
147
        self.addCleanup(tree.unlock)
121
148
        shelver = ExpectShelver(tree, tree.basis_tree())
 
149
        self.addCleanup(shelver.finalize)
122
150
        shelver.expect('Shelve binary changes? [yNfq?]', 'y')
123
151
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
124
152
        shelver.run()
127
155
    def test_shelve_rename(self):
128
156
        tree = self.create_shelvable_tree()
129
157
        tree.rename_one('foo', 'bar')
 
158
        tree.lock_tree_write()
 
159
        self.addCleanup(tree.unlock)
130
160
        shelver = ExpectShelver(tree, tree.basis_tree())
 
161
        self.addCleanup(shelver.finalize)
131
162
        shelver.expect('Shelve renaming "foo" => "bar"? [yNfq?]', 'y')
132
163
        shelver.expect('Shelve? [yNfq?]', 'y')
133
164
        shelver.expect('Shelve? [yNfq?]', 'y')
138
169
    def test_shelve_deletion(self):
139
170
        tree = self.create_shelvable_tree()
140
171
        os.unlink('tree/foo')
 
172
        tree.lock_tree_write()
 
173
        self.addCleanup(tree.unlock)
141
174
        shelver = ExpectShelver(tree, tree.basis_tree())
 
175
        self.addCleanup(shelver.finalize)
142
176
        shelver.expect('Shelve removing file "foo"? [yNfq?]', 'y')
143
177
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
144
178
        shelver.run()
149
183
        tree.commit('add tree root')
150
184
        self.build_tree(['tree/foo'])
151
185
        tree.add('foo')
 
186
        tree.lock_tree_write()
 
187
        self.addCleanup(tree.unlock)
152
188
        shelver = ExpectShelver(tree, tree.basis_tree())
 
189
        self.addCleanup(shelver.finalize)
153
190
        shelver.expect('Shelve adding file "foo"? [yNfq?]', 'y')
154
191
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
155
192
        shelver.run()
159
196
        tree = self.create_shelvable_tree()
160
197
        os.unlink('tree/foo')
161
198
        os.mkdir('tree/foo')
 
199
        tree.lock_tree_write()
 
200
        self.addCleanup(tree.unlock)
162
201
        shelver = ExpectShelver(tree, tree.basis_tree())
 
202
        self.addCleanup(shelver.finalize)
163
203
        shelver.expect('Shelve changing "foo" from file to directory? [yNfq?]',
164
204
                       'y')
165
205
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
172
212
        tree.commit("Add symlink")
173
213
        os.unlink('tree/baz')
174
214
        os.symlink('vax', 'tree/baz')
 
215
        tree.lock_tree_write()
 
216
        self.addCleanup(tree.unlock)
175
217
        shelver = ExpectShelver(tree, tree.basis_tree())
 
218
        self.addCleanup(shelver.finalize)
176
219
        shelver.expect('Shelve changing target of "baz" from "bar" to '
177
220
                '"vax"? [yNfq?]', 'y')
178
221
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
181
224
 
182
225
    def test_shelve_finish(self):
183
226
        tree = self.create_shelvable_tree()
 
227
        tree.lock_tree_write()
 
228
        self.addCleanup(tree.unlock)
184
229
        shelver = ExpectShelver(tree, tree.basis_tree())
 
230
        self.addCleanup(shelver.finalize)
185
231
        shelver.expect('Shelve? [yNfq?]', 'f')
186
232
        shelver.expect('Shelve 2 change(s)? [yNfq?]', 'y')
187
233
        shelver.run()
189
235
 
190
236
    def test_shelve_quit(self):
191
237
        tree = self.create_shelvable_tree()
 
238
        tree.lock_tree_write()
 
239
        self.addCleanup(tree.unlock)
192
240
        shelver = ExpectShelver(tree, tree.basis_tree())
 
241
        self.addCleanup(shelver.finalize)
193
242
        shelver.expect('Shelve? [yNfq?]', 'q')
194
243
        self.assertRaises(errors.UserAbort, shelver.run)
195
244
        self.assertFileEqual(LINES_ZY, 'tree/foo')
196
245
 
197
246
    def test_shelve_all(self):
198
247
        tree = self.create_shelvable_tree()
199
 
        ExpectShelver.from_args(sys.stdout, all=True, directory='tree').run()
 
248
        shelver = ExpectShelver.from_args(sys.stdout, all=True,
 
249
            directory='tree')
 
250
        try:
 
251
            shelver.run()
 
252
        finally:
 
253
            shelver.finalize()
200
254
        self.assertFileEqual(LINES_AJ, 'tree/foo')
201
255
 
202
256
    def test_shelve_filename(self):
203
257
        tree = self.create_shelvable_tree()
204
258
        self.build_tree(['tree/bar'])
205
259
        tree.add('bar')
 
260
        tree.lock_tree_write()
 
261
        self.addCleanup(tree.unlock)
206
262
        shelver = ExpectShelver(tree, tree.basis_tree(), file_list=['bar'])
 
263
        self.addCleanup(shelver.finalize)
207
264
        shelver.expect('Shelve adding file "bar"? [yNfq?]', 'y')
208
265
        shelver.expect('Shelve 1 change(s)? [yNfq?]', 'y')
209
266
        shelver.run()
210
267
 
211
268
    def test_shelve_help(self):
212
269
        tree = self.create_shelvable_tree()
 
270
        tree.lock_tree_write()
 
271
        self.addCleanup(tree.unlock)
213
272
        shelver = ExpectShelver(tree, tree.basis_tree())
 
273
        self.addCleanup(shelver.finalize)
214
274
        shelver.expect('Shelve? [yNfq?]', '?')
215
275
        shelver.expect('Shelve? [(y)es, (N)o, (f)inish, or (q)uit]', 'f')
216
276
        shelver.expect('Shelve 2 change(s)? [yNfq?]', 'y')
217
277
        shelver.run()
218
278
 
219
 
    def test_shelve_distroy(self):
 
279
    def test_shelve_destroy(self):
220
280
        tree = self.create_shelvable_tree()
221
281
        shelver = shelf_ui.Shelver.from_args(sys.stdout, all=True,
222
282
                                             directory='tree', destroy=True)
 
283
        self.addCleanup(shelver.finalize)
223
284
        shelver.run()
224
285
        self.assertIs(None, tree.get_shelf_manager().last_shelf())
225
286
        self.assertFileEqual(LINES_AJ, 'tree/foo')
226
287
 
 
288
    @staticmethod
 
289
    def shelve_all(tree, target_revision_id):
 
290
        tree.lock_write()
 
291
        try:
 
292
            target = tree.branch.repository.revision_tree(target_revision_id)
 
293
            shelver = shelf_ui.Shelver(tree, target, auto=True,
 
294
                                       auto_apply=True)
 
295
            try:
 
296
                shelver.run()
 
297
            finally:
 
298
                shelver.finalize()
 
299
        finally:
 
300
            tree.unlock()
 
301
 
 
302
    def test_shelve_old_root_deleted(self):
 
303
        tree1 = self.make_branch_and_tree('tree1')
 
304
        tree1.commit('add root')
 
305
        tree2 = self.make_branch_and_tree('tree2')
 
306
        rev2 = tree2.commit('add root')
 
307
        tree1.merge_from_branch(tree2.branch,
 
308
                                from_revision=revision.NULL_REVISION)
 
309
        tree1.commit('Replaced root entry')
 
310
        # This is essentially assertNotRaises(InconsistentDelta)
 
311
        self.expectFailure('Cannot shelve replacing a root entry',
 
312
                           self.assertRaises, AssertionError,
 
313
                           self.assertRaises, errors.InconsistentDelta,
 
314
                           self.shelve_all, tree1, rev2)
 
315
 
 
316
    def test_shelve_split(self):
 
317
        outer_tree = self.make_branch_and_tree('outer')
 
318
        outer_tree.commit('Add root')
 
319
        inner_tree = self.make_branch_and_tree('outer/inner')
 
320
        rev2 = inner_tree.commit('Add root')
 
321
        outer_tree.subsume(inner_tree)
 
322
        # This is essentially assertNotRaises(ValueError).
 
323
        # The ValueError is 'None is not a valid file id'.
 
324
        self.expectFailure('Cannot shelve a join back to the inner tree.',
 
325
                           self.assertRaises, AssertionError,
 
326
                           self.assertRaises, ValueError, self.shelve_all,
 
327
                           outer_tree, rev2)
 
328
 
227
329
 
228
330
class TestApplyReporter(TestShelver):
229
331
 
230
332
    def test_shelve_not_diff(self):
231
333
        tree = self.create_shelvable_tree()
 
334
        tree.lock_tree_write()
 
335
        self.addCleanup(tree.unlock)
232
336
        shelver = ExpectShelver(tree, tree.basis_tree(),
233
337
                                reporter=shelf_ui.ApplyReporter())
 
338
        self.addCleanup(shelver.finalize)
234
339
        shelver.expect('Apply change? [yNfq?]', 'n')
235
340
        shelver.expect('Apply change? [yNfq?]', 'n')
236
341
        # No final shelving prompt because no changes were selected
239
344
 
240
345
    def test_shelve_diff_no(self):
241
346
        tree = self.create_shelvable_tree()
 
347
        tree.lock_tree_write()
 
348
        self.addCleanup(tree.unlock)
242
349
        shelver = ExpectShelver(tree, tree.basis_tree(),
243
350
                                reporter=shelf_ui.ApplyReporter())
 
351
        self.addCleanup(shelver.finalize)
244
352
        shelver.expect('Apply change? [yNfq?]', 'y')
245
353
        shelver.expect('Apply change? [yNfq?]', 'y')
246
354
        shelver.expect('Apply 2 change(s)? [yNfq?]', 'n')
249
357
 
250
358
    def test_shelve_diff(self):
251
359
        tree = self.create_shelvable_tree()
 
360
        tree.lock_tree_write()
 
361
        self.addCleanup(tree.unlock)
252
362
        shelver = ExpectShelver(tree, tree.basis_tree(),
253
363
                                reporter=shelf_ui.ApplyReporter())
 
364
        self.addCleanup(shelver.finalize)
254
365
        shelver.expect('Apply change? [yNfq?]', 'y')
255
366
        shelver.expect('Apply change? [yNfq?]', 'y')
256
367
        shelver.expect('Apply 2 change(s)? [yNfq?]', 'y')
260
371
    def test_shelve_binary_change(self):
261
372
        tree = self.create_shelvable_tree()
262
373
        self.build_tree_contents([('tree/foo', '\x00')])
 
374
        tree.lock_tree_write()
 
375
        self.addCleanup(tree.unlock)
263
376
        shelver = ExpectShelver(tree, tree.basis_tree(),
264
377
                                reporter=shelf_ui.ApplyReporter())
 
378
        self.addCleanup(shelver.finalize)
265
379
        shelver.expect('Apply binary changes? [yNfq?]', 'y')
266
380
        shelver.expect('Apply 1 change(s)? [yNfq?]', 'y')
267
381
        shelver.run()
270
384
    def test_shelve_rename(self):
271
385
        tree = self.create_shelvable_tree()
272
386
        tree.rename_one('foo', 'bar')
 
387
        tree.lock_tree_write()
 
388
        self.addCleanup(tree.unlock)
273
389
        shelver = ExpectShelver(tree, tree.basis_tree(),
274
390
                                reporter=shelf_ui.ApplyReporter())
 
391
        self.addCleanup(shelver.finalize)
275
392
        shelver.expect('Rename "bar" => "foo"? [yNfq?]', 'y')
276
393
        shelver.expect('Apply change? [yNfq?]', 'y')
277
394
        shelver.expect('Apply change? [yNfq?]', 'y')
282
399
    def test_shelve_deletion(self):
283
400
        tree = self.create_shelvable_tree()
284
401
        os.unlink('tree/foo')
 
402
        tree.lock_tree_write()
 
403
        self.addCleanup(tree.unlock)
285
404
        shelver = ExpectShelver(tree, tree.basis_tree(),
286
405
                                reporter=shelf_ui.ApplyReporter())
 
406
        self.addCleanup(shelver.finalize)
287
407
        shelver.expect('Add file "foo"? [yNfq?]', 'y')
288
408
        shelver.expect('Apply 1 change(s)? [yNfq?]', 'y')
289
409
        shelver.run()
294
414
        tree.commit('add tree root')
295
415
        self.build_tree(['tree/foo'])
296
416
        tree.add('foo')
 
417
        tree.lock_tree_write()
 
418
        self.addCleanup(tree.unlock)
297
419
        shelver = ExpectShelver(tree, tree.basis_tree(),
298
420
                                reporter=shelf_ui.ApplyReporter())
 
421
        self.addCleanup(shelver.finalize)
299
422
        shelver.expect('Delete file "foo"? [yNfq?]', 'y')
300
423
        shelver.expect('Apply 1 change(s)? [yNfq?]', 'y')
301
424
        shelver.run()
305
428
        tree = self.create_shelvable_tree()
306
429
        os.unlink('tree/foo')
307
430
        os.mkdir('tree/foo')
 
431
        tree.lock_tree_write()
 
432
        self.addCleanup(tree.unlock)
308
433
        shelver = ExpectShelver(tree, tree.basis_tree(),
309
434
                               reporter=shelf_ui.ApplyReporter())
 
435
        self.addCleanup(shelver.finalize)
310
436
        shelver.expect('Change "foo" from directory to a file? [yNfq?]', 'y')
311
437
        shelver.expect('Apply 1 change(s)? [yNfq?]', 'y')
312
438
 
318
444
        tree.commit("Add symlink")
319
445
        os.unlink('tree/baz')
320
446
        os.symlink('vax', 'tree/baz')
 
447
        tree.lock_tree_write()
 
448
        self.addCleanup(tree.unlock)
321
449
        shelver = ExpectShelver(tree, tree.basis_tree(),
322
450
                                reporter=shelf_ui.ApplyReporter())
 
451
        self.addCleanup(shelver.finalize)
323
452
        shelver.expect('Change target of "baz" from "vax" to "bar"? [yNfq?]',
324
453
                       'y')
325
454
        shelver.expect('Apply 1 change(s)? [yNfq?]', 'y')
331
460
 
332
461
    def create_tree_with_shelf(self):
333
462
        tree = self.make_branch_and_tree('tree')
334
 
        self.build_tree_contents([('tree/foo', LINES_AJ)])
335
 
        tree.add('foo', 'foo-id')
336
 
        tree.commit('added foo')
337
 
        self.build_tree_contents([('tree/foo', LINES_ZY)])
338
 
        shelf_ui.Shelver(tree, tree.basis_tree(), auto_apply=True,
339
 
                         auto=True).run()
 
463
        tree.lock_write()
 
464
        try:
 
465
            self.build_tree_contents([('tree/foo', LINES_AJ)])
 
466
            tree.add('foo', 'foo-id')
 
467
            tree.commit('added foo')
 
468
            self.build_tree_contents([('tree/foo', LINES_ZY)])
 
469
            shelver = shelf_ui.Shelver(tree, tree.basis_tree(),
 
470
                                       auto_apply=True, auto=True)
 
471
            try:
 
472
                shelver.run()
 
473
            finally:
 
474
                shelver.finalize()
 
475
        finally:
 
476
            tree.unlock()
340
477
        return tree
341
478
 
342
479
    def test_unshelve(self):
349
486
 
350
487
    def test_unshelve_args(self):
351
488
        tree = self.create_tree_with_shelf()
352
 
        shelf_ui.Unshelver.from_args(directory='tree').run()
 
489
        unshelver = shelf_ui.Unshelver.from_args(directory='tree')
 
490
        try:
 
491
            unshelver.run()
 
492
        finally:
 
493
            unshelver.tree.unlock()
353
494
        self.assertFileEqual(LINES_ZY, 'tree/foo')
354
495
        self.assertIs(None, tree.get_shelf_manager().last_shelf())
355
496
 
356
497
    def test_unshelve_args_dry_run(self):
357
498
        tree = self.create_tree_with_shelf()
358
 
        shelf_ui.Unshelver.from_args(directory='tree', action='dry-run').run()
359
 
        self.assertFileEqual(LINES_AJ, 'tree/foo')
360
 
        self.assertEqual(1, tree.get_shelf_manager().last_shelf())
 
499
        unshelver = shelf_ui.Unshelver.from_args(directory='tree',
 
500
            action='dry-run')
 
501
        try:
 
502
            unshelver.run()
 
503
        finally:
 
504
            unshelver.tree.unlock()
 
505
        self.assertFileEqual(LINES_AJ, 'tree/foo')
 
506
        self.assertEqual(1, tree.get_shelf_manager().last_shelf())
 
507
 
 
508
    def test_unshelve_args_preview(self):
 
509
        tree = self.create_tree_with_shelf()
 
510
        write_diff_to = StringIO()
 
511
        unshelver = shelf_ui.Unshelver.from_args(
 
512
            directory='tree', action='preview', write_diff_to=write_diff_to)
 
513
        try:
 
514
            unshelver.run()
 
515
        finally:
 
516
            unshelver.tree.unlock()
 
517
        # The changes were not unshelved.
 
518
        self.assertFileEqual(LINES_AJ, 'tree/foo')
 
519
        self.assertEqual(1, tree.get_shelf_manager().last_shelf())
 
520
 
 
521
        # But the diff was written to write_diff_to.
 
522
        diff = write_diff_to.getvalue()
 
523
        expected = dedent("""\
 
524
            @@ -1,4 +1,4 @@
 
525
            -a
 
526
            +z
 
527
             b
 
528
             c
 
529
             d
 
530
            @@ -7,4 +7,4 @@
 
531
             g
 
532
             h
 
533
             i
 
534
            -j
 
535
            +y
 
536
 
 
537
            """)
 
538
        self.assertEqualDiff(expected, diff[-len(expected):])
361
539
 
362
540
    def test_unshelve_args_delete_only(self):
363
541
        tree = self.make_branch_and_tree('tree')
369
547
            shelf_file.close()
370
548
        unshelver = shelf_ui.Unshelver.from_args(directory='tree',
371
549
                                                 action='delete-only')
372
 
        unshelver.run()
 
550
        try:
 
551
            unshelver.run()
 
552
        finally:
 
553
            unshelver.tree.unlock()
373
554
        self.assertIs(None, manager.last_shelf())
374
555
 
375
556
    def test_unshelve_args_invalid_shelf_id(self):
383
564
        self.assertRaises(errors.InvalidShelfId,
384
565
            shelf_ui.Unshelver.from_args, directory='tree',
385
566
            action='delete-only', shelf_id='foo')
 
567
 
 
568
 
 
569
class TestUnshelveScripts(TestUnshelver, 
 
570
                          script.TestCaseWithTransportAndScript): 
 
571
 
 
572
    def test_unshelve_messages_keep(self):
 
573
        self.create_tree_with_shelf()
 
574
        self.run_script("""
 
575
$ cd tree
 
576
$ bzr unshelve --keep
 
577
2>Using changes with id "1".
 
578
2> M  foo
 
579
2>All changes applied successfully.
 
580
""")
 
581
 
 
582
    def test_unshelve_messages_delete(self):
 
583
        self.create_tree_with_shelf()
 
584
        self.run_script("""
 
585
$ cd tree
 
586
$ bzr unshelve --delete-only
 
587
2>Deleted changes with id "1".
 
588
""")
 
589
 
 
590
    def test_unshelve_messages_apply(self):
 
591
        self.create_tree_with_shelf()
 
592
        self.run_script("""
 
593
$ cd tree
 
594
$ bzr unshelve --apply
 
595
2>Using changes with id "1".
 
596
2> M  foo
 
597
2>All changes applied successfully.
 
598
2>Deleted changes with id "1".
 
599
""")
 
600
 
 
601
    def test_unshelve_messages_dry_run(self):
 
602
        self.create_tree_with_shelf()
 
603
        self.run_script("""
 
604
$ cd tree
 
605
$ bzr unshelve --dry-run
 
606
2>Using changes with id "1".
 
607
2> M  foo
 
608
""")