/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-08-23 01:15:41 UTC
  • mfrom: (7520.1.4 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200823011541-nv0oh7nzaganx2qy
Merge lp:brz/3.1.

Merged from https://code.launchpad.net/~jelmer/brz/merge-3.1/+merge/389690

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