bzr: ERROR: exceptions.AssertionError

Bug #75625 reported by Bob Tanner
2
Affects Status Importance Assigned to Milestone
Bazaar
Invalid
Undecided
Unassigned
bzr email commit hook
Fix Released
Medium
Wouter van Heyst

Bug Description

$ bzr --version
Bazaar (bzr) 0.14.0dev0
  from bzr checkout /home/tanner/projects/bazaar-ng/bzr.dev
    revision: 2182
    revid: <email address hidden>
    branch nick: bzr.dev
Using python interpreter: /usr/bin/python
Using python standard library: /usr/lib/python2.4
Using bzrlib: /home/tanner/projects/bazaar-ng/bzr.dev/bzrlib
<snip>

$ mkdir foo
$ cd foo/
$ ls
$ touch foo.py
$ bzr init
$ bzr add foo.py
added foo.py
$ bzr commit -m "Foo testing"
added foo.py

You need a passphrase to unlock the secret key for
user: "Robert J. Tanner <email address hidden>"
1024-bit DSA key, ID 2CC1B288, created 2002-06-18

Committed revision 1.
bzr: ERROR: exceptions.AssertionError:

Traceback (most recent call last):
  File "/home/tanner/projects/bazaar-ng/bzr.dev/bzrlib/commands.py", line 637, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/tanner/projects/bazaar-ng/bzr.dev/bzrlib/commands.py", line 599, in run_bzr
    ret = run(*run_argv)
  File "/home/tanner/projects/bazaar-ng/bzr.dev/bzrlib/commands.py", line 292, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/tanner/projects/bazaar-ng/bzr.dev/bzrlib/builtins.py", line 1897, in run
    reporter=reporter)
  File "/home/tanner/projects/bazaar-ng/bzr.dev/bzrlib/decorators.py", line 51, in write_locked
    return unbound(self, *args, **kwargs)
  File "/home/tanner/projects/bazaar-ng/bzr.dev/bzrlib/mutabletree.py", line 126, in commit
    revprops=revprops, *args, **kwargs)
  File "/home/tanner/projects/bazaar-ng/bzr.dev/bzrlib/commit.py", line 339, in commit
    {'branch':self.branch,
  File "<string>", line 0, in ?
  File "/home/tanner/.bazaar/plugins/email/__init__.py", line 166, in post_commit
    EmailSender(branch, revision_id, config.BranchConfig(branch)).send_maybe()
  File "/home/tanner/.bazaar/plugins/email/__init__.py", line 156, in send_maybe
    self.send()
  File "/home/tanner/.bazaar/plugins/email/__init__.py", line 131, in send
    result = process.communicate(self.body().encode('utf8'))[0]
  File "/home/tanner/.bazaar/plugins/email/__init__.py", line 59, in body
    self.add_diff(outf, self.difflimit())
  File "/home/tanner/.bazaar/plugins/email/__init__.py", line 74, in add_diff
    tree_new, tree_old = self.branch.repository.revision_trees((revid_new, revid_old))
  File "/home/tanner/projects/bazaar-ng/bzr.dev/bzrlib/repository.py", line 626, in revision_trees
    assert None not in revision_ids
AssertionError

bzr 0.14.0dev0 on python 2.4.4.final.0 (linux2)
arguments: ['/home/tanner/bin/bzr', 'commit', '-m', 'Foo testing']

** please send this report to <email address hidden>
Null message body; hope that's ok

Looks like the email plugin is throwing the AssertError. I'm not sure how to get the revision of the email plugin other then to look a the bzr log and code

$ bzr version-info ~/.bazaar/plugins/email/
revision-id: <email address hidden>
date: 2006-12-01 16:02:11 +1100
build-date: 2006-12-13 09:53:14 -0600
revno: 16
branch-nick: email

Finally, my ~/.bazaar/bazaar.conf
[DEFAULT]
email = Robert J. Tanner <email address hidden>
editor = /usr/bin/vim
check_signatures = check-available
create_signatures = always
post_commit = bzrlib.plugins.email.post_commit
post_commit_to = <email address hidden>
post_commit_sender = <email address hidden>
post_commit_difflimit = 1

Revision history for this message
Wouter van Heyst (larstiq) wrote : Re: [Bug 75625] bzr: ERROR: exceptions.AssertionError

On Wed, Dec 13, 2006 at 03:56:37PM -0000, tanner wrote:
> Public bug reported:
>
> $ bzr --version
> Bazaar (bzr) 0.14.0dev0
> from bzr checkout /home/tanner/projects/bazaar-ng/bzr.dev
> revision: 2182
> revid: <email address hidden>
> branch nick: bzr.dev
> Using python interpreter: /usr/bin/python
> Using python standard library: /usr/lib/python2.4
> Using bzrlib: /home/tanner/projects/bazaar-ng/bzr.dev/bzrlib
> <snip>
>
> $ mkdir foo
> $ cd foo/
> $ ls
> $ touch foo.py
> $ bzr init
> $ bzr add foo.py
> added foo.py
> $ bzr commit -m "Foo testing"
> added foo.py

...

> File "/home/tanner/.bazaar/plugins/email/__init__.py", line 74, in add_diff
> tree_new, tree_old = self.branch.repository.revision_trees((revid_new, revid_old))
> File "/home/tanner/projects/bazaar-ng/bzr.dev/bzrlib/repository.py", line 626, in revision_trees
> assert None not in revision_ids
> AssertionError
>
> bzr 0.14.0dev0 on python 2.4.4.final.0 (linux2)
> arguments: ['/home/tanner/bin/bzr', 'commit', '-m', 'Foo testing']
>
> ** please send this report to <email address hidden>
> Null message body; hope that's ok
>
> Looks like the email plugin is throwing the AssertError. I'm not sure
> how to get the revision of the email plugin other then to look a the bzr
> log and code
>
> $ bzr version-info ~/.bazaar/plugins/email/
> revision-id: <email address hidden>
> date: 2006-12-01 16:02:11 +1100
> build-date: 2006-12-13 09:53:14 -0600
> revno: 16
> branch-nick: email

Indeed, the email plugin isn't dealing with a change in the api
introduced in 0.9.

 affects /products/bzr-email

Wouter van Heyst

Revision history for this message
John A Meinel (jameinel) wrote :

This seems to be more of a bug in the email plugin rather than bzr itself. So I'm marking it there as well.

Though it may be a bug in bzr. For some reason it is expecting None to never be sent to bzrlib.reposititory.Repository.revision_trees()

Though it is a valid request, IMO. (it works for .revision_tree() it should work for .revision_trees(). Unless we prefer using 'null:')

Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 75625] Re: bzr: ERROR: exceptions.AssertionError

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

