~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-07-12 15:20:38 UTC
  • mfrom: (1850.2.2 fix-add)
  • Revision ID: pqm@pqm.ubuntu.com-20060712152038-043e16bab49a5b50
(jam) smart-add should recurse all supplied directories (bug #52578)

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.