~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
798
798
            return conflicts
799
799
        for children in by_parent.itervalues():
800
800
            name_ids = [(self.final_name(t), t) for t in children]
 
801
            if not self._tree.case_sensitive:
 
802
                name_ids = [(n.lower(), t) for n, t in name_ids]
801
803
            name_ids.sort()
802
804
            last_name = None
803
805
            last_trans_id = None
924
926
                # the direct path can only be used if no other file has
925
927
                # already taken this pathname, i.e. if the name is unused, or
926
928
                # if it is already associated with this trans_id.
927
 
                elif (self._limbo_children_names[parent].get(filename)
928
 
                      in (trans_id, None)):
929
 
                    use_direct_path = True
 
929
                elif self._tree.case_sensitive:
 
930
                    if (self._limbo_children_names[parent].get(filename)
 
931
                        in (trans_id, None)):
 
932
                        use_direct_path = True
 
933
                else:
 
934
                    for l_filename, l_trans_id in\
 
935
                        self._limbo_children_names[parent].iteritems():
 
936
                        if l_trans_id == trans_id:
 
937
                            continue
 
938
                        if l_filename.lower() == filename.lower():
 
939
                            break
 
940
                    else:
 
941
                        use_direct_path = True
 
942
 
930
943
        if use_direct_path:
931
944
            limbo_name = pathjoin(self._limbo_files[parent], filename)
932
945
            self._limbo_children[parent].add(trans_id)
1787
1800
                               conflict[1], conflict[2], ))
1788
1801
        elif c_type == 'duplicate':
1789
1802
            # files that were renamed take precedence
1790
 
            new_name = tt.final_name(conflict[1])+'.moved'
1791
1803
            final_parent = tt.final_parent(conflict[1])
1792
1804
            if tt.path_changed(conflict[1]):
1793
 
                tt.adjust_path(new_name, final_parent, conflict[2])
1794
 
                new_conflicts.add((c_type, 'Moved existing file to', 
1795
 
                                   conflict[2], conflict[1]))
 
1805
                existing_file, new_file = conflict[2], conflict[1]
1796
1806
            else:
1797
 
                tt.adjust_path(new_name, final_parent, conflict[1])
1798
 
                new_conflicts.add((c_type, 'Moved existing file to', 
1799
 
                                  conflict[1], conflict[2]))
 
1807
                existing_file, new_file = conflict[1], conflict[2]
 
1808
            new_name = tt.final_name(existing_file)+'.moved'
 
1809
            tt.adjust_path(new_name, final_parent, existing_file)
 
1810
            new_conflicts.add((c_type, 'Moved existing file to', 
 
1811
                               existing_file, new_file))
1800
1812
        elif c_type == 'parent loop':
1801
1813
            # break the loop by undoing one of the ops that caused the loop
1802
1814
            cur = conflict[1]
1866
1878
 
1867
1879
    def rename(self, from_, to):
1868
1880
        """Rename a file from one path to another.  Functions like os.rename"""
1869
 
        os.rename(from_, to)
 
1881
        try:
 
1882
            os.rename(from_, to)
 
1883
        except OSError, e:
 
1884
            if e.errno in (errno.EEXIST, errno.ENOTEMPTY):
 
1885
                raise errors.FileExists(to, str(e))
 
1886
            raise
1870
1887
        self.past_renames.append((from_, to))
1871
1888
 
1872
1889
    def pre_delete(self, from_, to):