~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-04-27 22:07:03 UTC
  • mfrom: (4301.2.5 bzr.ab.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090427220703-oy9b0mxobrksvuyq
(gbache) Handle symlinks better in bzr add

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
 
81
81
def tree_files_for_add(file_list):
82
 
    """Add handles files a bit differently so it a custom implementation."""
 
82
    """
 
83
    Return a tree and list of absolute paths from a file list.
 
84
 
 
85
    Similar to tree_files, but add handles files a bit differently, so it a
 
86
    custom implementation.  In particular, MutableTreeTree.smart_add expects
 
87
    absolute paths, which it immediately converts to relative paths.
 
88
    """
 
89
    # FIXME Would be nice to just return the relative paths like
 
90
    # internal_tree_files does, but there are a large number of unit tests
 
91
    # that assume the current interface to mutabletree.smart_add
83
92
    if file_list:
84
 
        tree = WorkingTree.open_containing(file_list[0])[0]
 
93
        tree, relpath = WorkingTree.open_containing(file_list[0])
85
94
        if tree.supports_views():
86
95
            view_files = tree.views.lookup_view()
87
96
            if view_files:
88
97
                for filename in file_list:
89
98
                    if not osutils.is_inside_any(view_files, filename):
90
99
                        raise errors.FileOutsideView(filename, view_files)
 
100
        file_list = file_list[:]
 
101
        file_list[0] = tree.abspath(relpath)
91
102
    else:
92
103
        tree = WorkingTree.open_containing(u'.')[0]
93
104
        if tree.supports_views():