~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2007-05-07 16:48:14 UTC
  • mto: This revision was merged to the branch mainline in revision 2485.
  • Revision ID: robertc@robertcollins.net-20070507164814-wpagonutf4b5cf8s
Move HACKING to docs/developers/HACKING and adjust Makefile to accomodate this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    def ls_equals(self, value, *args):
40
40
        out, err = self.run_bzr('ls', *args)
41
41
        self.assertEqual('', err)
42
 
        self.assertEqual(value, out)
 
42
        self.assertEqualDiff(value, out)
43
43
 
44
44
    def test_ls_null_verbose(self):
45
45
        # Can't supply both
83
83
                       'V        subdir/b\n'
84
84
                       , '--verbose')
85
85
 
 
86
    def test_show_ids(self):
 
87
        self.build_tree(['subdir/'])
 
88
        self.wt.add(['a', 'subdir'], ['a-id', 'subdir-id'])
 
89
        self.ls_equals(
 
90
            '.bzrignore                                         \n'
 
91
            'a                                                  a-id\n'
 
92
            'subdir                                             subdir-id\n', 
 
93
            '--show-ids')
 
94
        self.ls_equals(
 
95
            '?        .bzrignore\n'
 
96
            'V        a                                         a-id\n'
 
97
            'V        subdir/                                   subdir-id\n', 
 
98
            '--show-ids', '--verbose')
 
99
        self.ls_equals('.bzrignore\0\0'
 
100
                       'a\0a-id\0'
 
101
                       'subdir\0subdir-id\0', '--show-ids', '--null')
 
102
 
86
103
    def test_ls_recursive(self):
87
104
        self.build_tree(['subdir/', 'subdir/b'])
88
105
        self.wt.add(['a', 'subdir/', 'subdir/b', '.bzrignore'])
117
134
                       'subdir\n'
118
135
                       , '--from-root', '--non-recursive')
119
136
 
 
137
    def test_ls_path(self):
 
138
        """If a path is specified, files are listed with that prefix"""
 
139
        self.build_tree(['subdir/', 'subdir/b'])
 
140
        self.wt.add(['subdir', 'subdir/b'])
 
141
        self.ls_equals('subdir/b\n' ,
 
142
                       'subdir')
 
143
        os.chdir('subdir')
 
144
        self.ls_equals('../.bzrignore\n'
 
145
                       '../a\n'
 
146
                       '../subdir\n'
 
147
                       '../subdir/b\n' ,
 
148
                       '..')
 
149
        self.ls_equals('../.bzrignore\0'
 
150
                       '../a\0'
 
151
                       '../subdir\0'
 
152
                       '../subdir/b\0' ,
 
153
                       '..', '--null')
 
154
        self.ls_equals('?        ../.bzrignore\n'
 
155
                       '?        ../a\n'
 
156
                       'V        ../subdir/\n'
 
157
                       'V        ../subdir/b\n' ,
 
158
                       '..', '--verbose')
 
159
        self.run_bzr_error('cannot specify both --from-root and PATH', 'ls',
 
160
                           '--from-root', '..')
 
161
 
120
162
    def test_ls_revision(self):
121
163
        self.wt.add(['a'])
122
164
        self.wt.commit('add')
131
173
        os.chdir('subdir')
132
174
        self.ls_equals('', '--revision', '1')
133
175
 
 
176
    def test_ls_branch(self):
 
177
        """If a branch is specified, files are listed from it"""
 
178
        self.build_tree(['subdir/', 'subdir/b'])
 
179
        self.wt.add(['subdir', 'subdir/b'])
 
180
        self.wt.commit('committing')
 
181
        branch = self.make_branch('branchdir')
 
182
        branch.pull(self.wt.branch)
 
183
        self.ls_equals('branchdir/subdir\n'
 
184
                       'branchdir/subdir/b\n',
 
185
                       'branchdir')
 
186
        self.ls_equals('branchdir/subdir\n'
 
187
                       'branchdir/subdir/b\n',
 
188
                       'branchdir', '--revision', '1')
 
189
 
134
190
    def test_ls_ignored(self):
135
191
        # Now try to do ignored files.
136
192
        self.wt.add(['a', '.bzrignore'])
157
213
                       'a\n'
158
214
                       , '--versioned')
159
215
 
 
216
    def test_kinds(self):
 
217
        self.build_tree(['subdir/'])
 
218
        self.ls_equals('.bzrignore\n' 
 
219
                       'a\n', 
 
220
                       '--kind=file')
 
221
        self.ls_equals('subdir\n',
 
222
                       '--kind=directory')
 
223
        self.ls_equals('',
 
224
                       '--kind=symlink')
 
225
        self.run_bzr_error('invalid kind specified', 'ls', '--kind=pile')