[RFC] Off by one error in info.py

Aaron Bentley aaron.bentley at utoronto.ca
Sat Apr 1 17:56:23 BST 2006


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

Olaf Conradi wrote:
| I can either adjust the substraction with one, or use
| revision_id_to_revo. The latter one has my preference because it would
| get rid of the exception.

More future-proof, too.  The less code that knows how to calculate a
revno, the less we have to fix if the way we calculate revos changes.

| Shall I put the latter in my bzr.olaf.info branch (I already have a
test case).

Your call.  It does make it harder to apply just one of the changes, but
both changes look like they'd be welcome improvements.

| BTW: How does one best indent this without crossing 80 chars? PEP8
| does not really show how to do it in this case. The original code
| crossed 80 chars.

I usually break the statement up into several:

~        tree_revision = working.last_revision()
~        tree_revno = branch.revision_id_to_revno(tree_revision)
~        missing_count = len(history) - tree_revno

Or we could go and define WorkingTree.revno.  That might be nice.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFELrC30F+nu1YWqI0RArUHAJ0YjjaimBFW9E26Ll1vB2I/SsAseQCfUQa+
JZpzqb5RrEp6nE4qB0tYA3E=
=P9r2
-----END PGP SIGNATURE-----




More information about the bazaar mailing list