[RFC] Changing annotate to show merge points

Aaron Bentley aaron.bentley at utoronto.ca
Tue Nov 21 14:08:33 GMT 2006


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

Henri Wiechers wrote:
> The attached patch changes annotate to display the revision in which a
> line was merged instead of just saying 'merge'. I'm suspect there's a
> better way of doing this, so I'm asking for feedback rather than
> submitting it for merging.

One of the nice features of our annotate is that we show the revision
that originated the change.  I believe that's more useful than showing
the revision where the change was merged.

So I'd like to look at using dotted revnos instead of "merged-by"
revnos.  I think they're short enough.

(Though I must admit that I never use annotate, only gannotate.)

> It works by finding the oldest decedent of the line's revision that is
> a member of the branch. Because Repository.get_revision_graph()
> returns a dict that maps a revision to its parents, it does a breadth
> first search from the branch until it finds the revision.

It might be better to use the merge_sort code used by "log" and "viz".
That provides a list of revisions and their merge depths, so you just
have to find the revision, then iterate until you find a 0-depth revision.

> Searching from the branch seems really inefficient because you have to
> run down the entire branch, but to go the other way round you need a
> revision graph that maps a revision to its children. I found that
> Repository.get_revision_graph_with_ghosts() returns a Graph that can
> give that mapping. The problem is that it seems very slow. I coded an
> alternate version using that function instead, but it took three times
> longer to run on builtins.py. I'd really like to hear someone else's
> view on this problem.

Getting the graph with ghosts is much more expensive than getting it
without ghosts.  Even if you get ghosts, you can still have entries in
the annotate output that you can't determine where they were merged in
(i.e. the ancestors of a ghost).  So get_revision_graph is probably a
better choice than get_revision_graph_with_ghosts.

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

iD8DBQFFYwhg0F+nu1YWqI0RAlhQAJ4vLf1NRjQ1XXW9KuSeOgTa51N2bACfVaGg
PAgGfOqe1gpkmxmQlVIpOHU=
=bTVh
-----END PGP SIGNATURE-----




More information about the bazaar mailing list