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

  • Committer: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2007 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2009, 2011 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
17
17
 
18
18
"""Tests being able to ignore bad filetypes."""
19
19
 
20
 
from cStringIO import StringIO
21
20
import os
22
21
 
23
 
from bzrlib import (
24
 
    add,
 
22
from .. import (
25
23
    errors,
26
24
    )
27
 
from bzrlib.status import show_tree_status
28
 
from bzrlib.tests import OsFifoFeature, TestCaseWithTransport
 
25
from ..sixish import (
 
26
    StringIO,
 
27
    )
 
28
from ..status import show_tree_status
 
29
from . import TestCaseWithTransport
 
30
from .features import (
 
31
    OsFifoFeature,
 
32
    )
29
33
 
30
34
 
31
35
def verify_status(tester, tree, value):
46
50
        b = wt.branch
47
51
 
48
52
        files = ['one', 'two', 'three']
49
 
        file_ids = ['one-id', 'two-id', 'three-id']
 
53
        file_ids = [b'one-id', b'two-id', b'three-id']
50
54
        self.build_tree(files)
51
55
        wt.add(files, file_ids)
52
 
        wt.commit("Commit one", rev_id="a@u-0-0")
 
56
        wt.commit("Commit one", rev_id=b"a@u-0-0")
53
57
 
54
58
        # We should now have a few files, lets try to
55
59
        # put some bogus stuff in the tree
61
65
        self.build_tree(['six'])
62
66
 
63
67
        verify_status(self, wt,
64
 
                          ['unknown:\n',
65
 
                           '  a-fifo\n',
66
 
                           '  six\n'
67
 
                           ])
 
68
                      ['unknown:\n',
 
69
                       '  a-fifo\n',
 
70
                       '  six\n'
 
71
                       ])
68
72
 
69
73
        # We should raise an error if we are adding a bogus file
70
74
        self.assertRaises(errors.BadFileKindError, wt.smart_add, ['a-fifo'])
71
75
 
72
76
        # And the list of files shouldn't have been modified
73
77
        verify_status(self, wt,
74
 
                          ['unknown:\n',
75
 
                           '  a-fifo\n',
76
 
                           '  six\n'
77
 
                           ])
 
78
                      ['unknown:\n',
 
79
                       '  a-fifo\n',
 
80
                       '  six\n'
 
81
                       ])
78
82
 
79
83
        # Make sure smart_add can handle having a bogus
80
84
        # file in the way
81
85
        wt.smart_add([])
82
86
        verify_status(self, wt,
83
 
                          ['added:\n',
84
 
                           '  six\n',
85
 
                           'unknown:\n',
86
 
                           '  a-fifo\n',
87
 
                           ])
88
 
        wt.commit("Commit four", rev_id="a@u-0-3")
 
87
                      ['added:\n',
 
88
                       '  six\n',
 
89
                       'unknown:\n',
 
90
                       '  a-fifo\n',
 
91
                       ])
 
92
        wt.commit("Commit four", rev_id=b"a@u-0-3")
89
93
 
90
94
        verify_status(self, wt,
91
 
                          ['unknown:\n',
92
 
                           '  a-fifo\n',
93
 
                           ])
 
95
                      ['unknown:\n',
 
96
                       '  a-fifo\n',
 
97
                       ])