39
def ls_equals(self, value, args=None):
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)
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')
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'
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')
69
66
def test_ls_added(self):
100
97
'V subdir/ subdir-id\n',
101
'--show-ids --verbose')
98
'--show-ids', '--verbose')
102
99
self.ls_equals('.bzrignore\0\0'
104
'subdir\0subdir-id\0', '--show-ids --null')
101
'subdir\0subdir-id\0', '--show-ids', '--null')
106
103
def test_ls_recursive(self):
107
104
self.build_tree(['subdir/', 'subdir/b'])
115
112
self.ls_equals('V .bzrignore\n'
118
, '--verbose --non-recursive')
115
, '--verbose', '--non-recursive')
120
117
# Check what happens in a sub-directory
121
118
os.chdir('subdir')
134
, '--from-root --null')
131
, '--from-root', '--null')
135
132
self.ls_equals('.bzrignore\n'
138
, '--from-root --non-recursive')
135
, '--from-root', '--non-recursive')
140
137
def test_ls_path(self):
141
138
"""If a path is specified, files are listed with that prefix"""
155
152
'../subdir/b\0' ,
157
154
self.ls_equals('? ../.bzrignore\n'
160
157
'V ../subdir/b\n' ,
162
self.run_bzr_error('cannot specify both --from-root and PATH',
159
self.run_bzr_error('cannot specify both --from-root and PATH', 'ls',
165
162
def test_ls_revision(self):
166
163
self.wt.add(['a'])
169
166
self.build_tree(['subdir/'])
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')
176
173
os.chdir('subdir')
177
self.ls_equals('', '--revision 1')
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',
189
self.ls_equals('branchdir/subdir\n'
190
'branchdir/subdir/b\n',
191
'branchdir --revision 1')
174
self.ls_equals('', '--revision', '1')
193
176
def test_ls_ignored(self):
194
177
# Now try to do ignored files.