John A Meinel wrote:
> Though it is a valid request, IMO. (it works for .revision_tree() it
> should work for .revision_trees(). Unless we prefer using 'null:')

I have a strong preference for 'null:', so I didn't want to add support
for None when creating a new function. Perhaps that's overzealous,
though. None isn't officially deprecated yet...

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

iD8DBQFFgDnd0F+nu1YWqI0RAuVTAKCH5rG/4sX5kctO7NayxqHAYBJ1CQCffoyN
faqWu/LT+ZsjpAcuH6lI0z4=
=lr/h
-----END PGP SIGNATURE-----

Revision history for this message
John A Meinel (jameinel) wrote :

I agree that 'null:' is preferred. Actually, I think:
bzrlib.revision.NULL_REVISION is the prefered method.

I would guess that the email plugin is just reading branch.last_revision() and passing that to revision_trees().

So really we need branch.last_revision() to not be returning None.

With something like this:
=== modified file 'bzrlib/branch.py'
--- bzrlib/branch.py 2006-12-07 16:21:39 +0000
+++ bzrlib/branch.py 2006-12-13 18:21:47 +0000
@@ -320,7 +320,7 @@
         if ph:
             return ph[-1]
         else:
- return None
+ return _mod_revision.NULL_REVISION

     def missing_revisions(self, other, stop_revision=None):
         """Return a list of new revisions that would perfectly fit.

Revision history for this message
Wouter van Heyst (larstiq) wrote :

On Wed, Dec 13, 2006 at 06:22:16PM -0000, John A Meinel wrote:
> I agree that 'null:' is preferred. Actually, I think:
> bzrlib.revision.NULL_REVISION is the prefered method.
>
> I would guess that the email plugin is just reading
> branch.last_revision() and passing that to revision_trees().
>
> So really we need branch.last_revision() to not be returning None.
>
> With something like this:
> === modified file 'bzrlib/branch.py'
> --- bzrlib/branch.py 2006-12-07 16:21:39 +0000
> +++ bzrlib/branch.py 2006-12-13 18:21:47 +0000
> @@ -320,7 +320,7 @@
> if ph:
> return ph[-1]
> else:
> - return None
> + return _mod_revision.NULL_REVISION
>
> def missing_revisions(self, other, stop_revision=None):
> """Return a list of new revisions that would perfectly fit.

That will get you really funny behaviour in other places. For the email
plugin, I'll probably invoke repository.revision_tree() twice, since
that does accept None.

Wouter van Heyst

Revision history for this message
John A Meinel (jameinel) wrote :

The other possibility for the email plugin is to just do:

# Work around small inconsistencies in the bzr api
if last_rev_id is None:
  last_rev_id = bzrlib.revision.NULL_REVISION

We do want to avoid having None mean the null revision. So we should try to switch when possible.

Changed in bzr-email:
assignee: nobody → larstiq
importance: Undecided → Medium
status: Unconfirmed → Fix Committed
Revision history for this message
Wouter van Heyst (larstiq) wrote :

That is also asserted against in revision_trees,

Changed in bzr-email:
status: Fix Committed → Fix Released
Revision history for this message
John A Meinel (jameinel) wrote :

Not considered a bug in bzr. We may want to open another bug for using NULL_REVISION instead of None.

Changed in bzr:
status: Unconfirmed → Rejected
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.