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

  • Committer: Marius Kruger
  • Date: 2010-07-10 21:28:56 UTC
  • mto: (5384.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5385.
  • Revision ID: marius.kruger@enerweb.co.za-20100710212856-uq4ji3go0u5se7hx
* Update documentation
* add NEWS

Show diffs side-by-side

added added

removed removed

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