[merge] from Robert: handle NULLREVISION

John Arbash Meinel john at arbash-meinel.com
Sun Jul 2 02:34:49 BST 2006


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

John Arbash Meinel wrote:
> Robert asked for me to post this to the list:
> https://launchpad.net/products/bzr/+bug/51521
> 
> revision.common_ancestor and Branch.generate_revision_history both barf
> if NULLREVISION is given to them. I think its reasonable that they
> handle NULLREVISION correctly - attached patch does this.
> 
> I'll comment in a later post.
> 
> John
> =:->

Overall, this seems reasonable, just a couple comments.



=== modified file 'bzrlib/branch.py'
- --- bzrlib/branch.py	2006-06-27 00:58:18 +0000
+++ bzrlib/branch.py	2006-07-01 08:37:58 +0000
@@ -1078,8 +1078,12 @@
         :param other_branch: The other branch that DivergedBranches should
             raise with respect to.
         """
- -        # stop_revision must be a descendant of last_revision
- -        stop_graph = self.repository.get_revision_graph(revision_id)
+        # special case NULL_REVISION:
+        if revision_id == revision.NULL_REVISION:
+            stop_graph = {}
+        else:
+            # stop_revision must be a descendant of last_revision
+            stop_graph = self.repository.get_revision_graph(revision_id)
         if last_rev is not None and last_rev not in stop_graph:
             # our previous tip is not merged into stop_revision
             raise errors.DivergedBranches(self, other_branch)

^- Why do this here, rather than having 'repository.get_revision_graph'
return the empty set for NULL_REVISION?

Otherwise it looks good.

John
=:->


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEpyK5JdeBCYSNAAMRAtN3AKDRXuZb7YOKMnm5eL5YsY6v4fwZ+gCffKW5
+DMGjfwl4Lax00B30b7Tgo0=
=obj2
-----END PGP SIGNATURE-----




More information about the bazaar mailing list