New public Graph.revision_relation method

Aaron Bentley aaron at aaronbentley.com
Wed Dec 9 16:07:12 GMT 2009


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

Martin von Gagern wrote:
> Hi!
> 
> I'm looking for a public interface to cheaply test the relation between
> two revisions, i.e. "a is an ancestor of b", "b is an ancestor of a" or
> "neither is an ancestor of the other".

We use Graph.heads for this.

If a is an ancestor of b, then Graph.heads will return b.
If b is an ancestor of a, then Graph.heads will return a.
If neither is an ancestor of the other, then Graph.heads will return both.

Of course, it may simplify the client API to provide a revision_relation
method, but if you do, I suggest basing it on heads and using the logic
described above.

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

iEYEARECAAYFAksfyzAACgkQ0F+nu1YWqI2olwCfUn6ef4fRsI58bRo0FgIdlU5B
NJYAoIZdmTzAFSwdHV300se9tZz4Jdtt
=vl9c
-----END PGP SIGNATURE-----



More information about the bazaar mailing list