~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Aaron Bentley
  • Date: 2006-10-20 05:28:45 UTC
  • mto: This revision was merged to the branch mainline in revision 2098.
  • Revision ID: aaron.bentley@utoronto.ca-20061020052845-6726ae2723e5633d
Traverse non-terminal symlinks for mv et al

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
 
76
76
    :param file_list: Filenames to convert.  
77
77
 
78
 
    :param default_branch: Fallback tree path to use if file_list is empty or None.
 
78
    :param default_branch: Fallback tree path to use if file_list is empty or
 
79
        None.
79
80
 
80
81
    :return: workingtree, [relative_paths]
81
82
    """
 
83
    def realpath(path):
 
84
        return osutils.pathjoin(osutils.realpath(osutils.dirname(path)),
 
85
                                osutils.basename(path))
 
86
        
82
87
    if file_list is None or len(file_list) == 0:
83
88
        return WorkingTree.open_containing(default_branch)[0], file_list
84
 
    tree = WorkingTree.open_containing(file_list[0])[0]
 
89
    tree = WorkingTree.open_containing(realpath(file_list[0]))[0]
85
90
    new_list = []
86
91
    for filename in file_list:
87
92
        try:
88
 
            new_list.append(tree.relpath(filename))
 
93
            new_list.append(tree.relpath(realpath(filename)))
89
94
        except errors.PathNotChild:
90
95
            raise errors.FileInWrongBranch(tree.branch, filename)
91
96
    return tree, new_list