[MERGE] RevisionSpec.in_history() should raise nicer errors

John Arbash Meinel john at arbash-meinel.com
Wed Aug 23 21:22:03 BST 2006


Currently with bzr, if you do 'bzr log -r10000' you get a NoSuchRevision
exception, which is an internal exception, meant for indicating you are
missing something from your repository.

Also, it turned out that while we tested the very basic revision spec
functionality, we didn't do much error or edge case testing.

The attached patch adds a new error: InvalidRevisionSpec, which gets
formatted into a much nicer user error.

It also adds lots of edge-case testing to all of the current revisions
specs.

There are a few actual functional changes that probably should be discussed:

1) '-rbefore:revid:X' used to return revision X if it was not in the
local branches revision history. This has been fixed to return the
left-hand parent of X.

2) '-rbefore:0' used to return the Null revision. This has been changed
to raise an error. Since nothing is before the null revision.

3) I changed '-rbranch:branch/sub/path', '-rancestor:branch/sub/path',
and '-rrevno:10:branch/sub/path' to be errors, rather than using the
branch at 'url'. This is probably a little controversial, but it is easy
to change back. We never asserted the old behavior, and my feeling is
that in cases like this, to help prevent accidentally going to the wrong
branch, it is better to require the exact path to a branch.

4) I updated the '-rrevno:N' parser, so that it handles 'N' just like
'-rN'. Meaning you can supply negative numbers, etc.

5) Splits up the revspec tests into a lot more small tests, and
explicitly tests each currently implemented revision spec, including
testing edge cases and exceptions.

6) The very last patch changes 'bzr log -r-10' so that if there are only
8 revisions, it returns the 1st revision, rather than raising an error.
This makes the alias 'log=log -r-10..-1' really nice, since it gives you
summaries, without giving as many exceptions all the time.


Is this 0.10 worthy? From the amount of effort possibly not. From the
user-visible and code-visible changes, perhaps. Changing
Branch.open_containing => Branch.open() may be sufficient. Though I can
revert that if it means we get it into 0.10.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: revspec-55420.diff
Type: text/x-patch
Size: 35209 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060823/7b6b1ea2/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060823/7b6b1ea2/attachment.pgp 


More information about the bazaar mailing list