cat -r 1 PATH picks wrong fileid when PATH in revision1 has a different file id to PATH in the working tree

Bug #164395 reported by Mathias De Belder
4
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned
Breezy
Fix Released
Undecided
Unassigned

Bug Description

mathias@merean:~ > mkdir foo && cd foo
mathias@merean:~/foo > bzr --version && bzr init
Bazaar (bzr) 0.92.0
  Python interpreter: /usr/bin/python 2.4.4.final.0
  Python standard library: /usr/pkg/lib/python2.4
  bzrlib: /opt/bzr/lib/python2.4/site-packages/bzrlib

mathias@merean:~/foo > bzr mkdir bar
added bar
mathias@merean:~/foo > echo 'a'>bar/baz
mathias@merean:~/foo > bzr add bar/baz
added bar/baz
mathias@merean:~/foo > bzr ci -m'Added baz'
Committing revision 1 to "/home/mathias/foo/".
added bar
added bar/baz
Committed revision 1.
mathias@merean:~/foo > bzr rm bar
deleted bar/baz
deleted bar
mathias@merean:~/foo > bzr ci -m'Removed bar'
Committing revision 2 to "/home/mathias/foo/".
deleted bar
deleted bar/baz
Committed revision 2.
mathias@merean:~/foo > bzr mkdir bar
added bar
mathias@merean:~/foo > echo 'b'>bar/baz
mathias@merean:~/foo > bzr add bar/baz
added bar/baz

mathias@merean:~/foo > bzr ci -m'Added baz again' bar/baz
Committing revision 3 to "/home/mathias/foo/".
added bar
added bar/baz
Committed revision 3.

mathias@merean:~/foo > bzr cat -r1 bar/baz
bzr: ERROR: The file id "baz-20071121195029-sf17yppaiamx4ul0-1" is not present in the tree <Inventory object at 861a2ac, contents={'bar-20071121194931-1hkhbeykywwxmvhz-1': InventoryDirectory('bar-20071121194931-1hkhbeykywwxmvhz-1', 'bar', parent_id='TREE_ROOT', <email address hidden>'), 'baz-20071121194944-ypbqg5bh6okxs8fc-1': InventoryFile('baz-20071121194944-ypbqg5bh6okxs8fc-1', 'baz', parent_id='bar-20071121194931-1hkhbeykywwxmvhz-1', sha1='3f786850e387550fdab836ed7e6dc881de23001b', len=2), 'TREE_ROOT': InventoryDirectory('TREE_ROOT', u'', parent_id=None, <email address hidden>')}>.

~/.bzr.log contains the following:
bzr arguments: [u'cat', u'-r1', u'bar/baz']
looking for plugins in /home/mathias/.bazaar/plugins
looking for plugins in /opt/bzr/lib/python2.4/site-packages/bzrlib/plugins
Plugin name __init__ already loaded
Plugin name __init__ already loaded
WARNING: using slower ElementTree; consider installing cElementTree and make sure it's on your PYTHONPATH
opening working tree '/home/mathias/foo'
Traceback (most recent call last):
  File "/opt/bzr/lib/python2.4/site-packages/bzrlib/commands.py", line 802, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/opt/bzr/lib/python2.4/site-packages/bzrlib/commands.py", line 758, in run_bzr
    ret = run(*run_argv)
  File "/opt/bzr/lib/python2.4/site-packages/bzrlib/commands.py", line 492, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/opt/bzr/lib/python2.4/site-packages/bzrlib/commands.py", line 768, in ignore_pipe
    result = func(*args, **kwargs)
  File "/opt/bzr/lib/python2.4/site-packages/bzrlib/builtins.py", line 2139, in run
    rev_tree.print_file(cur_file_id)
  File "/opt/bzr/lib/python2.4/site-packages/bzrlib/tree.py", line 356, in print_file
    sys.stdout.write(self.get_file_text(file_id))
  File "/opt/bzr/lib/python2.4/site-packages/bzrlib/revisiontree.py", line 79, in get_file_text
    return ''.join(self.get_file_lines(file_id))
  File "/opt/bzr/lib/python2.4/site-packages/bzrlib/revisiontree.py", line 74, in get_file_lines
    ie = self._inventory[file_id]
  File "/opt/bzr/lib/python2.4/site-packages/bzrlib/inventory.py", line 1148, in __getitem__
    raise errors.NoSuchId(self, file_id)
NoSuchId: The file id "baz-20071121195029-sf17yppaiamx4ul0-1" is not present in the tree <Inventory object at 861a2ac, contents={'bar-20071121194931-1hkhbeykywwxmvhz-1': InventoryDirectory('bar-20071121194931-1hkhbeykywwxmvhz-1', 'bar', parent_id='TREE_ROOT', <email address hidden>'), 'baz-20071121194944-ypbqg5bh6okxs8fc-1': InventoryFile('baz-20071121194944-ypbqg5bh6okxs8fc-1', 'baz', parent_id='bar-20071121194931-1hkhbeykywwxmvhz-1', sha1='3f786850e387550fdab836ed7e6dc881de23001b', len=2), 'TREE_ROOT': InventoryDirectory('TREE_ROOT', u'', parent_id=None, <email address hidden>')}>.

return code 3

Tags: ui
Changed in bzr:
importance: Undecided → Medium
status: New → Triaged
Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
John A Meinel (jameinel)
description: updated
Jelmer Vernooij (jelmer)
tags: added: ui
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
Changed in brz:
status: New → Fix Released
tags: removed: check-for-breezy
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.