/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Aaron Bentley
  • Date: 2005-12-13 18:56:57 UTC
  • mto: (1185.60.3 Aaron's mergeable stuff)
  • mto: This revision was merged to the branch mainline in revision 1530.
  • Revision ID: abentley@panoramicfeedback.com-20051213185657-3f900268287d6559
bzr add reports ignored patterns.

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
    file_list = _prepare_file_list(file_list)
101
101
    user_list = file_list[:]
102
102
    inv = tree.read_working_inventory()
103
 
    count = 0
 
103
    added = []
 
104
    ignored = {}
104
105
 
105
106
    for f in file_list:
106
107
        rf = tree.relpath(f)
141
142
        elif sub_tree:
142
143
            mutter("%r is a bzr tree", f)
143
144
        else:
144
 
            count += __add_one(tree, inv, rf, kind, action)
 
145
            added.extend(__add_one(tree, inv, rf, kind, action))
145
146
 
146
147
        if kind == 'directory' and recurse and not sub_tree:
147
148
            for subf in os.listdir(af):
148
149
                subp = os.path.join(rf, subf)
149
150
                if subf == bzrlib.BZRDIR:
150
151
                    mutter("skip control directory %r", subp)
151
 
                elif tree.is_ignored(subp):
152
 
                    mutter("skip ignored sub-file %r", subp)
153
152
                else:
154
 
                    mutter("queue to add sub-file %r", subp)
155
 
                    file_list.append(tree.abspath(subp))
156
 
 
157
 
 
158
 
    mutter('added %d entries', count)
 
153
                    ignore_glob = tree.is_ignored(subp)
 
154
                    if ignore_glob is not None:
 
155
                        mutter("skip ignored sub-file %r", subp)
 
156
                        if ignore_glob not in ignored:
 
157
                            ignored[ignore_glob] = []
 
158
                        ignored[ignore_glob].append(subp)
 
159
                    else:
 
160
                        mutter("queue to add sub-file %r", subp)
 
161
                        file_list.append(tree.abspath(subp))
 
162
 
 
163
 
 
164
    mutter('added %d entries', len(added))
159
165
    
160
 
    if count > 0:
 
166
    if len(added) > 0:
161
167
        tree._write_inventory(inv)
162
168
 
163
 
    return count
 
169
    return added, ignored
164
170
 
165
171
def __add_one(tree, inv, path, kind, action):
166
172
    """Add a file or directory, automatically add unversioned parents."""
169
175
    # This is safe from infinite recursion because the tree root is
170
176
    # always versioned.
171
177
    if inv.path2id(path) != None:
172
 
        return 0
 
178
        return []
173
179
 
174
180
    # add parent
175
 
    count = __add_one(tree, inv, dirname(path), 'directory', action)
 
181
    added = __add_one(tree, inv, dirname(path), 'directory', action)
176
182
    action(inv, path, kind)
177
183
 
178
 
    return count + 1
 
184
    return added + [path]