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

Use specified_file_ids instead of is_inside_any in compare_trees

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from bzrlib.inventory import InventoryEntry
18
18
from bzrlib.trace import mutter
 
19
from bzrlib import tree
19
20
 
20
21
 
21
22
class TreeDelta(object):
167
168
    try:
168
169
        new_tree.lock_read()
169
170
        try:
 
171
            specific_file_ids = tree.specified_file_ids(specific_files, 
 
172
                (new_tree, old_tree), require_versioned=False)
170
173
            return _compare_trees(old_tree, new_tree, want_unchanged,
171
 
                                  specific_files)
 
174
                                  specific_file_ids)
172
175
        finally:
173
176
            new_tree.unlock()
174
177
    finally:
175
178
        old_tree.unlock()
176
179
 
177
180
 
178
 
def _compare_trees(old_tree, new_tree, want_unchanged, specific_files):
 
181
def _compare_trees(old_tree, new_tree, want_unchanged, specific_file_ids):
179
182
 
180
183
    from osutils import is_inside_any
181
184
    
214
217
        if old_entry.kind == 'root_directory':
215
218
            return
216
219
 
217
 
        if specific_files:
218
 
            if (not is_inside_any(specific_files, old_path)
219
 
                and not is_inside_any(specific_files, new_path)):
 
220
        if specific_file_ids:
 
221
            if (old_file_id not in specific_file_ids and 
 
222
                new_file_id not in specific_file_ids):
220
223
                return
221
224
 
222
225
        # temporary hack until all entries are populated before clients 
314
317
 
315
318
    # Now we have a set of added and removed files, mark them all
316
319
    for old_path, old_entry in removed.itervalues():
317
 
        if specific_files:
318
 
            if not is_inside_any(specific_files, old_path):
 
320
        if specific_file_ids:
 
321
            if not old_entry.file_id in specific_file_ids:
319
322
                continue
320
323
        delta.removed.append((old_path, old_entry.file_id, old_entry.kind))
321
324
    for new_path, new_entry in added.itervalues():
322
 
        if specific_files:
323
 
            if not is_inside_any(specific_files, new_path):
 
325
        if specific_file_ids:
 
326
            if not new_entry.file_id in specific_file_ids:
324
327
                continue
325
328
        delta.added.append((new_path, new_entry.file_id, new_entry.kind))
326
329