/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 breezy/tests/blackbox/test_mv.py

  • Committer: Breezy landing bot
  • Author(s): Colin Watson
  • Date: 2020-11-16 21:47:08 UTC
  • mfrom: (7521.1.1 remove-lp-workaround)
  • Revision ID: breezy.the.bot@gmail.com-20201116214708-jos209mgxi41oy15
Remove breezy.git workaround for bazaar.launchpad.net.

Merged from https://code.launchpad.net/~cjwatson/brz/remove-lp-workaround/+merge/393710

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2012 Canonical Ltd
 
1
# Copyright (C) 2006-2012, 2016 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
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
"""Test for 'bzr mv'"""
 
17
"""Test for 'brz mv'"""
18
18
 
19
19
import os
20
20
 
21
 
import bzrlib.branch
22
 
from bzrlib import (
 
21
import breezy.branch
 
22
from breezy import (
23
23
    osutils,
24
24
    workingtree,
25
25
    )
26
26
 
27
 
from bzrlib.tests import (
 
27
from breezy.tests import (
28
28
    TestCaseWithTransport,
 
29
    script,
29
30
    )
30
 
from bzrlib.tests.features import (
 
31
from breezy.tests.features import (
31
32
    CaseInsensitiveFilesystemFeature,
32
33
    SymlinkFeature,
33
34
    UnicodeFilenameFeature,
36
37
 
37
38
class TestMove(TestCaseWithTransport):
38
39
 
39
 
    def assertMoved(self,from_path,to_path):
 
40
    def assertMoved(self, from_path, to_path):
40
41
        """Assert that to_path is existing and versioned but from_path not. """
41
42
        self.assertPathDoesNotExist(from_path)
42
43
        self.assertNotInWorkingTree(from_path)
51
52
        tree.add(['a', 'c', 'subdir'])
52
53
 
53
54
        self.run_bzr('mv a b')
54
 
        self.assertMoved('a','b')
 
55
        self.assertMoved('a', 'b')
55
56
 
56
57
        self.run_bzr('mv b subdir')
57
 
        self.assertMoved('b','subdir/b')
 
58
        self.assertMoved('b', 'subdir/b')
58
59
 
59
60
        self.run_bzr('mv subdir/b a')
60
 
        self.assertMoved('subdir/b','a')
 
61
        self.assertMoved('subdir/b', 'a')
61
62
 
62
63
        self.run_bzr('mv a c subdir')
63
 
        self.assertMoved('a','subdir/a')
64
 
        self.assertMoved('c','subdir/c')
 
64
        self.assertMoved('a', 'subdir/a')
 
65
        self.assertMoved('c', 'subdir/c')
65
66
 
66
67
        self.run_bzr('mv subdir/a subdir/newa')
67
 
        self.assertMoved('subdir/a','subdir/newa')
 
68
        self.assertMoved('subdir/a', 'subdir/newa')
68
69
 
69
70
    def test_mv_unversioned(self):
70
71
        self.build_tree(['unversioned.txt'])
71
72
        self.run_bzr_error(
72
 
            ["^bzr: ERROR: Could not rename unversioned.txt => elsewhere."
73
 
             " .*unversioned.txt is not versioned\.$"],
 
73
            ["^brz: ERROR: Could not rename unversioned.txt => elsewhere."
 
74
             " .*unversioned.txt is not versioned\\.$"],
74
75
            'mv unversioned.txt elsewhere')
75
76
 
76
77
    def test_mv_nonexisting(self):
77
78
        self.run_bzr_error(
78
 
            ["^bzr: ERROR: Could not rename doesnotexist => somewhereelse."
79
 
             " .*doesnotexist is not versioned\.$"],
 
79
            ["^brz: ERROR: Could not rename doesnotexist => somewhereelse."
 
80
             " .*doesnotexist is not versioned\\.$"],
80
81
            'mv doesnotexist somewhereelse')
81
82
 
82
83
    def test_mv_unqualified(self):
83
 
        self.run_bzr_error(['^bzr: ERROR: missing file argument$'], 'mv')
 
84
        self.run_bzr_error(['^brz: ERROR: missing file argument$'], 'mv')
84
85
 
85
86
    def test_mv_invalid(self):
86
87
        tree = self.make_branch_and_tree('.')
88
89
        tree.add(['test.txt'])
89
90
 
90
91
        self.run_bzr_error(
91
 
            ["^bzr: ERROR: Could not move to sub1: sub1 is not versioned\.$"],
 
92
            ["^brz: ERROR: Could not move to sub1: sub1 is not versioned\\.$"],
92
93
            'mv test.txt sub1')
93
94
 
94
95
        self.run_bzr_error(
95
 
            ["^bzr: ERROR: Could not move test.txt => .*hello.txt: "
96
 
             "sub1 is not versioned\.$"],
 
96
            ["^brz: ERROR: Could not move test.txt => .*hello.txt: "
 
97
             "sub1 is not versioned\\.$"],
97
98
            'mv test.txt sub1/hello.txt')
98
99
 
99
100
    def test_mv_dirs(self):
102
103
        tree.add(['hello.txt', 'sub1'])
103
104
 
104
105
        self.run_bzr('mv sub1 sub2')
105
 
        self.assertMoved('sub1','sub2')
 
106
        self.assertMoved('sub1', 'sub2')
106
107
 
107
108
        self.run_bzr('mv hello.txt sub2')
108
 
        self.assertMoved('hello.txt','sub2/hello.txt')
 
109
        self.assertMoved('hello.txt', 'sub2/hello.txt')
109
110
 
110
111
        self.build_tree(['sub1/'])
111
112
        tree.add(['sub1'])
112
113
        self.run_bzr('mv sub2/hello.txt sub1')
113
 
        self.assertMoved('sub2/hello.txt','sub1/hello.txt')
 
114
        self.assertMoved('sub2/hello.txt', 'sub1/hello.txt')
114
115
 
115
116
        self.run_bzr('mv sub2 sub1')
116
 
        self.assertMoved('sub2','sub1/sub2')
 
117
        self.assertMoved('sub2', 'sub1/sub2')
117
118
 
118
119
    def test_mv_relative(self):
119
120
        self.build_tree(['sub1/', 'sub1/sub2/', 'sub1/hello.txt'])
124
125
        self.assertPathExists('sub1/sub2/hello.txt')
125
126
 
126
127
        self.run_bzr('mv sub2/hello.txt .', working_dir='sub1')
127
 
        self.assertMoved('sub1/sub2/hello.txt','sub1/hello.txt')
 
128
        self.assertMoved('sub1/sub2/hello.txt', 'sub1/hello.txt')
128
129
 
129
130
    def test_mv_change_case_file(self):
130
131
        # test for bug #77740 (mv unable change filename case on Windows)
169
170
        self.build_tree(['foo/', 'bar'])
170
171
        tree.add(['foo', 'bar'])
171
172
        out, err = self.run_bzr('mv bar Foo', retcode=3)
172
 
        self.assertEquals('', out)
173
 
        self.assertEquals(
174
 
            'bzr: ERROR: Could not move to Foo: Foo is not versioned.\n',
 
173
        self.assertEqual('', out)
 
174
        self.assertEqual(
 
175
            'brz: ERROR: Could not move to Foo: Foo is not versioned.\n',
175
176
            err)
176
177
 
177
178
    def test_mv_smoke_aliases(self):
187
188
    def test_mv_no_root(self):
188
189
        tree = self.make_branch_and_tree('.')
189
190
        self.run_bzr_error(
190
 
            ["bzr: ERROR: can not move root of branch"],
 
191
            ["brz: ERROR: can not move root of branch"],
191
192
            'mv . a')
192
193
 
193
194
    def test_mv_through_symlinks(self):
196
197
        self.build_tree(['a/', 'a/b'])
197
198
        os.symlink('a', 'c')
198
199
        os.symlink('.', 'd')
199
 
        tree.add(['a', 'a/b', 'c'], ['a-id', 'b-id', 'c-id'])
 
200
        tree.add(['a', 'a/b', 'c'], [b'a-id', b'b-id', b'c-id'])
200
201
        self.run_bzr('mv c/b b')
201
202
        tree = workingtree.WorkingTree.open('.')
202
 
        self.assertEqual('b-id', tree.path2id('b'))
 
203
        self.assertEqual(b'b-id', tree.path2id('b'))
203
204
 
204
205
    def test_mv_already_moved_file(self):
205
 
        """Test bzr mv original_file to moved_file.
 
206
        """Test brz mv original_file to moved_file.
206
207
 
207
208
        Tests if a file which has allready been moved by an external tool,
208
 
        is handled correctly by bzr mv.
 
209
        is handled correctly by brz mv.
209
210
        Setup: a is in the working tree, b does not exist.
210
 
        User does: mv a b; bzr mv a b
 
211
        User does: mv a b; brz mv a b
211
212
        """
212
213
        self.build_tree(['a'])
213
214
        tree = self.make_branch_and_tree('.')
215
216
 
216
217
        osutils.rename('a', 'b')
217
218
        self.run_bzr('mv a b')
218
 
        self.assertMoved('a','b')
 
219
        self.assertMoved('a', 'b')
219
220
 
220
221
    def test_mv_already_moved_file_to_versioned_target(self):
221
 
        """Test bzr mv existing_file to versioned_file.
 
222
        """Test brz mv existing_file to versioned_file.
222
223
 
223
224
        Tests if an attempt to move an existing versioned file
224
225
        to another versiond file will fail.
225
226
        Setup: a and b are in the working tree.
226
 
        User does: rm b; mv a b; bzr mv a b
 
227
        User does: rm b; mv a b; brz mv a b
227
228
        """
228
229
        self.build_tree(['a', 'b'])
229
230
        tree = self.make_branch_and_tree('.')
232
233
        os.remove('b')
233
234
        osutils.rename('a', 'b')
234
235
        self.run_bzr_error(
235
 
            ["^bzr: ERROR: Could not move a => b. b is already versioned\.$"],
 
236
            ["^brz: ERROR: Could not move a => b. b is already versioned\\.$"],
236
237
            'mv a b')
237
 
        #check that nothing changed
 
238
        # check that nothing changed
238
239
        self.assertPathDoesNotExist('a')
239
240
        self.assertPathExists('b')
240
241
 
241
242
    def test_mv_already_moved_file_into_subdir(self):
242
 
        """Test bzr mv original_file to versioned_directory/file.
 
243
        """Test brz mv original_file to versioned_directory/file.
243
244
 
244
245
        Tests if a file which has already been moved into a versioned
245
 
        directory by an external tool, is handled correctly by bzr mv.
 
246
        directory by an external tool, is handled correctly by brz mv.
246
247
        Setup: a and sub/ are in the working tree.
247
 
        User does: mv a sub/a; bzr mv a sub/a
 
248
        User does: mv a sub/a; brz mv a sub/a
248
249
        """
249
250
        self.build_tree(['a', 'sub/'])
250
251
        tree = self.make_branch_and_tree('.')
252
253
 
253
254
        osutils.rename('a', 'sub/a')
254
255
        self.run_bzr('mv a sub/a')
255
 
        self.assertMoved('a','sub/a')
 
256
        self.assertMoved('a', 'sub/a')
256
257
 
257
258
    def test_mv_already_moved_file_into_unversioned_subdir(self):
258
 
        """Test bzr mv original_file to unversioned_directory/file.
 
259
        """Test brz mv original_file to unversioned_directory/file.
259
260
 
260
261
        Tests if an attempt to move an existing versioned file
261
262
        into an unversioned directory will fail.
262
263
        Setup: a is in the working tree, sub/ is not.
263
 
        User does: mv a sub/a; bzr mv a sub/a
 
264
        User does: mv a sub/a; brz mv a sub/a
264
265
        """
265
266
        self.build_tree(['a', 'sub/'])
266
267
        tree = self.make_branch_and_tree('.')
268
269
 
269
270
        osutils.rename('a', 'sub/a')
270
271
        self.run_bzr_error(
271
 
            ["^bzr: ERROR: Could not move a => a: sub is not versioned\.$"],
 
272
            ["^brz: ERROR: Could not move a => a: sub is not versioned\\.$"],
272
273
            'mv a sub/a')
273
274
        self.assertPathDoesNotExist('a')
274
275
        self.assertPathExists('sub/a')
275
276
 
276
277
    def test_mv_already_moved_files_into_subdir(self):
277
 
        """Test bzr mv original_files to versioned_directory.
 
278
        """Test brz mv original_files to versioned_directory.
278
279
 
279
280
        Tests if files which has already been moved into a versioned
280
 
        directory by an external tool, is handled correctly by bzr mv.
 
281
        directory by an external tool, is handled correctly by brz mv.
281
282
        Setup: a1, a2, sub are in the working tree.
282
 
        User does: mv a1 sub/.; bzr mv a1 a2 sub
 
283
        User does: mv a1 sub/.; brz mv a1 a2 sub
283
284
        """
284
285
        self.build_tree(['a1', 'a2', 'sub/'])
285
286
        tree = self.make_branch_and_tree('.')
287
288
 
288
289
        osutils.rename('a1', 'sub/a1')
289
290
        self.run_bzr('mv a1 a2 sub')
290
 
        self.assertMoved('a1','sub/a1')
291
 
        self.assertMoved('a2','sub/a2')
 
291
        self.assertMoved('a1', 'sub/a1')
 
292
        self.assertMoved('a2', 'sub/a2')
292
293
 
293
294
    def test_mv_already_moved_files_into_unversioned_subdir(self):
294
 
        """Test bzr mv original_file to unversioned_directory.
 
295
        """Test brz mv original_file to unversioned_directory.
295
296
 
296
297
        Tests if an attempt to move existing versioned file
297
298
        into an unversioned directory will fail.
298
299
        Setup: a1, a2 are in the working tree, sub is not.
299
 
        User does: mv a1 sub/.; bzr mv a1 a2 sub
 
300
        User does: mv a1 sub/.; brz mv a1 a2 sub
300
301
        """
301
302
        self.build_tree(['a1', 'a2', 'sub/'])
302
303
        tree = self.make_branch_and_tree('.')
304
305
 
305
306
        osutils.rename('a1', 'sub/a1')
306
307
        self.run_bzr_error(
307
 
            ["^bzr: ERROR: Could not move to sub. sub is not versioned\.$"],
 
308
            ["^brz: ERROR: Could not move to sub. sub is not versioned\\.$"],
308
309
            'mv a1 a2 sub')
309
310
        self.assertPathDoesNotExist('a1')
310
311
        self.assertPathExists('sub/a1')
312
313
        self.assertPathDoesNotExist('sub/a2')
313
314
 
314
315
    def test_mv_already_moved_file_forcing_after(self):
315
 
        """Test bzr mv versioned_file to unversioned_file.
 
316
        """Test brz mv versioned_file to unversioned_file.
316
317
 
317
318
        Tests if an attempt to move an existing versioned file to an existing
318
319
        unversioned file will fail, informing the user to use the --after
319
320
        option to force this.
320
321
        Setup: a is in the working tree, b not versioned.
321
 
        User does: mv a b; touch a; bzr mv a b
 
322
        User does: mv a b; touch a; brz mv a b
322
323
        """
323
324
        self.build_tree(['a', 'b'])
324
325
        tree = self.make_branch_and_tree('.')
325
326
        tree.add(['a'])
326
327
 
327
328
        osutils.rename('a', 'b')
328
 
        self.build_tree(['a']) #touch a
 
329
        self.build_tree(['a'])  # touch a
329
330
        self.run_bzr_error(
330
 
            ["^bzr: ERROR: Could not rename a => b because both files exist."
331
 
             " \(Use --after to tell bzr about a rename that has already"
332
 
             " happened\)$"],
 
331
            ["^brz: ERROR: Could not rename a => b because both files exist."
 
332
             " \\(Use --after to tell brz about a rename that has already"
 
333
             " happened\\)$"],
333
334
            'mv a b')
334
335
        self.assertPathExists('a')
335
336
        self.assertPathExists('b')
336
337
 
337
338
    def test_mv_already_moved_file_using_after(self):
338
 
        """Test bzr mv --after versioned_file to unversioned_file.
 
339
        """Test brz mv --after versioned_file to unversioned_file.
339
340
 
340
341
        Tests if an existing versioned file can be forced to move to an
341
342
        existing unversioned file using the --after option. With the result
342
343
        that bazaar considers the unversioned_file to be moved from
343
344
        versioned_file and versioned_file will become unversioned.
344
345
        Setup: a is in the working tree and b exists.
345
 
        User does: mv a b; touch a; bzr mv a b --after
 
346
        User does: mv a b; touch a; brz mv a b --after
346
347
        Resulting in a => b and a is unknown.
347
348
        """
348
349
        self.build_tree(['a', 'b'])
349
350
        tree = self.make_branch_and_tree('.')
350
351
        tree.add(['a'])
351
352
        osutils.rename('a', 'b')
352
 
        self.build_tree(['a']) #touch a
 
353
        self.build_tree(['a'])  # touch a
353
354
 
354
355
        self.run_bzr('mv a b --after')
355
356
        self.assertPathExists('a')
356
 
        self.assertNotInWorkingTree('a')#a should be unknown now.
 
357
        self.assertNotInWorkingTree('a')  # a should be unknown now.
357
358
        self.assertPathExists('b')
358
359
        self.assertInWorkingTree('b')
359
360
 
360
361
    def test_mv_already_moved_files_forcing_after(self):
361
 
        """Test bzr mv versioned_files to directory/unversioned_file.
 
362
        """Test brz mv versioned_files to directory/unversioned_file.
362
363
 
363
364
        Tests if an attempt to move an existing versioned file to an existing
364
365
        unversioned file in some other directory will fail, informing the user
366
367
 
367
368
        Setup: a1, a2, sub are versioned and in the working tree,
368
369
               sub/a1, sub/a2 are in working tree.
369
 
        User does: mv a* sub; touch a1; touch a2; bzr mv a1 a2 sub
 
370
        User does: mv a* sub; touch a1; touch a2; brz mv a1 a2 sub
370
371
        """
371
372
        self.build_tree(['a1', 'a2', 'sub/', 'sub/a1', 'sub/a2'])
372
373
        tree = self.make_branch_and_tree('.')
373
374
        tree.add(['a1', 'a2', 'sub'])
374
375
        osutils.rename('a1', 'sub/a1')
375
376
        osutils.rename('a2', 'sub/a2')
376
 
        self.build_tree(['a1']) #touch a1
377
 
        self.build_tree(['a2']) #touch a2
 
377
        self.build_tree(['a1'])  # touch a1
 
378
        self.build_tree(['a2'])  # touch a2
378
379
 
379
380
        self.run_bzr_error(
380
 
            ["^bzr: ERROR: Could not rename a1 => sub/a1 because both files"
381
 
             " exist. \(Use --after to tell bzr about a rename that has already"
382
 
             " happened\)$"],
 
381
            ["^brz: ERROR: Could not rename a1 => sub/a1 because both files"
 
382
             " exist. \\(Use --after to tell brz about a rename that has already"
 
383
             " happened\\)$"],
383
384
            'mv a1 a2 sub')
384
385
        self.assertPathExists('a1')
385
386
        self.assertPathExists('a2')
387
388
        self.assertPathExists('sub/a2')
388
389
 
389
390
    def test_mv_already_moved_files_using_after(self):
390
 
        """Test bzr mv --after versioned_file to directory/unversioned_file.
 
391
        """Test brz mv --after versioned_file to directory/unversioned_file.
391
392
 
392
393
        Tests if an existing versioned file can be forced to move to an
393
394
        existing unversioned file in some other directory using the --after
397
398
 
398
399
        Setup: a1, a2, sub are versioned and in the working tree,
399
400
               sub/a1, sub/a2 are in working tree.
400
 
        User does: mv a* sub; touch a1; touch a2; bzr mv a1 a2 sub --after
 
401
        User does: mv a* sub; touch a1; touch a2; brz mv a1 a2 sub --after
401
402
        """
402
403
        self.build_tree(['a1', 'a2', 'sub/', 'sub/a1', 'sub/a2'])
403
404
        tree = self.make_branch_and_tree('.')
404
405
        tree.add(['a1', 'a2', 'sub'])
405
406
        osutils.rename('a1', 'sub/a1')
406
407
        osutils.rename('a2', 'sub/a2')
407
 
        self.build_tree(['a1']) #touch a1
408
 
        self.build_tree(['a2']) #touch a2
 
408
        self.build_tree(['a1'])  # touch a1
 
409
        self.build_tree(['a2'])  # touch a2
409
410
 
410
411
        self.run_bzr('mv a1 a2 sub --after')
411
412
        self.assertPathExists('a1')
416
417
        self.assertInWorkingTree('sub/a2')
417
418
 
418
419
    def test_mv_already_moved_directory(self):
419
 
        """Use `bzr mv a b` to mark a directory as renamed.
 
420
        """Use `brz mv a b` to mark a directory as renamed.
420
421
 
421
422
        https://bugs.launchpad.net/bzr/+bug/107967/
422
423
        """
453
454
        self.assertEqual(out, '')
454
455
        self.assertEqual(err, 'a => b\nc => d\n')
455
456
        tree = workingtree.WorkingTree.open('tree')
456
 
        self.assertIsNot(None, tree.path2id('b'))
457
 
        self.assertIsNot(None, tree.path2id('d'))
 
457
        self.assertTrue(tree.is_versioned('b'))
 
458
        self.assertTrue(tree.is_versioned('d'))
458
459
 
459
460
    def test_mv_auto_one_path(self):
460
461
        self.make_abcd_tree()
462
463
        self.assertEqual(out, '')
463
464
        self.assertEqual(err, 'a => b\nc => d\n')
464
465
        tree = workingtree.WorkingTree.open('tree')
465
 
        self.assertIsNot(None, tree.path2id('b'))
466
 
        self.assertIsNot(None, tree.path2id('d'))
 
466
        self.assertTrue(tree.is_versioned('b'))
 
467
        self.assertTrue(tree.is_versioned('d'))
467
468
 
468
469
    def test_mv_auto_two_paths(self):
469
470
        self.make_abcd_tree()
470
471
        out, err = self.run_bzr('mv --auto tree tree2', retcode=3)
471
 
        self.assertEqual('bzr: ERROR: Only one path may be specified to'
 
472
        self.assertEqual('brz: ERROR: Only one path may be specified to'
472
473
                         ' --auto.\n', err)
473
474
 
474
475
    def test_mv_auto_dry_run(self):
477
478
        self.assertEqual(out, '')
478
479
        self.assertEqual(err, 'a => b\nc => d\n')
479
480
        tree = workingtree.WorkingTree.open('tree')
480
 
        self.assertIsNot(None, tree.path2id('a'))
481
 
        self.assertIsNot(None, tree.path2id('c'))
 
481
        self.assertTrue(tree.is_versioned('a'))
 
482
        self.assertTrue(tree.is_versioned('c'))
482
483
 
483
484
    def test_mv_no_auto_dry_run(self):
484
485
        self.make_abcd_tree()
485
486
        out, err = self.run_bzr('mv c d --dry-run',
486
487
                                working_dir='tree', retcode=3)
487
 
        self.assertEqual('bzr: ERROR: --dry-run requires --auto.\n', err)
 
488
        self.assertEqual('brz: ERROR: --dry-run requires --auto.\n', err)
488
489
 
489
490
    def test_mv_auto_after(self):
490
491
        self.make_abcd_tree()
491
492
        out, err = self.run_bzr('mv --auto --after', working_dir='tree',
492
493
                                retcode=3)
493
 
        self.assertEqual('bzr: ERROR: --after cannot be specified with'
 
494
        self.assertEqual('brz: ERROR: --after cannot be specified with'
494
495
                         ' --auto.\n', err)
495
496
 
496
497
    def test_mv_quiet(self):
503
504
 
504
505
    def test_mv_readonly_lightweight_checkout(self):
505
506
        branch = self.make_branch('foo')
506
 
        branch = bzrlib.branch.Branch.open(self.get_readonly_url('foo'))
 
507
        branch = breezy.branch.Branch.open(self.get_readonly_url('foo'))
507
508
        tree = branch.create_checkout('tree', lightweight=True)
508
509
        self.build_tree(['tree/path'])
509
510
        tree.add('path')
517
518
        tree = self.make_branch_and_tree(".")
518
519
        self.build_tree([u"\xA7"])
519
520
        out, err = self.run_bzr_error(["Could not rename", "not versioned"],
520
 
            ["mv", u"\xA7", "b"])
 
521
                                      ["mv", u"\xA7", "b"])
521
522
 
522
523
    def test_mv_removed_non_ascii(self):
523
524
        """Clear error on mv of a removed non-ascii file, see lp:898541"""
528
529
        tree.commit(u"Adding \xA7")
529
530
        os.remove(u"\xA7")
530
531
        out, err = self.run_bzr_error(["Could not rename", "not exist"],
531
 
            ["mv", u"\xA7", "b"])
 
532
                                      ["mv", u"\xA7", "b"])
 
533
 
 
534
    def test_dupe_move(self):
 
535
        self.script_runner = script.ScriptRunner()
 
536
        self.script_runner.run_script(self, '''
 
537
        $ brz init brz-bug
 
538
        Created a standalone tree (format: 2a)
 
539
        $ cd brz-bug
 
540
        $ mkdir dir
 
541
        $ brz add
 
542
        adding dir
 
543
        $ echo text >> dir/test.txt
 
544
        $ brz add
 
545
        adding dir/test.txt
 
546
        $ brz ci -m "Add files"
 
547
        2>Committing to: .../brz-bug/
 
548
        2>added dir
 
549
        2>added dir/test.txt
 
550
        2>Committed revision 1.
 
551
        $ mv dir dir2
 
552
        $ mv dir2/test.txt dir2/test2.txt
 
553
        $ brz st
 
554
        removed:
 
555
          dir/
 
556
          dir/test.txt
 
557
        unknown:
 
558
          dir2/
 
559
        $ brz mv dir dir2
 
560
        dir => dir2
 
561
        $ brz st
 
562
        removed:
 
563
          dir/test.txt
 
564
        renamed:
 
565
          dir/ => dir2/
 
566
        unknown:
 
567
          dir2/test2.txt
 
568
        $ brz mv dir/test.txt dir2/test2.txt
 
569
        dir/test.txt => dir2/test2.txt
 
570
        ''')