~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Alexander Belchenko
  • Date: 2007-01-04 23:36:44 UTC
  • mfrom: (2224 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2225.
  • Revision ID: bialix@ukr.net-20070104233644-7znkxoj9b0y7ev28
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'"""
62
59
        self.ls_equals('', '--versioned')
63
60
        self.ls_equals('.bzrignore\n'
64
61
                       'a\n',
65
 
                       '--unknown --ignored --versioned')
66
 
        self.ls_equals('', '--ignored --versioned')
 
62
                       '--unknown', '--ignored', '--versioned')
 
63
        self.ls_equals('', '--ignored', '--versioned')
67
64
        self.ls_equals('.bzrignore\0a\0', '--null')
68
65
 
69
66
    def test_ls_added(self):
98
95
            '?        .bzrignore\n'
99
96
            'V        a                                         a-id\n'
100
97
            'V        subdir/                                   subdir-id\n', 
101
 
            '--show-ids --verbose')
 
98
            '--show-ids', '--verbose')
102
99
        self.ls_equals('.bzrignore\0\0'
103
100
                       'a\0a-id\0'
104
 
                       'subdir\0subdir-id\0', '--show-ids --null')
 
101
                       'subdir\0subdir-id\0', '--show-ids', '--null')
105
102
 
106
103
    def test_ls_recursive(self):
107
104
        self.build_tree(['subdir/', 'subdir/b'])
115
112
        self.ls_equals('V        .bzrignore\n'
116
113
                       'V        a\n'
117
114
                       'V        subdir/\n'
118
 
                       , '--verbose --non-recursive')
 
115
                       , '--verbose', '--non-recursive')
119
116
 
120
117
        # Check what happens in a sub-directory
121
118
        os.chdir('subdir')
131
128
                       'a\0'
132
129
                       'subdir\0'
133
130
                       'subdir/b\0'
134
 
                       , '--from-root --null')
 
131
                       , '--from-root', '--null')
135
132
        self.ls_equals('.bzrignore\n'
136
133
                       'a\n'
137
134
                       'subdir\n'
138
 
                       , '--from-root --non-recursive')
 
135
                       , '--from-root', '--non-recursive')
139
136
 
140
137
    def test_ls_path(self):
141
138
        """If a path is specified, files are listed with that prefix"""
153
150
                       '../a\0'
154
151
                       '../subdir\0'
155
152
                       '../subdir/b\0' ,
156
 
                       '.. --null')
 
153
                       '..', '--null')
157
154
        self.ls_equals('?        ../.bzrignore\n'
158
155
                       '?        ../a\n'
159
156
                       'V        ../subdir/\n'
160
157
                       'V        ../subdir/b\n' ,
161
 
                       '.. --verbose')
162
 
        self.run_bzr_error('cannot specify both --from-root and PATH',
163
 
                           'ls --from-root ..')
 
158
                       '..', '--verbose')
 
159
        self.run_bzr_error('cannot specify both --from-root and PATH', 'ls',
 
160
                           '--from-root', '..')
164
161
 
165
162
    def test_ls_revision(self):
166
163
        self.wt.add(['a'])
169
166
        self.build_tree(['subdir/'])
170
167
 
171
168
        # Check what happens when we supply a specific revision
172
 
        self.ls_equals('a\n', '--revision 1')
 
169
        self.ls_equals('a\n', '--revision', '1')
173
170
        self.ls_equals('V        a\n'
174
 
                       , '--verbose --revision 1')
 
171
                       , '--verbose', '--revision', '1')
175
172
 
176
173
        os.chdir('subdir')
177
 
        self.ls_equals('', '--revision 1')
178
 
 
179
 
    def test_ls_branch(self):
180
 
        """If a branch is specified, files are listed from it"""
181
 
        self.build_tree(['subdir/', 'subdir/b'])
182
 
        self.wt.add(['subdir', 'subdir/b'])
183
 
        self.wt.commit('committing')
184
 
        branch = self.make_branch('branchdir')
185
 
        branch.pull(self.wt.branch)
186
 
        self.ls_equals('branchdir/subdir\n'
187
 
                       'branchdir/subdir/b\n',
188
 
                       'branchdir')
189
 
        self.ls_equals('branchdir/subdir\n'
190
 
                       'branchdir/subdir/b\n',
191
 
                       'branchdir --revision 1')
 
174
        self.ls_equals('', '--revision', '1')
192
175
 
193
176
    def test_ls_ignored(self):
194
177
        # Now try to do ignored files.
225
208
                       '--kind=directory')
226
209
        self.ls_equals('',
227
210
                       '--kind=symlink')
228
 
        self.run_bzr_error('invalid kind specified', 'ls --kind=pile')
 
211
        self.run_bzr_error('invalid kind specified', 'ls', '--kind=pile')