~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2007-02-06 14:52:16 UTC
  • mfrom: (2266 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2268.
  • Revision ID: abentley@panoramicfeedback.com-20070206145216-fcpi8o3ufvuzwbp9
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
                                 ('a', 'hello\n'),
37
37
                                 ])
38
38
 
39
 
    def ls_equals(self, value, args=None):
40
 
        command = 'ls'
41
 
        if args is not None:
42
 
            command += ' ' + args
43
 
        out, err = self.run_bzr(command)
 
39
    def ls_equals(self, value, *args):
 
40
        out, err = self.run_bzr('ls', *args)
44
41
        self.assertEqual('', err)
45
42
        self.assertEqualDiff(value, out)
46
43
 
47
44
    def test_ls_null_verbose(self):
48
45
        # Can't supply both
49
46
        self.run_bzr_error(['Cannot set both --verbose and --null'],
50
 
                           'ls --verbose --null')
 
47
                           'ls', '--verbose', '--null')
51
48
 
52
49
    def test_ls_basic(self):
53
50
        """Test the abilities of 'bzr ls'"""
60
57
                       '--unknown')
61
58
        self.ls_equals('', '--ignored')
62
59
        self.ls_equals('', '--versioned')
63
 
        self.ls_equals('', '-V')
64
 
        self.ls_equals('.bzrignore\n'
65
 
                       'a\n',
66
 
                       '--unknown --ignored --versioned')
67
 
        self.ls_equals('.bzrignore\n'
68
 
                       'a\n',
69
 
                       '--unknown --ignored -V')
70
 
        self.ls_equals('', '--ignored --versioned')
71
 
        self.ls_equals('', '--ignored -V')
 
60
        self.ls_equals('.bzrignore\n'
 
61
                       'a\n',
 
62
                       '--unknown', '--ignored', '--versioned')
 
63
        self.ls_equals('', '--ignored', '--versioned')
72
64
        self.ls_equals('.bzrignore\0a\0', '--null')
73
65
 
74
66
    def test_ls_added(self):
103
95
            '?        .bzrignore\n'
104
96
            'V        a                                         a-id\n'
105
97
            'V        subdir/                                   subdir-id\n', 
106
 
            '--show-ids --verbose')
 
98
            '--show-ids', '--verbose')
107
99
        self.ls_equals('.bzrignore\0\0'
108
100
                       'a\0a-id\0'
109
 
                       'subdir\0subdir-id\0', '--show-ids --null')
 
101
                       'subdir\0subdir-id\0', '--show-ids', '--null')
110
102
 
111
103
    def test_ls_recursive(self):
112
104
        self.build_tree(['subdir/', 'subdir/b'])
120
112
        self.ls_equals('V        .bzrignore\n'
121
113
                       'V        a\n'
122
114
                       'V        subdir/\n'
123
 
                       , '--verbose --non-recursive')
 
115
                       , '--verbose', '--non-recursive')
124
116
 
125
117
        # Check what happens in a sub-directory
126
118
        os.chdir('subdir')
136
128
                       'a\0'
137
129
                       'subdir\0'
138
130
                       'subdir/b\0'
139
 
                       , '--from-root --null')
 
131
                       , '--from-root', '--null')
140
132
        self.ls_equals('.bzrignore\n'
141
133
                       'a\n'
142
134
                       'subdir\n'
143
 
                       , '--from-root --non-recursive')
 
135
                       , '--from-root', '--non-recursive')
144
136
 
145
137
    def test_ls_path(self):
146
138
        """If a path is specified, files are listed with that prefix"""
158
150
                       '../a\0'
159
151
                       '../subdir\0'
160
152
                       '../subdir/b\0' ,
161
 
                       '.. --null')
 
153
                       '..', '--null')
162
154
        self.ls_equals('?        ../.bzrignore\n'
163
155
                       '?        ../a\n'
164
156
                       'V        ../subdir/\n'
165
157
                       'V        ../subdir/b\n' ,
166
 
                       '.. --verbose')
167
 
        self.run_bzr_error('cannot specify both --from-root and PATH',
168
 
                           'ls --from-root ..')
 
158
                       '..', '--verbose')
 
159
        self.run_bzr_error('cannot specify both --from-root and PATH', 'ls',
 
160
                           '--from-root', '..')
169
161
 
170
162
    def test_ls_revision(self):
171
163
        self.wt.add(['a'])
174
166
        self.build_tree(['subdir/'])
175
167
 
176
168
        # Check what happens when we supply a specific revision
177
 
        self.ls_equals('a\n', '--revision 1')
 
169
        self.ls_equals('a\n', '--revision', '1')
178
170
        self.ls_equals('V        a\n'
179
 
                       , '--verbose --revision 1')
 
171
                       , '--verbose', '--revision', '1')
180
172
 
181
173
        os.chdir('subdir')
182
 
        self.ls_equals('', '--revision 1')
 
174
        self.ls_equals('', '--revision', '1')
183
175
 
184
176
    def test_ls_branch(self):
185
177
        """If a branch is specified, files are listed from it"""
193
185
                       'branchdir')
194
186
        self.ls_equals('branchdir/subdir\n'
195
187
                       'branchdir/subdir/b\n',
196
 
                       'branchdir --revision 1')
 
188
                       'branchdir', '--revision', '1')
197
189
 
198
190
    def test_ls_ignored(self):
199
191
        # Now try to do ignored files.
220
212
        self.ls_equals('.bzrignore\n'
221
213
                       'a\n'
222
214
                       , '--versioned')
223
 
        self.ls_equals('.bzrignore\n'
224
 
                       'a\n'
225
 
                       , '-V')
226
215
 
227
216
    def test_kinds(self):
228
217
        self.build_tree(['subdir/'])
233
222
                       '--kind=directory')
234
223
        self.ls_equals('',
235
224
                       '--kind=symlink')
236
 
        self.run_bzr_error('invalid kind specified', 'ls --kind=pile')
 
225
        self.run_bzr_error('invalid kind specified', 'ls', '--kind=pile')