Thoughts on push performance

John Arbash Meinel john at arbash-meinel.com
Thu May 22 15:25:05 BST 2008


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

Andrew Bennetts wrote:
| 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.
|
|

I'm guessing I put together something for 'update_revisions' because of
something I was seeing with 'bzr pull', and the push side never got the same
treatment.

Looking at 'pull' we have a very nice:

self.update_revisions(source, stop_revision, overwrite=overwrite)

With no try/except Diverged, etc. So +1 on your fix.

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

iEYEARECAAYFAkg1gkEACgkQJdeBCYSNAAMZWgCfXLAXV+sWneOpDKOIFwd+8ATy
MpUAnjL9gA6bjYa34ISoCUeUMkjJV0Kf
=iyuS
-----END PGP SIGNATURE-----



More information about the bazaar mailing list