~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests.py

  • Committer: mbp at sourcefrog
  • Date: 2005-04-05 08:24:51 UTC
  • Revision ID: mbp@sourcefrog.net-20050405082451-408ebb0fd108440f
start adding quotes

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
These are run by ``bzr.doctest``.
29
29
 
30
30
>>> import bzrlib, os
 
31
>>> from bzrlib import ScratchBranch
 
32
>>> from bzrlib.osutils import isdir, isfile
31
33
>>> bzrlib.commands.cmd_rocks()
32
34
it sure does!
33
35
 
161
163
    >>> [v[0] for v in b.inventory.directories()]
162
164
    ['', 'd1']
163
165
    >>> list(b.working_tree().unknowns())
164
 
    ['d1/f1', 'd2']
 
166
    ['d2', 'd1/f1']
165
167
    >>> # d2 comes first because it's in the top directory
166
168
 
167
169
    >>> b.add('d2')
173
175
    >>> list(b.working_tree().unknowns())
174
176
    ['d2/d3', 'd2/f2', 'd2/f3']
175
177
 
 
178
Tests for ignored files and patterns:
 
179
 
 
180
    >>> b = ScratchBranch(dirs=['src', 'doc'],
 
181
    ...                   files=['configure.in', 'configure',
 
182
    ...                          'doc/configure', 'foo.c',
 
183
    ...                          'foo'])
 
184
    >>> list(b.unknowns())
 
185
    ['configure', 'configure.in', 'doc', 'foo', 'foo.c', 'src']
 
186
    >>> b.add(['doc', 'foo.c', 'src', 'configure.in'])
 
187
    >>> list(b.unknowns())
 
188
    ['configure', 'foo', 'doc/configure']
 
189
    >>> f = file(b.abspath('.bzrignore'), 'w')
 
190
    >>> f.write('./configure\n'
 
191
    ...         './foo\n')
 
192
    >>> f.close()
 
193
    >>> b.add('.bzrignore')
 
194
    >>> list(b.unknowns())
 
195
    ['doc/configure']
 
196
    >>> b.commit("commit 1")
 
197
    >>> list(b.unknowns())
 
198
    ['doc/configure']
 
199
    >>> b.add("doc/configure")
 
200
    >>> b.commit("commit more")
 
201
    >>> del b
 
202
 
 
203
Renames, etc:
 
204
 
 
205
    >>> b = ScratchBranch(files=['foo'], dirs=['subdir'])
 
206
    >>> b.add(['foo', 'subdir'])
 
207
    >>> b.commit('add foo')
 
208
    >>> list(b.unknowns())
 
209
    []
 
210
    >>> b.rename(['foo'], 'subdir')
 
211
    foo => subdir/foo
 
212
    >>> b.show_status()
 
213
    R       foo => subdir/foo
 
214
    >>> bzrlib.commands.cmd_renames(b.base)
 
215
    foo => subdir/foo
 
216
    >>> b.commit("move foo to subdir")
 
217
    >>> isfile(b.abspath('foo'))
 
218
    False
 
219
    >>> isfile(b.abspath('subdir/foo'))
 
220
    True
 
221
 
176
222
"""