/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

  • Committer: Vincent Ladeuil
  • Date: 2012-01-18 14:09:19 UTC
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120118140919-rlvdrhpc0nq1lbwi
Change set/remove to require a lock for the branch config files.

This means that tests (or any plugin for that matter) do not requires an
explicit lock on the branch anymore to change a single option. This also
means the optimisation becomes "opt-in" and as such won't be as
spectacular as it may be and/or harder to get right (nothing fails
anymore).

This reduces the diff by ~300 lines.

Code/tests that were updating more than one config option is still taking
a lock to at least avoid some IOs and demonstrate the benefits through
the decreased number of hpss calls.

The duplication between BranchStack and BranchOnlyStack will be removed
once the same sharing is in place for local config files, at which point
the Stack class itself may be able to host the changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    CURRENT_REVISION,
48
48
    Revision,
49
49
    )
 
50
from bzrlib.symbol_versioning import (
 
51
    deprecated_function,
 
52
    deprecated_in,
 
53
    )
 
54
 
 
55
 
 
56
@deprecated_function(deprecated_in((2, 4, 0)))
 
57
def annotate_file(branch, rev_id, file_id, verbose=False, full=False,
 
58
                  to_file=None, show_ids=False):
 
59
    """Annotate file_id at revision rev_id in branch.
 
60
 
 
61
    The branch should already be read_locked() when annotate_file is called.
 
62
 
 
63
    :param branch: The branch to look for revision numbers and history from.
 
64
    :param rev_id: The revision id to annotate.
 
65
    :param file_id: The file_id to annotate.
 
66
    :param verbose: Show all details rather than truncating to ensure
 
67
        reasonable text width.
 
68
    :param full: XXXX Not sure what this does.
 
69
    :param to_file: The file to output the annotation to; if None stdout is
 
70
        used.
 
71
    :param show_ids: Show revision ids in the annotation output.
 
72
    """
 
73
    tree = branch.repository.revision_tree(rev_id)
 
74
    annotate_file_tree(tree, file_id, to_file, verbose=verbose,
 
75
        full=full, show_ids=show_ids, branch=branch)
50
76
 
51
77
 
52
78
def annotate_file_tree(tree, file_id, to_file, verbose=False, full=False,