28
28
These are run by ``bzr.doctest``.
30
30
>>> import bzrlib, os
31
>>> bzrlib.commands.cmd_rocks()
34
Hey, nice place to begin.
31
>>> from bzrlib import ScratchBranch
32
>>> from bzrlib.osutils import isdir, isfile
36
34
The basic object is a Branch. We have a special helper class
37
35
ScratchBranch that automatically makes a directory and cleans itself
103
101
>>> r = b.get_revision(b.lookup_revision(1))
105
103
'start hello world'
106
>>> b.write_log(show_timezone='utc')
104
>>> bzrlib.show_log(b, show_timezone='utc')
107
105
----------------------------------------
109
107
committer: foo@nowhere
173
171
>>> list(b.working_tree().unknowns())
174
172
['d2/d3', 'd2/f2', 'd2/f3']
174
Tests for ignored files and patterns:
176
>>> b = ScratchBranch(dirs=['src', 'doc'],
177
... files=['configure.in', 'configure',
178
... 'doc/configure', 'foo.c',
180
>>> list(b.unknowns())
181
['configure', 'configure.in', 'doc', 'foo', 'foo.c', 'src']
182
>>> b.add(['doc', 'foo.c', 'src', 'configure.in'])
183
>>> list(b.unknowns())
184
['configure', 'foo', 'doc/configure']
185
>>> f = file(b.abspath('.bzrignore'), 'w')
186
>>> f.write('./configure\n'
189
>>> b.add('.bzrignore')
190
>>> list(b.unknowns())
192
>>> b.commit("commit 1")
193
>>> list(b.unknowns())
195
>>> b.add("doc/configure")
196
>>> b.commit("commit more")
201
>>> b = ScratchBranch(files=['foo'], dirs=['subdir'])
202
>>> b.add(['foo', 'subdir'])
203
>>> b.commit('add foo')
204
>>> list(b.unknowns())
206
>>> b.move(['foo'], 'subdir')
210
>>> b.commit("move foo to subdir")
211
>>> isfile(b.abspath('foo'))
213
>>> isfile(b.abspath('subdir/foo'))