bzr version-info --all does not work for bare repositories in 2.6

Bug #1414968 reported by eblade
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
New
Undecided
Unassigned

Bug Description

The bug happens only when running version-info with the --all flag, on a bare repository, not a checkout.

In bzrlib/version_info_formats/__init__.py, line 82 in version 2.6 and forwards (maybe also back a bit), in the __init__ method, there is an if statement:

if self._revision_id is None:
            self._tree = working_tree
            self._working_tree = working_tree
        else:
            self._tree = self._branch.repository.revision_tree(self._revision_id)
            # the working tree is not relevant if an explicit revision was specified
            self._working_tree = None

This will, if both self._revision_id and working_tree is None, result in both self._tree and self._working_tree being None. Further down, in _extract_file_revisions, this will be leathal:

if self._working_tree is self._tree:
            basis_tree = self._working_tree.basis_tree() # <--- self._working_tree is None!!!
            # TODO: jam 20070215 The working tree should actually be locked at
            # a higher level, but this will do for now.
            self._working_tree.lock_read()
        else:
            basis_tree = self._branch.repository.revision_tree(self._revision_id)

However, if the first if statement is changed to this:

if self._revision_id is None and working_tree is not None:
            self._tree = working_tree
            self._working_tree = working_tree
        else:
            self._tree = self._branch.repository.revision_tree(self._revision_id)
            # the working tree is not relevant if an explicit revision was specified
            self._working_tree = None

Then self._tree will be taken from the branch instead and things seems to be fine.

Jelmer Vernooij (jelmer)
tags: added: 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.