/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 tree.py

Fix some revision delta filtering.

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
            (mode, hexsha) = tree_lookup_path(self.store.__getitem__, self.tree,
134
134
                path)
135
135
        except KeyError:
136
 
            raise errors.NoSuchId(self, file_id)
 
136
            raise errors.NoSuchFile(self, path)
137
137
        if mode is None:
138
138
            # the tree root is a directory
139
139
            return "directory"
284
284
 
285
285
 
286
286
def tree_delta_from_git_changes(changes, mapping,
287
 
        (old_fileid_map, new_fileid_map), specific_file=None,
 
287
        (old_fileid_map, new_fileid_map), specific_files=None,
288
288
        require_versioned=False):
289
289
    """Create a TreeDelta from two git trees.
290
290
 
293
293
    """
294
294
    ret = delta.TreeDelta()
295
295
    for (oldpath, newpath), (oldmode, newmode), (oldsha, newsha) in changes:
 
296
        if not (specific_files is None or
 
297
                (oldpath is not None and osutils.is_inside_any(specific_files, oldpath)) or
 
298
                (newpath is not None and osutils.is_inside_any(specific_files, newpath))):
 
299
            continue
296
300
        if mapping.is_control_file(oldpath):
297
301
            oldpath = None
298
302
        if mapping.is_control_file(newpath):
320
324
    return ret
321
325
 
322
326
 
323
 
def changes_from_git_changes(changes, mapping, specific_file=None,
 
327
def changes_from_git_changes(changes, mapping, specific_files=None,
324
328
                                require_versioned=False):
325
329
    """Create a iter_changes-like generator from a git stream.
326
330
 
328
332
        (filename, sha, mode)
329
333
    """
330
334
    for (oldpath, newpath), (oldmode, newmode), (oldsha, newsha) in changes:
 
335
        if not (specific_files is None or
 
336
                (oldpath is not None and osutils.is_inside_any(specific_files, oldpath)) or
 
337
                (newpath is not None and osutils.is_inside_any(specific_files, newpath))):
 
338
            continue
331
339
        path = (oldpath, newpath)
332
340
        if mapping.is_special_file(oldpath) or mapping.is_special_file(newpath):
333
341
            continue
399
407
        target_fileid_map = self.target._fileid_map
400
408
        return tree_delta_from_git_changes(changes, self.target.mapping,
401
409
            (source_fileid_map, target_fileid_map),
402
 
            specific_file=specific_files)
 
410
            specific_files=specific_files)
403
411
 
404
412
    def iter_changes(self, include_unchanged=False, specific_files=None,
405
413
        pb=None, extra_trees=[], require_versioned=True,
410
418
            self.source.tree, self.target.tree,
411
419
            want_unchanged=include_unchanged)
412
420
        return changes_from_git_changes(changes, self.target.mapping,
413
 
            specific_file=specific_files)
 
421
            specific_files=specific_files)
414
422
 
415
423
 
416
424
tree.InterTree.register_optimiser(InterGitRevisionTrees)