/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 breezy/plugins/git/tree.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-05-22 21:17:06 UTC
  • mfrom: (6973.2.1 revtree-annotate)
  • Revision ID: breezy.the.bot@gmail.com-20180522211706-p4o37yfqdf5ds7ds
Implement GitRevisionTree.annotate_iter.

Merged from https://code.launchpad.net/~jelmer/brz/revtree-annotate/+merge/346658

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
    tree as _mod_tree,
56
56
    workingtree,
57
57
    )
58
 
from ...revision import NULL_REVISION
 
58
from ...revision import (
 
59
    CURRENT_REVISION,
 
60
    NULL_REVISION,
 
61
    )
59
62
 
60
63
from .mapping import (
61
64
    mode_is_executable,
574
577
        return self.store.iter_tree_contents(
575
578
                self.tree, include_trees=include_trees)
576
579
 
 
580
    def annotate_iter(self, path, file_id=None,
 
581
                      default_revision=CURRENT_REVISION):
 
582
        """Return an iterator of revision_id, line tuples.
 
583
 
 
584
        For working trees (and mutable trees in general), the special
 
585
        revision_id 'current:' will be used for lines that are new in this
 
586
        tree, e.g. uncommitted changes.
 
587
        :param file_id: The file to produce an annotated version from
 
588
        :param default_revision: For lines that don't match a basis, mark them
 
589
            with this revision id. Not all implementations will make use of
 
590
            this value.
 
591
        """
 
592
        with self.lock_read():
 
593
            # Now we have the parents of this content
 
594
            from breezy.annotate import Annotator
 
595
            from .annotate import AnnotateProvider
 
596
            annotator = Annotator(AnnotateProvider(
 
597
                self._repository._file_change_scanner))
 
598
            this_key = (path, self.get_file_revision(path))
 
599
            annotations = [(key[-1], line)
 
600
                           for key, line in annotator.annotate_flat(this_key)]
 
601
            return annotations
 
602
 
577
603
 
578
604
def tree_delta_from_git_changes(changes, mapping,
579
605
        fileid_maps, specific_files=None,