[MERGE] add a hook for Branch.set_last_revision_info()

John Arbash Meinel john at arbash-meinel.com
Wed Apr 9 08:35:56 BST 2008


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

James Henstridge wrote:
| One feature of the bzr-dbus plugin is to send a D-Bus signal over the
| session bus whenever the head revision of a branch changes.  It
| currently does this through the "set_rh" hook.
|
| Unfortunately, the current default branch formats do not call
| set_revision_history() during commits or pulls so the D-Bus signal
| doesn't get sent.  It seems that the set_last_revision_info() method
| is now the right place to hook to detect these changes, so that's what
| the attached bundle does.
|
| I realise that there are already hooks for commit, pull, push and
| uncommit, but I think this hook has value.  If I add hooks to the
| previous 4 operations, the plugin would need to be modified every time
| a new way to modify the branch head is added.  By adding a hook to the
| function that actually changes the branch, things should be a lot more
| robust.
|
| James.
|

Just as a small reasoning...

revno can be expensive to compute if you don't have it. Which is why we
currently cache it in the last-revision file. If we could, it would be better to
cache it elsewhere, and then we wouldn't need it here. Which would help with
stuff like "bzr branch -r -100" which at that point only has a revision id, and
has to compute the revno.

Anyway, because of that, I don't want to have a hook which *requires* data that
can be expensive to compute. Ian's version allows us to present it if we have it
and give a way to compute it if someone really needs it. (And then cache it in
case multiple hooks are firing that all need it.)

John
=:->

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

iD8DBQFH/HHcJdeBCYSNAAMRAnwiAKCQGZgSSxSu0BdxubhVdIbUtFtnBACff/7p
JCxTIPZNjQ5URJuWC/NM4H0=
=Z95c
-----END PGP SIGNATURE-----




More information about the bazaar mailing list