/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/transform.py

  • Committer: Aaron Bentley
  • Date: 2008-01-16 13:09:30 UTC
  • mto: This revision was merged to the branch mainline in revision 3189.
  • Revision ID: aaron@aaronbentley.com-20080116130930-00ez0l2jcoptviyt
Add docstrings, rename TT.__doc

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
64
64
 
65
65
 
66
66
class TreeTransformBase(object):
 
67
    """The base class for TreeTransform and TreeTransformBase"""
67
68
 
68
69
    def __init__(self, tree, limbodir, pb=DummyProgress(),
69
70
                 case_sensitive=True):
 
71
        """Constructor.
 
72
 
 
73
        :param tree: The tree that will be transformed, but not necessarily
 
74
            the output tree.
 
75
        :param limbodir: A directory where new files can be stored until
 
76
            they are installed in their proper places
 
77
        :param pb: A ProgressBar indicating how much progress is being made
 
78
        :param case_sensitive: If True, the target of the transform is
 
79
            case sensitive, not just case preserving.
 
80
        """
70
81
        object.__init__(self)
71
82
        self._tree = tree
72
83
        self._limbodir = limbodir
111
122
        # The trans_id that will be used as the tree root
112
123
        self._new_root = self.trans_id_tree_file_id(tree.get_root_id())
113
124
        # Indictor of whether the transform has been applied
114
 
        self.__done = False
 
125
        self._done = False
115
126
        # A progress bar
116
127
        self._pb = pb
117
128
        # Whether the target is case sensitive
544
555
 
545
556
    def find_conflicts(self):
546
557
        """Find any violations of inventory or filesystem invariants"""
547
 
        if self.__done is True:
 
558
        if self._done is True:
548
559
            raise ReusingTransform()
549
560
        conflicts = []
550
561
        # ensure all children of all existent parents are known
1177
1188
        finally:
1178
1189
            child_pb.finished()
1179
1190
        self._tree.apply_inventory_delta(inventory_delta)
1180
 
        # XXX OW!
1181
 
        self._TreeTransformBase__done = True
 
1191
        self._done = True
1182
1192
        self.finalize()
1183
1193
        return _TransformResults(modified_paths, self.rename_count)
1184
1194
 
1303
1313
 
1304
1314
 
1305
1315
class TransformPreview(TreeTransformBase):
 
1316
    """A TreeTransform for generating preview trees.
 
1317
 
 
1318
    Unlike TreeTransform, this version works when the input tree is a
 
1319
    RevisionTree, rather than a WorkingTree.  As a result, it tends to ignore
 
1320
    unversioned files in the input tree.
 
1321
    """
1306
1322
 
1307
1323
    def __init__(self, tree, pb=DummyProgress(), case_sensitive=True):
1308
1324
        limbodir = tempfile.mkdtemp()
1338
1354
            childpath = joinpath(path, child)
1339
1355
            yield self.trans_id_tree_path(childpath)
1340
1356
 
 
1357
 
1341
1358
class _PreviewTree(object):
 
1359
    """Partial implementation of Tree to support show_diff_trees"""
1342
1360
 
1343
1361
    def __init__(self, transform):
1344
1362
        self._transform = transform
1386
1404
        return open(name, 'rb')
1387
1405
 
1388
1406
    def paths2ids(self, specific_files, trees=None, require_versioned=False):
 
1407
        """See Tree.paths2ids"""
1389
1408
        return 'not_empty'
1390
1409
 
1391
1410