~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

Clean up the _update_basis_apply_changes code
ensure that the code path is getting hit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1545
1545
                new_ids.add(file_id)
1546
1546
            elif new_path is None:
1547
1547
                deletes.append((old_path_utf8, None, file_id, None, True))
1548
 
            elif (old_path, new_path) == root_only:
1549
 
                # changes to just the root should not require remove/insertion
1550
 
                # of everything.
 
1548
            elif old_path == new_path:
 
1549
                # change things in-place
1551
1550
                changes.append((old_path_utf8, new_path_utf8, file_id,
1552
1551
                                inv_to_entry(inv_entry)))
1553
1552
            else:
1554
 
                # TODO: if old_path == new_path, I think we can get away with
1555
 
                #       treating this entry as a simple 'changes' entry, rather
1556
 
                #       than a delete + add. JAM 2011-05-18
1557
1553
                # Renames:
1558
1554
                # Because renames must preserve their children we must have
1559
1555
                # processed all relocations and removes before hand. The sort
1773
1769
        absent = 'ar'
1774
1770
        for old_path, new_path, file_id, new_details in changes:
1775
1771
            # the entry for this file_id must be in tree 0.
1776
 
            entry = self._get_entry(0, file_id, new_path)
1777
 
            if entry[0] is None or entry[0][2] != file_id:
1778
 
                self._raise_invalid(new_path, file_id,
1779
 
                    'working tree does not contain new entry')
1780
 
            if (entry[1][0][0] in absent or
1781
 
                entry[1][1][0] in absent):
1782
 
                self._raise_invalid(new_path, file_id,
1783
 
                    'changed considered absent')
 
1772
            entry = self._get_entry(1, file_id, new_path)
 
1773
            if entry[0] is None or entry[1][1][0] in 'ar':
 
1774
                self._raise_invalid(new_path, file_id,
 
1775
                    'changed entry considered not present')
1784
1776
            entry[1][1] = new_details
1785
1777
 
1786
1778
    def _update_basis_apply_deletes(self, deletes, rename_targets):