bzr log fails

Bug #243536 reported by Andy Wingo
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
John A Meinel

Bug Description

I just pulled, so this is newest bzr.

wingo@unquote:~/src/g-wrap/mainline$ bzr log
bzr: ERROR: exceptions.IndexError: tuple index out of range

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 846, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 807, in ignore_pipe
    result = func(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 1790, in run
    limit=limit)
  File "/usr/lib/python2.5/site-packages/bzrlib/log.py", line 185, in show_log
    start_revision, end_revision, search, limit)
  File "/usr/lib/python2.5/site-packages/bzrlib/log.py", line 215, in _show_log
    allow_single_merge_revision)
  File "/usr/lib/python2.5/site-packages/bzrlib/log.py", line 273, in calculate_view_revisions
    view_revisions = _filter_revision_range(list(view_revs_iter),
  File "/usr/lib/python2.5/site-packages/bzrlib/log.py", line 544, in get_view_revisions
    generate_revno=True)
  File "/usr/lib/python2.5/site-packages/bzrlib/tsort.py", line 188, in merge_sort
    generate_revno).sorted()
  File "/usr/lib/python2.5/site-packages/bzrlib/tsort.py", line 354, in __init__
    if self._graph[revision][0] == parent:
IndexError: tuple index out of range

bzr 1.6b3 on python 2.5.1 (linux2)
arguments: ['/usr/bin/bzr', 'log']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.utf8'
plugins:
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Related branches

Revision history for this message
Andy Wingo (andywingo) wrote :

version 1.5.2 has a nicer traceback:

(gc clutter g-wrap ggo guile) wingo@unquote:~/src/g-wrap/mainline$ bzr log
bzr: ERROR: exceptions.KeyError: 'Arch-1:<email address hidden>%g-wrap--main-dev--0--patch-2'

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 846, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 807, in ignore_pipe
    result = func(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 1774, in run
    limit=limit)
  File "/usr/lib/python2.5/site-packages/bzrlib/log.py", line 185, in show_log
    start_revision, end_revision, search, limit)
  File "/usr/lib/python2.5/site-packages/bzrlib/log.py", line 215, in _show_log
    allow_single_merge_revision)
  File "/usr/lib/python2.5/site-packages/bzrlib/log.py", line 254, in calculate_view_revisions
    _get_mainline_revs(branch, start_revision, end_revision)
  File "/usr/lib/python2.5/site-packages/bzrlib/log.py", line 338, in _get_mainline_revs
    which_revs = _enumerate_history(branch)
  File "/usr/lib/python2.5/site-packages/bzrlib/log.py", line 136, in _enumerate_history
    for rev_id in branch.revision_history():
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 127, in read_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 387, in revision_history
    history = self._gen_revision_history()
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1925, in _gen_revision_history
    self._extend_partial_history()
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1949, in _extend_partial_history
    for revision_id in iterator:
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 1622, in iter_reverse_revision_history
    parents = graph.get_parent_map([next_id])[next_id]
KeyError: 'Arch-1:<email address hidden>%g-wrap--main-dev--0--patch-2'

bzr 1.5 on python 2.5.1 (linux2)
arguments: ['/usr/bin/bzr', 'log']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.utf8'
plugins:
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.
(gc clutter g-wrap ggo guile) wingo@unquote:~/src/g-wrap/mainline$ bzr info
Repository tree (format: dirstate-tags)
Location:
  shared repository: /home/wingo/src/g-wrap
  repository branch: .

Related branches:
  parent branch: http://bazaar.launchpad.net/%7Erotty/g-wrap/dev/
  submit branch: /home/wingo/src/g-wrap/wingo

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

So... 1.5.2 has a nice error because it fails while building "revision_history", and it raises the exact revision which fails.
What is happening in "topo_sort()" is that it is getting a node with "no" parents.

So... What is happening is that the first revision in "branch.revision_history()" is actually a ghost. It is present because we are able to reference it. The revno 2 references a revision, we just can't get to it.

The loop that is actually failing is a bit outdated, as it is trying to handle when "revision_history" isn't the pure left-hand-only graph. So I'm tempted not to try too hard to get it all working, and just "skip" when this happens.

The attached patch fixes it for me.

Changed in bzr:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Andy Wingo (andywingo) wrote :

Thanks for the patch! Is it correct enough to commit?

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

It would need a test case written before I would consider merging it. I don't have time right now to work on one, but otherwise I think the fix is mergeable.

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

So I went ahead and wrote a test for this case, and it should be merged into bzr.dev 3535

Changed in bzr:
assignee: nobody → jameinel
milestone: none → 1.6
status: Triaged → Fix Released
Revision history for this message
Andy Wingo (andywingo) wrote :

Works for me. Thanks!

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.