~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-11-28 23:08:40 UTC
  • mfrom: (3034.4.9 aaron)
  • Revision ID: pqm@pqm.ubuntu.com-20071128230840-b2ra2nso0qtqxon6
TreeTransform handles case-insensitive filesystems well

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]