Thoughts on push performance
Andrew Bennetts
andrew at canonical.com
Thu May 22 09:44:29 BST 2008
John Arbash Meinel wrote:
[...]
> ~ b) Further, if you look at update_revisions we have:
[...]
> ~ if overwrite:
> ~ self.generate_revision_history(stop_revision)
> ~ else:
> ~ self.generate_revision_history(stop_revision,
> ~ last_rev=last_rev, other_branch=other)
>
> ~ So I *think* what is happening is that if you supply --overwrite it might
> ~ be generating the revision history 2 times.
Btw, _basic_push strangely does *not* pass the overwrite to update_revisions.
Instead it catches the DivergedBranches error itself, if overwrite is set.
This code is in general a bit tangled; depending on combinations of flags
different code is responsible for raising DivergedBranches, and different code
is responsible for catching it. I don't think it needs to be like that.
Can you see any reason why we shouldn't just do this to _basic_push:
- try:
- target.update_revisions(self, stop_revision)
- except errors.DivergedBranches:
- if not overwrite:
- raise
- if overwrite:
- target.set_revision_history(self.revision_history())
+ target.update_revisions(self, stop_revision,
+ overwrite=overwrite)
?
I'm sure if this code was easier to follow it'd be easier to optimise...
-Andrew.
More information about the bazaar
mailing list