[MERGE] Graph.find_revno()
John Arbash Meinel
john at arbash-meinel.com
Thu May 22 15:18:14 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Aaron Bentley wrote:
| John Arbash Meinel wrote:
|> This adds a new API to Graph. The idea is to make it easier to determine
|> a real
|> 'revno' when all we have is limited information.
|
| I'm not sure that this is generally useful. We usually want to get a
| revno in the context of a branch, where many revisions don't have
| integer revnos.
The biggest thing is that it allows you to give more context than a single branch.
Often, we'll have grabbed just a revision from another branch, and then we are
trying to set "self.set_last_revision(revision_id)". However we have no context
for that, and end up having to count back to 0.
revision_id_to_revno() is good *if* the current revision_id is in the history of
your last_revision.
But when *setting* the last revision, it is likely to just be a descendant.
Hence why my algorithm can still do partial history for that case. (Search from
both tips, find when they converge.)
It is all about getting the right revno for "set_last_revision_info()" from all
of the places where we aren't quite sure what it is. (Most notably when
stop_revision != last_revision of THIS or OTHER.)
Also, because we support "bzr branch -r revid:XXX" it is possible that revid
isn't in the ancestry of any of the branches, but it is likely to share some
ancestry, which means we again don't have to count all the way back to NULL.
There are also a few places that do 'set_last_revision' style work without
properly giving the context of the other branch. The idea was to take out a lot
of the if checks, and just provide a nice, well performing function for handling
these cases.
I admit it isn't strictly useful for things like 'log' where we are looking for
dotted revnos.
John
=:->
|
|> Right now, we have some special cases where we check something like:
|> ~ if rev_id == branch.last_revision():
|> ~ revno = branch.revno()
|> ~ else:
|> ~ revno = len(branch.repository.iter_history(rev_id))
|
| Are we actually doing this a lot? Calculating a revno without the
| context of a branch? I can see maybe doing it in the *implementation*
| of a branch, but it looks like The Wrong Thing for every other situation.
|
| We already have pretty efficient way of calculating the revno for a
| revision_id in the context of a branch: Branch6.revision_id_to_revno,
| which I implemented a couple months ago. Is it unsuitable for the cases
| you're looking at?
|
| Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkg1gKYACgkQJdeBCYSNAAMeuwCeNpb6+0b1e+29Uky5nEXU/hqj
AJYAoIi7IUx8Eesct0UtkIy0ya0i7eU4
=owdg
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list