~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-30 17:25:27 UTC
  • mto: (1711.4.39 win32-accepted)
  • mto: This revision was merged to the branch mainline in revision 1836.
  • Revision ID: john@arbash-meinel.com-20060630172527-6d36c06a13dc7110
always close files, minor PEP8 cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
            self.base_path = base_path
118
118
        self.raw_path = path
119
119
 
120
 
    def __cmp__(self, other):
121
 
        return cmp(self.raw_path, other.raw_path)
122
 
 
123
 
    def __hash__(self):
124
 
        return hash(self.raw_path)
125
 
 
126
120
 
127
121
def smart_add_tree(tree, file_list, recurse=True, action=None, save=True):
128
122
    """Add files to version, optionally recursing into directories.
166
160
        kind = bzrlib.osutils.file_kind(abspath)
167
161
        if kind == 'directory':
168
162
            # schedule the dir for scanning
169
 
            user_dirs.add(rf)
 
163
            user_dirs.add(rf.raw_path)
170
164
        else:
171
165
            if not InventoryEntry.versionable_kind(kind):
172
166
                raise errors.BadFileKindError(filename=abspath, kind=kind)
188
182
    # only walk the minimal parents needed: we have user_dirs to override
189
183
    # ignores.
190
184
    prev_dir = None
191
 
 
192
 
    is_inside = bzrlib.osutils.is_inside_or_parent_of_any
193
185
    for path in sorted(user_dirs):
194
 
        if (prev_dir is None or not is_inside([prev_dir], path.raw_path)):
195
 
            dirs_to_add.append((path, None))
196
 
        prev_dir = path.raw_path
 
186
        if (prev_dir is None or not
 
187
            bzrlib.osutils.is_inside_or_parent_of_any([prev_dir], path)):
 
188
            dirs_to_add.append((rf, None))
 
189
        prev_dir = path
197
190
 
198
191
    # this will eventually be *just* directories, right now it starts off with 
199
192
    # just directories.
273
266
                    ignore_glob = tree.is_ignored(subp)
274
267
                    if ignore_glob is not None:
275
268
                        # mutter("skip ignored sub-file %r", subp)
276
 
                        ignored.setdefault(ignore_glob, []).append(subp)
 
269
                        if ignore_glob not in ignored:
 
270
                            ignored[ignore_glob] = []
 
271
                        ignored[ignore_glob].append(subp)
277
272
                    else:
278
273
                        #mutter("queue to add sub-file %r", subp)
279
274
                        dirs_to_add.append((FastPath(subp, subf), this_ie))