~loggerhead-team/loggerhead/experimental

« back to all changes in this revision

Viewing changes to loggerhead/history.py

  • Committer: John Arbash Meinel
  • Date: 2011-04-11 14:55:55 UTC
  • mfrom: (419.2.26 loggerhead)
  • Revision ID: john@arbash-meinel.com-20110411145555-7xflzcipb32kuknh
Merge trunk into the history-db branch.

We had to disable the mainline tests, because they were monkey-patching
a parameter that we have removed. We need to figure out a way to
do a similar test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
from bzrlib import (
38
38
    graph,
39
39
    lru_cache,
 
40
    tag,
40
41
    )
41
42
import bzrlib.branch
42
43
import bzrlib.delta
328
329
                yield revid
329
330
            return
330
331
        revid_set = set(revid_list)
331
 
 
332
332
        # TODO: We need tests for when start_revid != self.last_revision
333
333
        # TODO: The one thing that could be improved here, is to have a query
334
334
        #       that can be resolved incrementally. At the moment, this grabs
418
418
            revlist = self.get_revids_from(None, revid)
419
419
        return revlist
420
420
 
421
 
    def _iterate_sufficiently(self, iterable, stop_at, extra_rev_count):
 
421
    @staticmethod
 
422
    def _iterate_sufficiently(iterable, stop_at, extra_rev_count):
422
423
        """Return a list of iterable.
423
424
 
424
425
        If extra_rev_count is None, fully consume iterable.
438
439
                break
439
440
        if found:
440
441
            for count, n in enumerate(iterable):
441
 
                result.append(n)
442
442
                if count >= extra_rev_count:
443
443
                    break
 
444
                result.append(n)
444
445
        return result
445
446
 
446
447
    def get_view(self, revid, start_revid, file_id, query=None,
658
659
 
659
660
        revtags = None
660
661
        if revision.revision_id in self._branch_tags:
661
 
          revtags = ', '.join(self._branch_tags[revision.revision_id])
 
662
          # tag.sort_* functions expect (tag, data) pairs, so we generate them,
 
663
          # and then strip them
 
664
          tags = [(t, None) for t in self._branch_tags[revision.revision_id]]
 
665
          sort_func = getattr(tag, 'sort_natural', None)
 
666
          if sort_func is None:
 
667
              tags.sort()
 
668
          else:
 
669
              sort_func(self._branch, tags)
 
670
          revtags = u', '.join([t[0] for t in tags])
662
671
 
663
672
        entry = {
664
673
            'revid': revision.revision_id,
665
674
            'date': datetime.datetime.fromtimestamp(revision.timestamp),
666
675
            'utc_date': datetime.datetime.utcfromtimestamp(revision.timestamp),
 
676
            'committer': revision.committer,
667
677
            'authors': revision.get_apparent_authors(),
668
678
            'branch_nick': revision.properties.get('branch-nick', None),
669
679
            'short_comment': short_message,
674
684
            'tags': revtags,
675
685
        }
676
686
        if isinstance(revision, bzrlib.foreign.ForeignRevision):
677
 
            foreign_revid, mapping = (revision.foreign_revid, revision.mapping)
 
687
            foreign_revid, mapping = (
 
688
                revision.foreign_revid, revision.mapping)
678
689
        elif ":" in revision.revision_id:
679
690
            try:
680
691
                foreign_revid, mapping = \