/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/controldir.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
        this in the future - for instance to make bzr talk with svn working
153
153
        trees.
154
154
        """
155
 
        raise NotImplementedError(self.is_control_filename)
 
155
        return self._format.is_control_filename(filename)
156
156
 
157
157
    def needs_format_conversion(self, format=None):
158
158
        """Return true if this controldir needs convert_format run on it.
1246
1246
        """
1247
1247
        raise NotImplementedError(self.supports_transport)
1248
1248
 
 
1249
    @classmethod
 
1250
    def is_control_filename(klass, filename):
 
1251
        """True if filename is the name of a path which is reserved for
 
1252
        controldirs.
 
1253
 
 
1254
        :param filename: A filename within the root transport of this
 
1255
            controldir.
 
1256
 
 
1257
        This is true IF and ONLY IF the filename is part of the namespace reserved
 
1258
        for bzr control dirs. Currently this is the '.bzr' directory in the root
 
1259
        of the root_transport. it is expected that plugins will need to extend
 
1260
        this in the future - for instance to make bzr talk with svn working
 
1261
        trees.
 
1262
        """
 
1263
        raise NotImplementedError(self.is_control_filename)
 
1264
 
1249
1265
 
1250
1266
class Prober(object):
1251
1267
    """Abstract class that can be used to detect a particular kind of
1461
1477
 
1462
1478
def is_control_filename(filename):
1463
1479
    """Check if filename is used for control directories."""
1464
 
    # TODO(jelmer): Allow registration by other VCSes
1465
 
    return filename == '.bzr'
 
1480
    # TODO(jelmer): Instead, have a function that returns all control
 
1481
    # filenames.
 
1482
    for key, format in format_registry.items():
 
1483
        if format().is_control_filename(filename):
 
1484
            return True
 
1485
    else:
 
1486
        return False
1466
1487
 
1467
1488
 
1468
1489
class RepositoryAcquisitionPolicy(object):