[MERGE] deprecated EmptyTree

Aaron Bentley aaron.bentley at utoronto.ca
Thu Jul 20 15:37:15 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel wrote:
> Robert Collins wrote:
> 
>>>This patch deprecated EmptyTree, replacing all uses of it with a
>>>RevisionTree.
>>>
>>>The first thing is that as a tree, EmptyTree is really very pathological
>>>- all the methods are essentially special cases. So its very hard to
>>>test, because you can only ever have the Empty case of it.
>>>
>>>The second thing is that in terms of code maintenance, we would have one
>>>less thing to maintain if we use RevisionTree instead - as this patch
>>>does.
>>>
>>>Thoughts? +1's ?
>>>
>>>-Rob
>>>
> 
> 
> 1) I don't think we need EmptyTree, you are right to just use an empty
> RevisionTree
> 
> 2) We shouldn't really be using None to reference the EmptyTree (pending
> the discussion in the other thread). But if you are just trying to fix
> *this* problem, without fixing *that* one...
> 
> ...
> 
> 
>>>=== modified file 'bzrlib/missing.py'
>>>--- bzrlib/missing.py	2006-06-10 00:21:11 +0000
>>>+++ bzrlib/missing.py	2006-07-20 13:10:57 +0000
>>>@@ -5,8 +5,7 @@
>>> 
>>> def iter_log_data(revisions, revision_source, verbose):
>>>     from bzrlib.diff import compare_trees
>>>-    from bzrlib.tree import EmptyTree
>>>-    last_tree = EmptyTree
>>>+    last_tree = revision_source.revision_tree(None)
>>>     last_rev_id = None
>>>     for revno, rev_id in revisions:
>>>         rev = revision_source.get_revision(rev_id)
> 
> 
> ^- Just seeing this, I would really like to see the cleanup switch to
> using: last_tree = revision_source.revision_tree(EMPTY_TREE), instead of
> None.

Until EMPTY_TREE is in, we should use NULL_REVISION, IMHO.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEv5Ua0F+nu1YWqI0RAk1lAJ92Oyodl4MP/YShC+1bI2q1tsfYnwCfewPz
TdfQwA+MVWJSH+8VnNatyu4=
=ZzDy
-----END PGP SIGNATURE-----




More information about the bazaar mailing list