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

  • Committer: Vincent Ladeuil
  • Date: 2007-11-04 15:29:17 UTC
  • mfrom: (2961 +trunk)
  • mto: (2961.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 2962.
  • Revision ID: v.ladeuil+lp@free.fr-20071104152917-nrsumxpk3dikso2c
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
337
337
        self._lock_token = None
338
338
        self._lock_state = None
339
339
        self._id_index = None
 
340
        # a map from packed_stat to sha's.
 
341
        self._packed_stat_index = None
340
342
        self._end_of_header = None
341
343
        self._cutoff_time = None
342
344
        self._split_path_cache = {}
1641
1643
        assert num_entries_line.startswith('num_entries: '), 'missing num_entries line'
1642
1644
        self._num_entries = int(num_entries_line[len('num_entries: '):-1])
1643
1645
 
 
1646
    def sha1_from_stat(self, path, stat_result, _pack_stat=pack_stat):
 
1647
        """Find a sha1 given a stat lookup."""
 
1648
        return self._get_packed_stat_index().get(_pack_stat(stat_result), None)
 
1649
 
 
1650
    def _get_packed_stat_index(self):
 
1651
        """Get a packed_stat index of self._dirblocks."""
 
1652
        if self._packed_stat_index is None:
 
1653
            index = {}
 
1654
            for key, tree_details in self._iter_entries():
 
1655
                if tree_details[0][0] == 'f':
 
1656
                    index[tree_details[0][4]] = tree_details[0][1]
 
1657
            self._packed_stat_index = index
 
1658
        return self._packed_stat_index
 
1659
 
1644
1660
    def save(self):
1645
1661
        """Save any pending changes created during this session.
1646
1662
 
1702
1718
        self._dirblock_state = DirState.IN_MEMORY_MODIFIED
1703
1719
        self._parents = list(parent_ids)
1704
1720
        self._id_index = None
 
1721
        self._packed_stat_index = None
1705
1722
 
1706
1723
    def set_path_id(self, path, new_id):
1707
1724
        """Change the id of path to new_id in the current working tree.
1987
2004
                current_old = advance(old_iterator)
1988
2005
        self._dirblock_state = DirState.IN_MEMORY_MODIFIED
1989
2006
        self._id_index = None
 
2007
        self._packed_stat_index = None
1990
2008
 
1991
2009
    def _make_absent(self, current_old):
1992
2010
        """Mark current_old - an entry - as absent for tree 0.
2019
2037
            if self._id_index is not None:
2020
2038
                self._id_index[current_old[0][2]].remove(current_old[0])
2021
2039
        # update all remaining keys for this id to record it as absent. The
2022
 
        # existing details may either be the record we are making as deleted
 
2040
        # existing details may either be the record we are marking as deleted
2023
2041
        # (if there were other trees with the id present at this path), or may
2024
2042
        # be relocations.
2025
2043
        for update_key in all_remaining_keys:
2295
2313
        self._ghosts = []
2296
2314
        self._dirblocks = []
2297
2315
        self._id_index = None
 
2316
        self._packed_stat_index = None
2298
2317
        self._end_of_header = None
2299
2318
        self._cutoff_time = None
2300
2319
        self._split_path_cache = {}