Branch.set_last_revision() runs hooks even if last revision didn't change

Bug #518792 reported by Jelmer Vernooij
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned

Bug Description

  affects bzr
  status confirmed
  importance low

Branch.set_last_revision() will always run the update_branch_tip hooks,
even if the branch tip hook hasn't actually changed.

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 518792] [NEW] Branch.set_last_revision() runs hooks even if last revision didn't change

On Sun, 2010-02-07 at 15:15 +0000, Jelmer Vernooij wrote:
> Public bug reported:
>
> affects bzr
> status confirmed
> importance low
>
> Branch.set_last_revision() will always run the update_branch_tip hooks,
> even if the branch tip hook hasn't actually changed.

I'm not sure that this really is a bug: It's true that its a no-op, but
I'm struggling to think of reasons why it /shouldn't/ run the hooks (or
equally why it should).

-Rob

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

On Mon, 2010-02-08 at 21:31 +0000, Robert Collins wrote:
> On Sun, 2010-02-07 at 15:15 +0000, Jelmer Vernooij wrote:
> > Public bug reported:
> >
> > affects bzr
> > status confirmed
> > importance low
> >
> > Branch.set_last_revision() will always run the update_branch_tip hooks,
> > even if the branch tip hook hasn't actually changed.
>
> I'm not sure that this really is a bug: It's true that its a no-op, but
> I'm struggling to think of reasons why it /shouldn't/ run the hooks (or
> equally why it should).
So, the reason why I reported this was because I see notification popups
for branches that haven't actually changed. This is because e.g. bzr-svn
and bzr-git will call set_last_revision() if they did not fetch any new
revisions.

Arguably this could be fixed in a number of different places:
 * bzr-git/bzr-hg/bzr-svn could check last_revision() before calling
set_last_revision()
 * bzrlib could avoid running the hooks if the branch tip did not
actually change
 * bzr-dbus could not send notifications if the old and new revid are
the same
 * bzr-notify could ignore notifications for branches that didn't
actually change

I think fixing bzrlib makes the most sense, since the name
'post_change_branch_tip' suggests that that hook is only ever executed
if the branch tip actually changes and I can't think of a reason why you
*would* want that hook to be fired if the branch tip didn't change.

Cheers,

Jelmer

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.