~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

(andrew) Fix ObjectNotLocked error when doing 'bzr annotate -r
        branch:...' (#496590)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4409
4409
            branch.lock_read()
4410
4410
        try:
4411
4411
            tree = _get_one_revision_tree('annotate', revision, branch=branch)
4412
 
            if wt is not None:
4413
 
                file_id = wt.path2id(relpath)
4414
 
            else:
4415
 
                file_id = tree.path2id(relpath)
4416
 
            if file_id is None:
4417
 
                raise errors.NotVersionedError(filename)
4418
 
            file_version = tree.inventory[file_id].revision
4419
 
            if wt is not None and revision is None:
4420
 
                # If there is a tree and we're not annotating historical
4421
 
                # versions, annotate the working tree's content.
4422
 
                annotate_file_tree(wt, file_id, self.outf, long, all,
4423
 
                    show_ids=show_ids)
4424
 
            else:
4425
 
                annotate_file(branch, file_version, file_id, long, all, self.outf,
4426
 
                              show_ids=show_ids)
 
4412
            tree.lock_read()
 
4413
            try:
 
4414
                if wt is not None:
 
4415
                    file_id = wt.path2id(relpath)
 
4416
                else:
 
4417
                    file_id = tree.path2id(relpath)
 
4418
                if file_id is None:
 
4419
                    raise errors.NotVersionedError(filename)
 
4420
                file_version = tree.inventory[file_id].revision
 
4421
                if wt is not None and revision is None:
 
4422
                    # If there is a tree and we're not annotating historical
 
4423
                    # versions, annotate the working tree's content.
 
4424
                    annotate_file_tree(wt, file_id, self.outf, long, all,
 
4425
                        show_ids=show_ids)
 
4426
                else:
 
4427
                    annotate_file(branch, file_version, file_id, long, all,
 
4428
                        self.outf, show_ids=show_ids)
 
4429
            finally:
 
4430
                tree.unlock()
4427
4431
        finally:
4428
4432
            if wt is not None:
4429
4433
                wt.unlock()