~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

remove all trailing whitespace from bzr source

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
    @needs_tree_write_lock
165
165
    def add_reference(self, sub_tree):
166
166
        # use standard implementation, which calls back to self._add
167
 
        # 
 
167
        #
168
168
        # So we don't store the reference_revision in the working dirstate,
169
 
        # it's just recorded at the moment of commit. 
 
169
        # it's just recorded at the moment of commit.
170
170
        self._add_reference(sub_tree)
171
171
 
172
172
    def break_lock(self):
285
285
 
286
286
    def _generate_inventory(self):
287
287
        """Create and set self.inventory from the dirstate object.
288
 
        
 
288
 
289
289
        This is relatively expensive: we have to walk the entire dirstate.
290
290
        Ideally we would not, and can deprecate this function.
291
291
        """
361
361
        If either file_id or path is supplied, it is used as the key to lookup.
362
362
        If both are supplied, the fastest lookup is used, and an error is
363
363
        raised if they do not both point at the same row.
364
 
        
 
364
 
365
365
        :param file_id: An optional unicode file_id to be looked up.
366
366
        :param path: An optional unicode path to be looked up.
367
367
        :return: The dirstate row tuple for path/file_id, or (None, None)
423
423
    @needs_read_lock
424
424
    def get_parent_ids(self):
425
425
        """See Tree.get_parent_ids.
426
 
        
 
426
 
427
427
        This implementation requests the ids list from the dirstate file.
428
428
        """
429
429
        return self.current_dirstate().get_parent_ids()
951
951
                raise errors.PathsNotVersionedError(paths)
952
952
        # -- remove redundancy in supplied paths to prevent over-scanning --
953
953
        search_paths = osutils.minimum_path_selection(paths)
954
 
        # sketch: 
 
954
        # sketch:
955
955
        # for all search_indexs in each path at or under each element of
956
956
        # search_paths, if the detail is relocated: add the id, and add the
957
957
        # relocated path as one to search if its not searched already. If the
1013
1013
 
1014
1014
    def read_working_inventory(self):
1015
1015
        """Read the working inventory.
1016
 
        
 
1016
 
1017
1017
        This is a meaningless operation for dirstate, but we obey it anyhow.
1018
1018
        """
1019
1019
        return self.inventory
1050
1050
    @needs_tree_write_lock
1051
1051
    def set_parent_ids(self, revision_ids, allow_leftmost_as_ghost=False):
1052
1052
        """Set the parent ids to revision_ids.
1053
 
        
 
1053
 
1054
1054
        See also set_parent_trees. This api will try to retrieve the tree data
1055
1055
        for each element of revision_ids from the trees repository. If you have
1056
1056
        tree data already available, it is more efficient to use
1287
1287
    This differs from WorkingTree3 by:
1288
1288
     - Having a consolidated internal dirstate, stored in a
1289
1289
       randomly-accessible sorted file on disk.
1290
 
     - Not having a regular inventory attribute.  One can be synthesized 
 
1290
     - Not having a regular inventory attribute.  One can be synthesized
1291
1291
       on demand but this is expensive and should be avoided.
1292
1292
 
1293
1293
    This is new in bzr 0.15.
1396
1396
 
1397
1397
    def _init_custom_control_files(self, wt):
1398
1398
        """Subclasses with custom control files should override this method.
1399
 
        
 
1399
 
1400
1400
        The working tree and control files are locked for writing when this
1401
1401
        method is called.
1402
 
        
 
1402
 
1403
1403
        :param wt: the WorkingTree object
1404
1404
        """
1405
1405
 
1551
1551
        If either file_id or path is supplied, it is used as the key to lookup.
1552
1552
        If both are supplied, the fastest lookup is used, and an error is
1553
1553
        raised if they do not both point at the same row.
1554
 
        
 
1554
 
1555
1555
        :param file_id: An optional unicode file_id to be looked up.
1556
1556
        :param path: An optional unicode path to be looked up.
1557
1557
        :return: The dirstate row tuple for path/file_id, or (None, None)
1803
1803
 
1804
1804
    def walkdirs(self, prefix=""):
1805
1805
        # TODO: jam 20070215 This is the lazy way by using the RevisionTree
1806
 
        # implementation based on an inventory.  
 
1806
        # implementation based on an inventory.
1807
1807
        # This should be cleaned up to use the much faster Dirstate code
1808
1808
        # So for now, we just build up the parent inventory, and extract
1809
1809
        # it the same way RevisionTree does.
1838
1838
 
1839
1839
class InterDirStateTree(InterTree):
1840
1840
    """Fast path optimiser for changes_from with dirstate trees.
1841
 
    
1842
 
    This is used only when both trees are in the dirstate working file, and 
1843
 
    the source is any parent within the dirstate, and the destination is 
 
1841
 
 
1842
    This is used only when both trees are in the dirstate working file, and
 
1843
    the source is any parent within the dirstate, and the destination is
1844
1844
    the current working tree of the same dirstate.
1845
1845
    """
1846
1846
    # this could be generalized to allow comparisons between any trees in the
1999
1999
        # the source revid must be in the target dirstate
2000
2000
        if not (source._revision_id == NULL_REVISION or
2001
2001
            source._revision_id in target.get_parent_ids()):
2002
 
            # TODO: what about ghosts? it may well need to 
 
2002
            # TODO: what about ghosts? it may well need to
2003
2003
            # check for them explicitly.
2004
2004
            return False
2005
2005
        return True
2015
2015
 
2016
2016
    def convert(self, tree):
2017
2017
        # lock the control files not the tree, so that we dont get tree
2018
 
        # on-unlock behaviours, and so that noone else diddles with the 
 
2018
        # on-unlock behaviours, and so that noone else diddles with the
2019
2019
        # tree during upgrade.
2020
2020
        tree._control_files.lock_write()
2021
2021
        try:
2060
2060
 
2061
2061
    def convert(self, tree):
2062
2062
        # lock the control files not the tree, so that we don't get tree
2063
 
        # on-unlock behaviours, and so that no-one else diddles with the 
 
2063
        # on-unlock behaviours, and so that no-one else diddles with the
2064
2064
        # tree during upgrade.
2065
2065
        tree._control_files.lock_write()
2066
2066
        try: