28
28
These are run by ``bzr.doctest``.
31
>>> from bzrlib import ScratchBranch
32
>>> from bzrlib.osutils import isdir, isfile
30
>>> import bzr, bzrlib, os
33
31
>>> bzrlib.commands.cmd_rocks()
141
139
Tests for adding subdirectories, etc.
143
141
>>> b = bzrlib.branch.ScratchBranch()
144
>>> os.mkdir(b.abspath('d1'))
145
>>> os.mkdir(b.abspath('d2'))
146
>>> os.mkdir(b.abspath('d2/d3'))
142
>>> os.mkdir(b._rel('d1'))
143
>>> os.mkdir(b._rel('d2'))
144
>>> os.mkdir(b._rel('d2/d3'))
147
145
>>> list(b.working_tree().unknowns())
150
148
Create some files, but they're not seen as unknown yet:
152
>>> file(b.abspath('d1/f1'), 'w').close()
153
>>> file(b.abspath('d2/f2'), 'w').close()
154
>>> file(b.abspath('d2/f3'), 'w').close()
150
>>> file(b._rel('d1/f1'), 'w').close()
151
>>> file(b._rel('d2/f2'), 'w').close()
152
>>> file(b._rel('d2/f3'), 'w').close()
155
153
>>> [v[0] for v in b.inventory.directories()]
157
155
>>> list(b.working_tree().unknowns())
171
169
>>> list(b.working_tree().unknowns())
172
170
['d1/f1', 'd2/d3', 'd2/f2', 'd2/f3']
175
>>> list(b.working_tree().unknowns())
176
['d2/d3', 'd2/f2', 'd2/f3']
178
Tests for ignored files and patterns:
180
>>> b = ScratchBranch(dirs=['src', 'doc'],
181
... files=['configure.in', 'configure',
182
... 'doc/configure', 'foo.c',
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'
193
>>> b.add('.bzrignore')
194
>>> list(b.unknowns())
196
>>> b.commit("commit 1")
197
>>> list(b.unknowns())
199
>>> b.add("doc/configure")
200
>>> b.commit("commit more")
205
>>> b = ScratchBranch(files=['foo'], dirs=['subdir'])
206
>>> b.add(['foo', 'subdir'])
207
>>> b.commit('add foo')
208
>>> list(b.unknowns())
210
>>> b.move(['foo'], 'subdir')
214
>>> bzrlib.commands.cmd_renames(b.base)
216
>>> b.commit("move foo to subdir")
217
>>> isfile(b.abspath('foo'))
219
>>> isfile(b.abspath('subdir/foo'))