~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-10 16:11:31 UTC
  • mto: (5712.4.8 bzrdir-weave)
  • mto: This revision was merged to the branch mainline in revision 5716.
  • Revision ID: jelmer@samba.org-20110310161131-pi4vny9un1iamo8h
Remove unused register format functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
    xml5,
60
60
    )
61
61
from bzrlib.repofmt import pack_repo
62
 
from bzrlib.smart.client import _SmartClient
63
62
from bzrlib.store.versioned import VersionedFileStore
64
63
from bzrlib.transactions import WriteTransaction
65
64
from bzrlib.transport import (
1499
1498
        except KeyError:
1500
1499
            raise errors.UnknownFormatError(format=format_string, kind='bzrdir')
1501
1500
 
1502
 
    def known_formats(self):
 
1501
    @classmethod
 
1502
    def known_formats(cls):
1503
1503
        result = set()
1504
 
        for name, format in self.formats.iteritems():
 
1504
        for name, format in cls.formats.iteritems():
1505
1505
            result.add(format)
1506
1506
        return result
1507
1507
 
1537
1537
            from bzrlib.remote import RemoteBzrDirFormat
1538
1538
            return RemoteBzrDirFormat()
1539
1539
 
1540
 
    def known_formats(self):
 
1540
    @classmethod
 
1541
    def known_formats(cls):
1541
1542
        from bzrlib.remote import RemoteBzrDirFormat
1542
1543
        return set([RemoteBzrDirFormat()])
1543
1544
 
1559
1560
    # _lock_class must be set in subclasses to the lock type, typ.
1560
1561
    # TransportLock or LockDir
1561
1562
 
1562
 
    def get_format_string(self):
 
1563
    @classmethod
 
1564
    def get_format_string(cls):
1563
1565
        """Return the ASCII format string that identifies this format."""
1564
1566
        raise NotImplementedError(self.get_format_string)
1565
1567
 
1621
1623
            except errors.NoSmartMedium:
1622
1624
                pass
1623
1625
            else:
 
1626
                from bzrlib.remote import RemoteBzrDirFormat
1624
1627
                # TODO: lookup the local format from a server hint.
1625
1628
                remote_dir_format = RemoteBzrDirFormat()
1626
1629
                remote_dir_format._network_name = self.network_name()
1741
1744
        """
1742
1745
        raise NotImplementedError(self._open)
1743
1746
 
1744
 
    @classmethod
1745
 
    def register_format(klass, format):
1746
 
        """Register a new BzrDir format.
1747
 
        """
1748
 
        BzrProber.formats.register(format.get_format_string(), format)
1749
 
 
1750
1747
    def _supply_sub_formats_to(self, other_format):
1751
1748
        """Give other_format the same values for sub formats as this has.
1752
1749
 
1759
1756
        :return: None.
1760
1757
        """
1761
1758
 
1762
 
    @classmethod
1763
 
    def unregister_format(klass, format):
1764
 
        BzrProber.formats.remove(format.get_format_string())
1765
 
 
1766
1759
 
1767
1760
class BzrDirFormat4(BzrDirFormat):
1768
1761
    """Bzr dir format 4.
1781
1774
 
1782
1775
    fixed_components = True
1783
1776
 
1784
 
    def get_format_string(self):
 
1777
    @classmethod
 
1778
    def get_format_string(cls):
1785
1779
        """See BzrDirFormat.get_format_string()."""
1786
1780
        return "Bazaar-NG branch, format 0.0.4\n"
1787
1781
 
1861
1855
 
1862
1856
    _lock_class = lockable_files.TransportLock
1863
1857
 
1864
 
    def get_format_string(self):
 
1858
    @classmethod
 
1859
    def get_format_string(cls):
1865
1860
        """See BzrDirFormat.get_format_string()."""
1866
1861
        return "Bazaar-NG branch, format 5\n"
1867
1862
 
1922
1917
 
1923
1918
    _lock_class = lockable_files.TransportLock
1924
1919
 
1925
 
    def get_format_string(self):
 
1920
    @classmethod
 
1921
    def get_format_string(cls):
1926
1922
        """See BzrDirFormat.get_format_string()."""
1927
1923
        return "Bazaar-NG branch, format 6\n"
1928
1924
 
2114
2110
            raise NotImplementedError(self.get_converter)
2115
2111
        return ConvertMetaToMeta(format)
2116
2112
 
2117
 
    def get_format_string(self):
 
2113
    @classmethod
 
2114
    def get_format_string(cls):
2118
2115
        """See BzrDirFormat.get_format_string()."""
2119
2116
        return "Bazaar-NG meta directory, format 1\n"
2120
2117
 
2182
2179
 
2183
2180
 
2184
2181
# Register bzr formats
2185
 
BzrDirFormat.register_format(BzrDirFormat4())
2186
 
BzrDirFormat.register_format(BzrDirFormat5())
2187
 
BzrDirFormat.register_format(BzrDirFormat6())
 
2182
BzrProber.formats.register(BzrDirFormat4.get_format_string(), BzrDirFormat4())
 
2183
BzrProber.formats.register(BzrDirFormat5.get_format_string(), BzrDirFormat5())
 
2184
BzrProber.formats.register(BzrDirFormat6.get_format_string(), BzrDirFormat6())
2188
2185
__default_format = BzrDirMetaFormat1()
2189
 
BzrDirFormat.register_format(__default_format)
 
2186
BzrProber.formats.register(__default_format.get_format_string(), __default_format)
2190
2187
controldir.ControlDirFormat._default_format = __default_format
2191
2188
 
2192
2189