~bzr-pqm/bzr/bzr.dev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
The Branch API in bzrlib provides creation and management of Branches.

A Branch represents a series of commits and merges carried out by a user.

Make a temporary directory for these tests:

   >>> from bzrlib import osutils
   >>> test_dir = osutils.mkdtemp(prefix='bzrlib_doc_api_branch_txt_')

Branches are created by BzrDir's:

   >>> from bzrlib.branch import Branch
   >>> from bzrlib.bzrdir import BzrDir

   >>> new_branch = BzrDir.create_branch_convenience(test_dir)

Existing Branches can be opened directly:

   >>> transport = new_branch.bzrdir.transport
   >>> another_instance = Branch.open(transport.clone('..').base)

or via the BzrDir:

   >>> still_the_same_branch = new_branch.bzrdir.open_branch()

A branch has a history of revisions on it:

   >>> new_branch.revision_history()
   []

We need to write some more documentation, showing
push and pull operations. Cloning might also be nice.

And finally, clean up:

   >>> import shutil
   >>> shutil.rmtree(test_dir)