~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/doc/api/branch.txt

  • Committer: Robert Collins
  • Date: 2007-03-08 04:06:06 UTC
  • mfrom: (2323.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 2442.
  • Revision ID: robertc@robertcollins.net-20070308040606-84gsniv56huiyjt4
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
A Branch represents a series of commits and merges carried out by a user.
4
4
 
 
5
Make a temporary directory for these tests:
 
6
 
 
7
   >>> from bzrlib import osutils
 
8
   >>> test_dir = osutils.mkdtemp(prefix='bzrlib_doc_api_branch_txt_')
 
9
 
5
10
Branches are created by BzrDir's:
6
11
 
7
 
   >>> from bzrlib.bzrdir import ScratchDir
8
12
   >>> from bzrlib.branch import Branch
9
 
   >>> dir = ScratchDir()
10
 
   >>> new_branch = dir.create_branch()
 
13
   >>> from bzrlib.bzrdir import BzrDir
11
14
 
 
15
   >>> new_branch = BzrDir.create_branch_convenience(test_dir)
12
16
 
13
17
Existing Branches can be opened directly:
14
18
 
15
 
   >>> another_instance = Branch.open(dir.transport.clone('..').base)
 
19
   >>> transport = new_branch.bzrdir.transport
 
20
   >>> another_instance = Branch.open(transport.clone('..').base)
16
21
 
17
22
or via the BzrDir:
18
23
 
19
 
   >>> still_the_same_branch = dir.open_branch()
20
 
 
 
24
   >>> still_the_same_branch = new_branch.bzrdir.open_branch()
21
25
 
22
26
A branch has a history of revisions on it:
23
27
 
24
28
   >>> new_branch.revision_history()
25
29
   []
26
30
 
27
 
 
28
31
We need to write some more documentation, showing
29
32
push and pull operations. Cloning might also be nice.
 
33
 
 
34
And finally, clean up:
 
35
 
 
36
   >>> import shutil
 
37
   >>> shutil.rmtree(test_dir)