~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

  • Committer: Robert Collins
  • Date: 2007-07-03 02:38:36 UTC
  • mto: This revision was merged to the branch mainline in revision 2581.
  • Revision ID: robertc@robertcollins.net-20070703023836-etkrpxm2rmbhqgaj
* ``bzrlib.add.FastPath`` is now private and moved to 
  ``bzrlib.mutabletree._FastPath``. (Robert Collins, Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
310
310
        # relative : its cheaper to make a tree relative path an abspath
311
311
        # than to convert an abspath to tree relative.
312
312
        for filepath in file_list:
313
 
            rf = FastPath(self.relpath(filepath))
 
313
            rf = _FastPath(self.relpath(filepath))
314
314
            # validate user parameters. Our recursive code avoids adding new files
315
315
            # that need such validation 
316
316
            if self.is_control_filename(rf.raw_path):
428
428
                        mutter("skip control directory %r", subp)
429
429
                    elif subf in this_ie.children:
430
430
                        # recurse into this already versioned subdir.
431
 
                        dirs_to_add.append((FastPath(subp, subf), this_ie))
 
431
                        dirs_to_add.append((_FastPath(subp, subf), this_ie))
432
432
                    else:
433
433
                        # user selection overrides ignoes
434
434
                        # ignore while selecting files - if we globbed in the
439
439
                            ignored.setdefault(ignore_glob, []).append(subp)
440
440
                        else:
441
441
                            #mutter("queue to add sub-file %r", subp)
442
 
                            dirs_to_add.append((FastPath(subp, subf), this_ie))
 
442
                            dirs_to_add.append((_FastPath(subp, subf), this_ie))
443
443
 
444
444
        if len(added) > 0 and save:
445
445
            self._write_inventory(inv)
446
446
        return added, ignored
447
447
 
448
448
 
449
 
class FastPath(object):
 
449
class _FastPath(object):
450
450
    """A path object with fast accessors for things like basename."""
451
451
 
452
452
    __slots__ = ['raw_path', 'base_path']
491
491
        # note that the dirname use leads to some extra str copying etc but as
492
492
        # there are a limited number of dirs we can be nested under, it should
493
493
        # generally find it very fast and not recurse after that.
494
 
        added = _add_one_and_parent(tree, inv, None, FastPath(dirname(path.raw_path)), 'directory', action)
 
494
        added = _add_one_and_parent(tree, inv, None,
 
495
            _FastPath(dirname(path.raw_path)), 'directory', action)
495
496
        parent_id = inv.path2id(dirname(path.raw_path))
496
497
        parent_ie = inv[parent_id]
497
498
    _add_one(tree, inv, parent_ie, path, kind, action)