~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Martin Pool
  • Date: 2010-09-14 07:19:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5452.
  • Revision ID: mbp@sourcefrog.net-20100914071922-qdk3hi3p4h5meshu
Better test for break-lock; show lock URLs as they're broken

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
                format.get_format_description(),
166
166
                basedir)
167
167
 
 
168
    def clone(self, url, revision_id=None, force_new_repo=False,
 
169
              preserve_stacking=False):
 
170
        """Clone this bzrdir and its contents to url verbatim.
 
171
 
 
172
        :param url: The url create the clone at.  If url's last component does
 
173
            not exist, it will be created.
 
174
        :param revision_id: The tip revision-id to use for any branch or
 
175
            working tree.  If not None, then the clone operation may tune
 
176
            itself to download less data.
 
177
        :param force_new_repo: Do not use a shared repository for the target
 
178
                               even if one is available.
 
179
        :param preserve_stacking: When cloning a stacked branch, stack the
 
180
            new branch on top of the other branch's stacked-on branch.
 
181
        """
 
182
        return self.clone_on_transport(get_transport(url),
 
183
                                       revision_id=revision_id,
 
184
                                       force_new_repo=force_new_repo,
 
185
                                       preserve_stacking=preserve_stacking)
 
186
 
168
187
    def clone_on_transport(self, transport, revision_id=None,
169
188
        force_new_repo=False, preserve_stacking=False, stacked_on=None,
170
189
        create_prefix=False, use_existing_dir=True):
1700
1719
    def register_format(klass, format):
1701
1720
        BzrProber.register_bzrdir_format(format)
1702
1721
        # bzr native formats have a network name of their format string.
1703
 
        controldir.network_format_registry.register(format.get_format_string(), format.__class__)
 
1722
        network_format_registry.register(format.get_format_string(), format.__class__)
1704
1723
        controldir.ControlDirFormat.register_format(format)
1705
1724
 
1706
1725
    def _supply_sub_formats_to(self, other_format):
1719
1738
    def unregister_format(klass, format):
1720
1739
        BzrProber.unregister_bzrdir_format(format)
1721
1740
        controldir.ControlDirFormat.unregister_format(format)
1722
 
        controldir.network_format_registry.remove(format.get_format_string())
 
1741
        network_format_registry.remove(format.get_format_string())
1723
1742
 
1724
1743
 
1725
1744
class BzrDirFormat4(BzrDirFormat):
2128
2147
                                  __set_workingtree_format)
2129
2148
 
2130
2149
 
 
2150
network_format_registry = registry.FormatRegistry()
 
2151
"""Registry of formats indexed by their network name.
 
2152
 
 
2153
The network name for a BzrDirFormat is an identifier that can be used when
 
2154
referring to formats with smart server operations. See
 
2155
BzrDirFormat.network_name() for more detail.
 
2156
"""
 
2157
 
 
2158
 
2131
2159
# Register bzr formats
2132
2160
BzrDirFormat.register_format(BzrDirFormat4())
2133
2161
BzrDirFormat.register_format(BzrDirFormat5())
2691
2719
 
2692
2720
    def get_format_description(self):
2693
2721
        if self._network_name:
2694
 
            real_format = controldir.network_format_registry.get(self._network_name)
 
2722
            real_format = network_format_registry.get(self._network_name)
2695
2723
            return 'Remote: ' + real_format.get_format_description()
2696
2724
        return 'bzr remote bzrdir'
2697
2725