~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import time
23
23
 
24
24
from bzrlib import (
 
25
    config as _mod_config,
25
26
    errors,
26
27
    lazy_import,
27
28
    registry,
47
48
""")
48
49
from bzrlib.errors import (DuplicateKey, MalformedTransform,
49
50
                           ReusingTransform, CantMoveRoot,
50
 
                           ExistingLimbo, ImmortalLimbo, NoFinalPath,
 
51
                           ImmortalLimbo, NoFinalPath,
51
52
                           UnableCreateSymlink)
52
53
from bzrlib.filters import filtered_output_bytes, ContentFilterContext
53
54
from bzrlib.mutabletree import MutableTree
1405
1406
        delete_any(self._limbo_name(trans_id))
1406
1407
 
1407
1408
    def new_orphan(self, trans_id, parent_id):
1408
 
        # FIXME: There is no tree config, so we use the branch one (it's weird
1409
 
        # to define it this way as orphaning can only occur in a working tree,
1410
 
        # but that's all we have (for now). It will find the option in
1411
 
        # locations.conf or bazaar.conf though) -- vila 20100916
1412
 
        conf = self._tree.branch.get_config()
1413
 
        conf_var_name = 'bzr.transform.orphan_policy'
1414
 
        orphan_policy = conf.get_user_option(conf_var_name)
1415
 
        default_policy = orphaning_registry.default_key
1416
 
        if orphan_policy is None:
1417
 
            orphan_policy = default_policy
1418
 
        if orphan_policy not in orphaning_registry:
1419
 
            trace.warning('%s (from %s) is not a known policy, defaulting '
1420
 
                'to %s' % (orphan_policy, conf_var_name, default_policy))
1421
 
            orphan_policy = default_policy
1422
 
        handle_orphan = orphaning_registry.get(orphan_policy)
 
1409
        conf = self._tree.get_config_stack()
 
1410
        handle_orphan = conf.get('bzr.transform.orphan_policy')
1423
1411
        handle_orphan(self, trans_id, parent_id)
1424
1412
 
1425
1413
 
1488
1476
orphaning_registry._set_default_key('conflict')
1489
1477
 
1490
1478
 
 
1479
opt_transform_orphan = _mod_config.RegistryOption(
 
1480
    'bzr.transform.orphan_policy', orphaning_registry,
 
1481
    help='Policy for orphaned files during transform operations.',
 
1482
    invalid='warning')
 
1483
 
 
1484
 
1491
1485
class TreeTransform(DiskTreeTransform):
1492
1486
    """Represent a tree transformation.
1493
1487
 
2062
2056
        pass
2063
2057
 
2064
2058
    @property
 
2059
    @deprecated_method(deprecated_in((2, 5, 0)))
2065
2060
    def inventory(self):
2066
2061
        """This Tree does not use inventory as its backing data."""
2067
2062
        raise NotImplementedError(_PreviewTree.inventory)
2068
2063
 
 
2064
    @property
 
2065
    def root_inventory(self):
 
2066
        """This Tree does not use inventory as its backing data."""
 
2067
        raise NotImplementedError(_PreviewTree.root_inventory)
 
2068
 
2069
2069
    def get_root_id(self):
2070
2070
        return self._transform.final_file_id(self._transform.root)
2071
2071