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

  • Committer: Martin Pool
  • Date: 2005-05-11 04:25:35 UTC
  • Revision ID: mbp@sourcefrog.net-20050511042535-286238ce7dcd6ebb
- remove compare_inventories() in favor of compare_trees()
- add basic tests for bzr log

Show diffs side-by-side

added added

removed removed

Lines of Context:
301
301
                else:
302
302
                    print >>to_file, '  ' + path
303
303
 
304
 
        
305
 
 
306
 
def compare_inventories(old_inv, new_inv):
307
 
    """Return a TreeDelta object describing changes between inventories.
308
 
 
309
 
    This only describes changes in the shape of the tree, not the
310
 
    actual texts.
311
 
 
312
 
    This is an alternative to diff_trees() and should probably
313
 
    eventually replace it.
314
 
    """
315
 
    old_ids = old_inv.id_set()
316
 
    new_ids = new_inv.id_set()
317
 
    delta = TreeDelta()
318
 
 
319
 
    delta.removed = [(old_inv.id2path(fid), fid) for fid in (old_ids - new_ids)]
320
 
    delta.removed.sort()
321
 
 
322
 
    delta.added = [(new_inv.id2path(fid), fid) for fid in (new_ids - old_ids)]
323
 
    delta.added.sort()
324
 
 
325
 
    for fid in old_ids & new_ids:
326
 
        old_ie = old_inv[fid]
327
 
        new_ie = new_inv[fid]
328
 
        old_path = old_inv.id2path(fid)
329
 
        new_path = new_inv.id2path(fid)
330
 
 
331
 
        text_modified = (old_ie.text_sha1 != new_ie.text_sha1)
332
 
 
333
 
        if old_path != new_path:
334
 
            delta.renamed.append((old_path, new_path, fid, text_modified))
335
 
        elif text_modified:
336
 
            delta.modified.append((new_path, fid))
337
 
 
338
 
    delta.modified.sort()
339
 
    delta.renamed.sort()    
340
 
 
341
 
    return delta
342
 
 
343
 
 
344
304
 
345
305
 
346
306
def compare_trees(old_tree, new_tree):