/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_status.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
"""
24
24
 
25
25
import codecs
 
26
from io import (
 
27
    BytesIO,
 
28
    StringIO,
 
29
    )
26
30
from os import mkdir, chdir, rmdir, unlink
27
31
import sys
28
32
 
29
33
from ... import (
30
 
    conflicts,
31
34
    errors,
32
35
    osutils,
33
36
    status,
34
37
    )
35
38
from breezy.bzr import (
36
39
    bzrdir,
 
40
    conflicts,
37
41
    )
38
42
import breezy.branch
39
43
from ...osutils import pathjoin
40
44
from ...revisionspec import RevisionSpec
41
 
from ...sixish import (
42
 
    BytesIO,
43
 
    StringIO,
44
 
    PY3,
45
 
    )
46
45
from ...status import show_tree_status
47
46
from .. import TestCaseWithTransport, TestSkipped
48
47
from ...workingtree import WorkingTree
298
297
        self.build_tree(['dir2/'])
299
298
        tree.add('dir2')
300
299
        tree.commit('added dir2')
301
 
        tree.set_conflicts(conflicts.ConflictList(
302
 
            [conflicts.ContentsConflict('foo')]))
 
300
        tree.set_conflicts([conflicts.ContentsConflict('foo')])
303
301
        tof = BytesIO()
304
302
        show_tree_status(tree, specific_files=['dir2'], to_file=tof)
305
303
        self.assertEqualDiff(b'', tof.getvalue())
306
 
        tree.set_conflicts(conflicts.ConflictList(
307
 
            [conflicts.ContentsConflict('dir2')]))
 
304
        tree.set_conflicts([conflicts.ContentsConflict('dir2')])
308
305
        tof = StringIO()
309
306
        show_tree_status(tree, specific_files=['dir2'], to_file=tof)
310
307
        self.assertEqualDiff('conflicts:\n  Contents conflict in dir2\n',
311
308
                             tof.getvalue())
312
309
 
313
 
        tree.set_conflicts(conflicts.ConflictList(
314
 
            [conflicts.ContentsConflict('dir2/file1')]))
 
310
        tree.set_conflicts([conflicts.ContentsConflict('dir2/file1')])
315
311
        tof = StringIO()
316
312
        show_tree_status(tree, specific_files=['dir2'], to_file=tof)
317
313
        self.assertEqualDiff('conflicts:\n  Contents conflict in dir2/file1\n',
497
493
        """Simulate status of out-of-date tree after remote push"""
498
494
        tree = self.make_branch_and_tree('.')
499
495
        self.build_tree_contents([('a', b'foo\n')])
500
 
        tree.lock_write()
501
 
        try:
 
496
        with tree.lock_write():
502
497
            tree.add(['a'])
503
498
            tree.commit('add test file')
504
499
            # simulate what happens after a remote push
505
500
            tree.set_last_revision(b"0")
506
 
        finally:
507
 
            # before run another commands we should unlock tree
508
 
            tree.unlock()
509
501
        out, err = self.run_bzr('status')
510
502
        self.assertEqual("working tree is out of date, run 'brz update'\n",
511
503
                         err)
720
712
        self.assertStatusContains(
721
713
            'kind changed:\n  file \\(file => directory\\)')
722
714
        tree.rename_one('file', 'directory')
723
 
        self.assertStatusContains('renamed:\n  file/ => directory/\n'
 
715
        self.assertStatusContains('renamed:\n  file => directory/\n'
724
716
                                  'modified:\n  directory/\n')
725
717
        rmdir('directory')
726
718
        self.assertStatusContains('removed:\n  file\n')
809
801
added:
810
802
  hell\u00d8
811
803
"""
812
 
        if not PY3:
813
 
            expected = expected.encode('latin-1')
814
804
        self.assertEqual(stdout, expected)