~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_ls.py

  • Committer: wang
  • Date: 2006-10-29 13:41:32 UTC
  • mto: (2104.4.1 wang_65714)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: wang@ubuntu-20061029134132-3d7f4216f20c4aef
Replace python's difflib by patiencediff because the worst case 
performance is cubic for difflib and people commiting large data 
files are often hurt by this. The worst case performance of patience is 
quadratic. Fix bug 65714.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 by Canonical Ltd
 
1
# Copyright (C) 2006 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
28
28
        super(TestLS, self).setUp()
29
29
        
30
30
        # Create a simple branch that can be used in testing
31
 
        ignores._set_user_ignores(['./.bazaar', 'user-ignore'])
 
31
        ignores._set_user_ignores(['user-ignore'])
32
32
 
33
33
        self.wt = self.make_branch_and_tree('.')
34
34
        self.build_tree_contents([
48
48
 
49
49
    def test_ls_basic(self):
50
50
        """Test the abilities of 'bzr ls'"""
51
 
        self.ls_equals('.bazaar\n.bzrignore\na\n')
52
 
        self.ls_equals('I        .bazaar/\n'
53
 
                       '?        .bzrignore\n'
 
51
        self.ls_equals('.bzrignore\na\n')
 
52
        self.ls_equals('?        .bzrignore\n'
54
53
                       '?        a\n',
55
54
                       '--verbose')
56
55
        self.ls_equals('.bzrignore\n'
57
56
                       'a\n',
58
57
                       '--unknown')
59
 
        self.ls_equals('.bazaar\n', '--ignored')
 
58
        self.ls_equals('', '--ignored')
60
59
        self.ls_equals('', '--versioned')
61
 
        self.ls_equals('.bazaar\n'
62
 
                       '.bzrignore\n'
 
60
        self.ls_equals('.bzrignore\n'
63
61
                       'a\n',
64
62
                       '--unknown', '--ignored', '--versioned')
65
 
        self.ls_equals('.bazaar\n', '--ignored', '--versioned')
66
 
        self.ls_equals('.bazaar\0.bzrignore\0a\0', '--null')
 
63
        self.ls_equals('', '--ignored', '--versioned')
 
64
        self.ls_equals('.bzrignore\0a\0', '--null')
67
65
 
68
66
    def test_ls_added(self):
69
67
        self.wt.add(['a'])
70
 
        self.ls_equals('I        .bazaar/\n'
71
 
                       '?        .bzrignore\n'
 
68
        self.ls_equals('?        .bzrignore\n'
72
69
                       'V        a\n',
73
70
                       '--verbose')
74
71
        self.wt.commit('add')
75
72
        
76
73
        self.build_tree(['subdir/'])
77
 
        self.ls_equals('I        .bazaar/\n'
78
 
                       '?        .bzrignore\n'
 
74
        self.ls_equals('?        .bzrignore\n'
79
75
                       'V        a\n'
80
76
                       '?        subdir/\n'
81
77
                       , '--verbose')
82
78
        self.build_tree(['subdir/b'])
83
79
        self.wt.add(['subdir/', 'subdir/b', '.bzrignore'])
84
 
        self.ls_equals('I        .bazaar/\n'
85
 
                       'V        .bzrignore\n'
 
80
        self.ls_equals('V        .bzrignore\n'
86
81
                       'V        a\n'
87
82
                       'V        subdir/\n'
88
83
                       'V        subdir/b\n'
92
87
        self.build_tree(['subdir/', 'subdir/b'])
93
88
        self.wt.add(['a', 'subdir/', 'subdir/b', '.bzrignore'])
94
89
 
95
 
        self.ls_equals('.bazaar\n'
96
 
                       '.bzrignore\n'
 
90
        self.ls_equals('.bzrignore\n'
97
91
                       'a\n'
98
92
                       'subdir\n'
99
93
                       , '--non-recursive')
100
94
 
101
 
        self.ls_equals('I        .bazaar/\n'
102
 
                       'V        .bzrignore\n'
 
95
        self.ls_equals('V        .bzrignore\n'
103
96
                       'V        a\n'
104
97
                       'V        subdir/\n'
105
98
                       , '--verbose', '--non-recursive')
109
102
        self.ls_equals('b\n')
110
103
        self.ls_equals('b\0'
111
104
                  , '--null')
112
 
        self.ls_equals('.bazaar\n'
113
 
                       '.bzrignore\n'
 
105
        self.ls_equals('.bzrignore\n'
114
106
                       'a\n'
115
107
                       'subdir\n'
116
108
                       'subdir/b\n'
117
109
                       , '--from-root')
118
 
        self.ls_equals('.bazaar\0'
119
 
                       '.bzrignore\0'
 
110
        self.ls_equals('.bzrignore\0'
120
111
                       'a\0'
121
112
                       'subdir\0'
122
113
                       'subdir/b\0'
123
114
                       , '--from-root', '--null')
124
 
        self.ls_equals('.bazaar\n'
125
 
                       '.bzrignore\n'
 
115
        self.ls_equals('.bzrignore\n'
126
116
                       'a\n'
127
117
                       'subdir\n'
128
118
                       , '--from-root', '--non-recursive')
146
136
        self.wt.add(['a', '.bzrignore'])
147
137
 
148
138
        self.build_tree(['blah.py', 'blah.pyo', 'user-ignore'])
149
 
        self.ls_equals('.bazaar\n'
150
 
                       '.bzrignore\n'
 
139
        self.ls_equals('.bzrignore\n'
151
140
                       'a\n'
152
141
                       'blah.py\n'
153
142
                       'blah.pyo\n'
154
143
                       'user-ignore\n'
155
144
                       )
156
 
        self.ls_equals('I        .bazaar/\n'
157
 
                       'V        .bzrignore\n'
 
145
        self.ls_equals('V        .bzrignore\n'
158
146
                       'V        a\n'
159
147
                       '?        blah.py\n'
160
148
                       'I        blah.pyo\n'
161
149
                       'I        user-ignore\n'
162
150
                       , '--verbose')
163
 
        self.ls_equals('.bazaar\n'
164
 
                       'blah.pyo\n'
 
151
        self.ls_equals('blah.pyo\n'
165
152
                       'user-ignore\n'
166
153
                       , '--ignored')
167
154
        self.ls_equals('blah.py\n'