[Pkg-bazaar-commits] ./bzr/unstable r461: - remove compare_inventories() in favor of compare_trees()
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 08:19:17 UTC 2009
------------------------------------------------------------
revno: 461
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Wed 2005-05-11 14:25:35 +1000
message:
- remove compare_inventories() in favor of compare_trees()
- add basic tests for bzr log
modified:
bzrlib/diff.py
bzrlib/log.py
testbzr
-------------- next part --------------
=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py 2005-05-11 04:18:51 +0000
+++ b/bzrlib/diff.py 2005-05-11 04:25:35 +0000
@@ -301,46 +301,6 @@
else:
print >>to_file, ' ' + path
-
-
-def compare_inventories(old_inv, new_inv):
- """Return a TreeDelta object describing changes between inventories.
-
- This only describes changes in the shape of the tree, not the
- actual texts.
-
- This is an alternative to diff_trees() and should probably
- eventually replace it.
- """
- old_ids = old_inv.id_set()
- new_ids = new_inv.id_set()
- delta = TreeDelta()
-
- delta.removed = [(old_inv.id2path(fid), fid) for fid in (old_ids - new_ids)]
- delta.removed.sort()
-
- delta.added = [(new_inv.id2path(fid), fid) for fid in (new_ids - old_ids)]
- delta.added.sort()
-
- for fid in old_ids & new_ids:
- old_ie = old_inv[fid]
- new_ie = new_inv[fid]
- old_path = old_inv.id2path(fid)
- new_path = new_inv.id2path(fid)
-
- text_modified = (old_ie.text_sha1 != new_ie.text_sha1)
-
- if old_path != new_path:
- delta.renamed.append((old_path, new_path, fid, text_modified))
- elif text_modified:
- delta.modified.append((new_path, fid))
-
- delta.modified.sort()
- delta.renamed.sort()
-
- return delta
-
-
def compare_trees(old_tree, new_tree):
=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py 2005-05-11 04:18:51 +0000
+++ b/bzrlib/log.py 2005-05-11 04:25:35 +0000
@@ -94,9 +94,8 @@
"""
from osutils import format_date
from errors import BzrCheckError
- from diff import compare_inventories
+ from diff import compare_trees
from textui import show_status
- from inventory import Inventory
if to_file == None:
import sys
@@ -115,7 +114,8 @@
branch._need_readlock()
precursor = None
if verbose:
- prev_inv = Inventory()
+ from tree import EmptyTree
+ prev_tree = EmptyTree()
for revno, revision_id in which_revs():
print >>to_file, '-' * 60
print >>to_file, 'revno:', revno
@@ -140,11 +140,11 @@
# Don't show a list of changed files if we were asked about
# one specific file.
- if verbose and not filename:
- this_inv = branch.get_inventory(rev.inventory_id)
- delta = compare_inventories(prev_inv, this_inv)
+ if verbose:
+ this_tree = branch.revision_tree(revision_id)
+ delta = compare_trees(prev_tree, this_tree)
delta.show(to_file, show_ids)
- prev_inv = this_inv
+ prev_tree = this_tree
precursor = revision_id
=== modified file 'testbzr'
--- a/testbzr 2005-05-11 02:30:01 +0000
+++ b/testbzr 2005-05-11 04:25:35 +0000
@@ -289,6 +289,9 @@
assert backtick('bzr revno') == '5\n'
runcmd('bzr export -r 5 export-5.tmp')
runcmd('bzr export export.tmp')
+
+ runcmd('bzr log')
+ runcmd('bzr log -v')
cd('..')
cd('..')
More information about the Pkg-bazaar-commits
mailing list