[MERGE][BUG #153786] Autopack retries

John Arbash Meinel john at arbash-meinel.com
Fri Dec 19 16:48:13 GMT 2008


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

Martin Pool wrote:

...

>> +class RetryAutopack(RetryWithNewPacks):
>> +    """Raised when we are autopacking and we find a missing file.
>> +
>> +    Meant as a signaling exception, to tell the autopack code it should try
>> +    again.
>> +    """
>> +
>> +    internal_error = True
>> +
>> +    _fmt = ("Pack files have changed, reload and try autopack again.")
>> +
>> +
> 
> In general exceptions should include some clue to where they occurred,
> like the url of the repository or the exception that initiated it.  If
> the error occurs in a bug report or is hard to reproduce it gives us
> somewhere to start from.
> 
> Does this need to be a separate error from RetryWithNewPacks?
> 

Originally, I was trying for a different structure. The very first idea
was to have the low-level function raise something like
RetryWithNewPacks, and then higher up would call reload() [which
wouldn't raise an exception], and that would be done in a loop. Closer
to how I did it for the get_record_stream() changes.

However, it turned out to be pretty hard to have the part of the
low-level code which knows that a file has gone missing, communicate
that up the stack, to where it could be handled, and then resumed.
Partially because you also needed to know what had already been done
before you could resume.

And then there were questions about push versus pull, and when we would
want to actually resume.

So the reason to use a custom exception is because it is tying the
_restart_autopack function (which is used as a reload_func) to the
exception handler in autopack() which starts the whole process over.

I went ahead and added a bit more context information to the Retry
hierarchy, which should help.

John
=:->

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

iEYEARECAAYFAklL0E0ACgkQJdeBCYSNAAP97gCfX3QKOdTU4oJQ46bmX/7Ec4r6
9+oAoKsa80DvA0CxX4LpQEioL3HMjC42
=TqZE
-----END PGP SIGNATURE-----



More information about the bazaar mailing list