~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branchbuilder.py

  • Committer: Andrew Bennetts
  • Date: 2009-08-05 02:12:22 UTC
  • mto: This revision was merged to the branch mainline in revision 4608.
  • Revision ID: andrew.bennetts@canonical.com-20090805021222-t5y7crtvdv4tczn2
Undo changes that aren't needed anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    commit,
22
22
    errors,
23
23
    memorytree,
24
 
    revision as _mod_revision,
25
24
    )
26
25
 
27
26
 
57
56
        a series in progress, it should be None.
58
57
    """
59
58
 
60
 
    def __init__(self, transport=None, format=None, branch=None,
61
 
            automatic_root=False):
 
59
    def __init__(self, transport=None, format=None, branch=None):
62
60
        """Construct a BranchBuilder on transport.
63
61
 
64
62
        :param transport: The transport the branch should be created on.
68
66
            bzrdir format registry for the branch to be built.
69
67
        :param branch: An already constructed branch to use.  This param is
70
68
            mutually exclusive with the transport and format params.
71
 
        :param automatic_root: if True, a root entry will be created
72
 
            automatically.  The rich-root support of the branch's repository is
73
 
            taken into account when automatically creating a root.  Pass False
74
 
            if you want to add the root explicitly (and handle rich-root vs.
75
 
            not manually).
76
69
        """
77
70
        if branch is not None:
78
71
            if format is not None:
92
85
            self._branch = bzrdir.BzrDir.create_branch_convenience(
93
86
                transport.base, format=format, force_new_tree=False)
94
87
        self._tree = None
95
 
        self._automatic_root = automatic_root
96
88
 
97
89
    def build_commit(self, **commit_kwargs):
98
90
        """Build a commit on the branch.
206
198
            if parent_ids is not None:
207
199
                tree.set_parent_ids(parent_ids,
208
200
                    allow_leftmost_as_ghost=allow_leftmost_as_ghost)
209
 
            elif self._branch.last_revision() == _mod_revision.NULL_REVISION:
210
 
                if self._automatic_root:
211
 
                    # No parent revision, and automatic_root.  Create an
212
 
                    # appropriate root entry.
213
 
                    if self._branch.repository.supports_rich_root():
214
 
                        from bzrlib.generate_ids import gen_root_id
215
 
                        new_root_id = gen_root_id()
216
 
                    else:
217
 
                        from bzrlib.inventory import ROOT_ID
218
 
                        new_root_id = ROOT_ID
219
 
                    add_root_action = (
220
 
                        'add', ('', new_root_id, 'directory', None))
221
 
                    actions = [add_root_action] + list(actions)
222
 
 
223
201
            # Unfortunately, MemoryTree.add(directory) just creates an
224
202
            # inventory entry. And the only public function to create a
225
203
            # directory is MemoryTree.mkdir() which creates the directory, but