~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-13 18:38:58 UTC
  • mfrom: (1863 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1869.
  • Revision ID: john@arbash-meinel.com-20060713183858-ebf4aa1f9ef8bb6e
[merge] bzr.dev 1863

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