~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/controldir.py

  • Committer: Patch Queue Manager
  • Date: 2011-10-09 13:52:06 UTC
  • mfrom: (6202.1.3 revno-revision)
  • Revision ID: pqm@pqm.ubuntu.com-20111009135206-t3utsln6mtzv9eut
(jelmer) Add a --revision argument to 'bzr revno'. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    revision as _mod_revision,
32
32
    transport as _mod_transport,
33
33
    ui,
 
34
    urlutils,
34
35
    )
35
36
from bzrlib.push import (
36
37
    PushResult,
74
75
        return self.user_transport.base
75
76
 
76
77
 
77
 
 
78
78
class ControlDir(ControlComponent):
79
79
    """A control directory.
80
80
 
145
145
        """Destroy the repository in this ControlDir."""
146
146
        raise NotImplementedError(self.destroy_repository)
147
147
 
148
 
    def create_branch(self, name=None, repository=None):
 
148
    def create_branch(self, name=None, repository=None,
 
149
                      append_revisions_only=None):
149
150
        """Create a branch in this ControlDir.
150
151
 
151
152
        :param name: Name of the colocated branch to create, None for
152
153
            the default branch.
 
154
        :param append_revisions_only: Whether this branch should only allow
 
155
            appending new revisions to its history.
153
156
 
154
157
        The controldirs format will control what branch format is created.
155
158
        For more control see BranchFormatXX.create(a_controldir).
193
196
        """
194
197
        raise NotImplementedError(self.destroy_workingtree_metadata)
195
198
 
 
199
    def find_branch_format(self, name=None):
 
200
        """Find the branch 'format' for this bzrdir.
 
201
 
 
202
        This might be a synthetic object for e.g. RemoteBranch and SVN.
 
203
        """
 
204
        raise NotImplementedError(self.find_branch_format)
 
205
 
196
206
    def get_branch_reference(self, name=None):
197
207
        """Return the referenced URL for the branch in this controldir.
198
208
 
266
276
        except errors.NotBranchError:
267
277
            return False
268
278
 
 
279
    def _get_selected_branch(self):
 
280
        """Return the name of the branch selected by the user.
 
281
 
 
282
        :return: Name of the branch selected by the user, or None.
 
283
        """
 
284
        branch = self.root_transport.get_segment_parameters().get("branch")
 
285
        if branch is not None:
 
286
            branch = urlutils.unescape(branch)
 
287
        return branch
 
288
 
269
289
    def has_workingtree(self):
270
290
        """Tell if this controldir contains a working tree.
271
291
 
661
681
    def is_supported(self):
662
682
        """Is this format supported?
663
683
 
664
 
        Supported formats must be initializable and openable.
 
684
        Supported formats must be openable.
665
685
        Unsupported formats may not support initialization or committing or
666
686
        some other features depending on the reason for not being supported.
667
687
        """
668
688
        return True
669
689
 
 
690
    def is_initializable(self):
 
691
        """Whether new control directories of this format can be initialized.
 
692
        """
 
693
        return self.is_supported()
 
694
 
670
695
    def check_support_status(self, allow_unsupported, recommend_upgrade=True,
671
696
        basedir=None):
672
697
        """Give an error or warning on old formats.