/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 bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2006-02-16 02:53:00 UTC
  • mto: (1534.1.24 integration)
  • mto: This revision was merged to the branch mainline in revision 1554.
  • Revision ID: robertc@robertcollins.net-20060216025300-dfb5d2536908f060
Move is_control_file into WorkingTree.is_control_filename and test.
Remove the bzrlib.BZRDIR constant as no longer needed. Deliberately
not deprecating is as it should not ever have been public.

Show diffs side-by-side

added added

removed removed

Lines of Context:
276
276
        self._inventory = inv
277
277
        self.path2id = self._inventory.path2id
278
278
 
 
279
    def is_control_filename(self, filename):
 
280
        """True if filename is the name of a control file in this tree."""
 
281
        try:
 
282
            self.bzrdir.transport.relpath(self.abspath(filename))
 
283
            return True
 
284
        except errors.PathNotChild:
 
285
            return False
 
286
 
279
287
    @staticmethod
280
288
    def open(path=None, _unsupported=False):
281
289
        """Open an existing working tree at path.
516
524
 
517
525
        inv = self.read_working_inventory()
518
526
        for f,file_id in zip(files, ids):
519
 
            if is_control_file(f):
 
527
            if self.is_control_filename(f):
520
528
                raise BzrError("cannot add control file %s" % quotefn(f))
521
529
 
522
530
            fp = splitpath(f)
611
619
                ## TODO: If we find a subdirectory with its own .bzr
612
620
                ## directory, then that is a separate tree and we
613
621
                ## should exclude it.
614
 
                if bzrlib.BZRDIR == f:
 
622
 
 
623
                # the bzrdir for this tree
 
624
                if self.bzrdir.transport.base.endswith(f + '/'):
615
625
                    continue
616
626
 
617
627
                # path within tree
1207
1217
        if path.endswith(suffix):
1208
1218
            return path[:-len(suffix)]
1209
1219
 
 
1220
@deprecated_function(zero_eight)
1210
1221
def is_control_file(filename):
 
1222
    """See WorkingTree.is_control_filename(filename)."""
1211
1223
    ## FIXME: better check
1212
1224
    filename = normpath(filename)
1213
1225
    while filename != '':
1214
1226
        head, tail = os.path.split(filename)
1215
1227
        ## mutter('check %r for control file' % ((head, tail),))
1216
 
        if tail == bzrlib.BZRDIR:
 
1228
        if tail == '.bzr':
1217
1229
            return True
1218
1230
        if filename == head:
1219
1231
            break