/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: Jelmer Vernooij
  • Date: 2019-05-29 03:22:34 UTC
  • mfrom: (7303 work)
  • mto: This revision was merged to the branch mainline in revision 7306.
  • Revision ID: jelmer@jelmer.uk-20190529032234-mt3fuws8gq03tapi
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
from breezy.tests import (
28
28
    TestCaseWithTransport,
 
29
    script,
29
30
    )
30
31
from breezy.tests.features import (
31
32
    CaseInsensitiveFilesystemFeature,
234
235
        self.run_bzr_error(
235
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
 
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
331
            ["^brz: ERROR: Could not rename a => b because both files exist."
331
332
             " \\(Use --after to tell brz about a rename that has already"
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
 
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
381
            ["^brz: ERROR: Could not rename a1 => sub/a1 because both files"
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')
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
        ''')