bzr commit fails with revno-related AssertionError

Bug #91725 reported by Jamu Kakar
4
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

The following shows the error that occurred and the steps I used to fix the problem. Due to the branch being for a proprietary project, I've replaced filenames with "..." where necessary.

jkakar:...$ bzr commit
modified ...
bzr: ERROR: exceptions.AssertionError: 301 != 306

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 650, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 612, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 304, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.4/site-packages/bzrlib/builtins.py", line 2109, in run
    reporter=reporter)
  File "/usr/lib/python2.4/site-packages/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/mutabletree.py", line 158, in commit
    revprops=revprops, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/commit.py", line 353, in commit
    self.branch.set_last_revision_info(new_revno, self.rev_id)
  File "/usr/lib/python2.4/site-packages/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/branch.py", line 1353, in set_last_revision_info
    assert len(history) == revno, '%d != %d' % (len(history), revno)
AssertionError: 301 != 306

bzr 0.15.0candidate0 on python 2.4.4.candidate.1 (linux2)
arguments: ['/usr/bin/bzr', 'commit']

** please send this report to <email address hidden>
jkakar:...$ bzr st
modified:
  ...
jkakar:...$ python
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bzrlib.branch
>>> b = bzrlib.branch.Branch.open("...")
>>> b.generate_revision_history(b.last_revision())
>>> len(b.revision_history())
300
>>>
jkakar:...$ bzr commit
modified src/...
Committed revision 301.

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

You should also be able to do "bzr pull --overwrite .". Which is a little funny, but should basically just regenerate the revision history.

I think the source of this bug is that very old versions of bzr allowed the 'revision-history' to be something other than the left-hand ancestry. I think that was back in bzr-0.7 or so.

Versions since that would renormalize at certain times, but wouldn't strictly require it.

And 0.15-rc1 seems to explicitly require it.

We probably should be giving either a better error, or possibly just automatically renormalizing, if we see that other pre-conditions line up. (The last revision for the branch is correct, and it's revno is also off)

Revision history for this message
Andrew Lambe (alambe) wrote : bzr normalize-history

I had this same issue and recently discussed it on the mailing list.

I vote for automatic re-normalization under these conditions.
Otherwise, I suggest having a "bzr normalize-history" command, which is essentially an alias for "bzr pull --overwrite ." and give a better error message such as:

Cannot commit changes to non-normalized branch history.
Versions of bzr prior to 0.15 may have left this condition.
To normalize the branch history use the command, bzr normalize-history

Revision history for this message
Martin Pool (mbp) wrote :

The assertion is still present, so i'm marking confirmed.

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
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.