~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-13 16:23:07 UTC
  • mto: (4634.119.7 2.0)
  • mto: This revision was merged to the branch mainline in revision 4959.
  • Revision ID: john@arbash-meinel.com-20100113162307-0bs82td16gzih827
Update the MANIFEST.in file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib.lazy_import import lazy_import
24
24
lazy_import(globals(), """
25
25
import os
 
26
import re
26
27
 
27
28
from bzrlib import (
28
29
    add,
226
227
            revprops=revprops,
227
228
            possible_master_transports=possible_master_transports,
228
229
            *args, **kwargs)
 
230
        post_hook_params = PostCommitHookParams(self)
 
231
        for hook in MutableTree.hooks['post_commit']:
 
232
            hook(post_hook_params)
229
233
        return committed_id
230
234
 
231
235
    def _gather_kinds(self, files, kinds):
424
428
                dirs_to_add.append((path, None))
425
429
            prev_dir = path.raw_path
426
430
 
 
431
        illegalpath_re = re.compile(r'[\r\n]')
427
432
        # dirs_to_add is initialised to a list of directories, but as we scan
428
433
        # directories we append files to it.
429
434
        # XXX: We should determine kind of files when we scan them rather than
440
445
            if not InventoryEntry.versionable_kind(kind):
441
446
                warning("skipping %s (can't add file of kind '%s')", abspath, kind)
442
447
                continue
 
448
            if illegalpath_re.search(directory.raw_path):
 
449
                warning("skipping %r (contains \\n or \\r)" % abspath)
 
450
                continue
443
451
 
444
452
            if parent_ie is not None:
445
453
                versioned = directory.base_path in parent_ie.children
581
589
        self.create_hook(hooks.HookPoint('start_commit',
582
590
            "Called before a commit is performed on a tree. The start commit "
583
591
            "hook is able to change the tree before the commit takes place. "
584
 
            "start_commit is called with the bzrlib.tree.MutableTree that the "
585
 
            "commit is being performed on.", (1, 4), None))
 
592
            "start_commit is called with the bzrlib.mutabletree.MutableTree "
 
593
            "that the commit is being performed on.", (1, 4), None))
 
594
        self.create_hook(hooks.HookPoint('post_commit',
 
595
            "Called after a commit is performed on a tree. The hook is "
 
596
            "called with a bzrlib.mutabletree.PostCommitHookParams object. "
 
597
            "The mutable tree the commit was performed on is available via "
 
598
            "the mutable_tree attribute of that object.", (2, 0), None))
586
599
 
587
600
 
588
601
# install the default hooks into the MutableTree class.
589
602
MutableTree.hooks = MutableTreeHooks()
590
603
 
591
604
 
 
605
class PostCommitHookParams(object):
 
606
    """Parameters for the post_commit hook.
 
607
 
 
608
    To access the parameters, use the following attributes:
 
609
 
 
610
    * mutable_tree - the MutableTree object
 
611
    """
 
612
 
 
613
    def __init__(self, mutable_tree):
 
614
        """Create the parameters for the post_commit hook."""
 
615
        self.mutable_tree = mutable_tree
 
616
 
 
617
 
592
618
class _FastPath(object):
593
619
    """A path object with fast accessors for things like basename."""
594
620