~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Robert Collins
  • Date: 2005-08-25 01:13:32 UTC
  • mto: (974.1.50) (1185.1.10) (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1139.
  • Revision ID: robertc@robertcollins.net-20050825011331-6d549d5de7edcec1
two bugfixes to smart_add - do not add paths from nested trees to the parent tree, and do not mutate the user supplied file list

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
from trace import mutter, note
 
18
from bzrlib.errors import NotBranchError
 
19
from bzrlib.branch import Branch
18
20
 
19
21
def glob_expand_for_win32(file_list):
20
22
    import glob
51
53
        file_list = ['.']
52
54
    
53
55
    user_list = file_list[:]
 
56
    file_list = list(file_list)
54
57
    assert not isinstance(file_list, basestring)
55
 
    b = bzrlib.branch.Branch(file_list[0], find_root=True)
 
58
    b = Branch(file_list[0], find_root=True)
56
59
    inv = b.read_working_inventory()
57
60
    tree = b.working_tree()
58
61
    count = 0
77
80
            
78
81
        versioned = (inv.path2id(rf) != None)
79
82
 
 
83
        if kind == 'directory':
 
84
            try:
 
85
                sub_branch = Branch(af, find_root=False)
 
86
                sub_tree = True
 
87
            except NotBranchError:
 
88
                sub_tree = False
 
89
        else:
 
90
            sub_tree = False
 
91
 
80
92
        if rf == '':
81
93
            mutter("branch root doesn't need to be added")
 
94
            sub_tree = False
82
95
        elif versioned:
83
96
            mutter("%r is already versioned" % f)
 
97
        elif sub_tree:
 
98
            mutter("%r is a bzr tree" %f)
84
99
        else:
85
100
            file_id = bzrlib.branch.gen_file_id(rf)
86
101
            inv.add_path(rf, kind=kind, file_id=file_id)
89
104
 
90
105
            print 'added', quotefn(f)
91
106
 
92
 
        if kind == 'directory' and recurse:
 
107
        if kind == 'directory' and recurse and not sub_tree:
93
108
            for subf in os.listdir(af):
94
109
                subp = os.path.join(rf, subf)
95
110
                if subf == bzrlib.BZRDIR: