1
# Copyright (C) 2006-2011 Canonical Ltd.
2
# Copyright (C) 2008, 2009 Canonical Ltd.
2
3
# (Authored by Martin Albisetti <argentina@gmail.com>)
3
4
# Copyright (C) 2006 Robey Pointer <robey@lag.net>
4
5
# Copyright (C) 2006 Goffredo Baroncelli <kreijack@inwind.it>
351
350
r.add(self._rev_info[i][0][1])
355
354
if bzrlib.revision.is_null(revid):
357
rev_introduced = introduced_revisions(revid)
358
matching = rev_introduced.intersection(revid_set)
360
# We don't need to look for these anymore.
361
revid_set.difference_update(matching)
356
if introduced_revisions(revid) & revid_set:
363
358
parents = self._rev_info[self._rev_indices[revid]][2]
364
359
if len(parents) == 0:
479
474
if revid is None:
480
475
revid = self.last_revid
481
476
if file_id is not None:
483
self.get_short_revision_history_by_fileid(file_id))
484
revlist = self.get_revids_from(revlist, revid)
477
# since revid is 'start_revid', possibly should start the path
478
# tracing from revid... FIXME
479
revlist = list(self.get_short_revision_history_by_fileid(file_id))
480
revlist = list(self.get_revids_from(revlist, revid))
486
revlist = self.get_revids_from(None, revid)
482
revlist = list(self.get_revids_from(None, revid))
490
def _iterate_sufficiently(iterable, stop_at, extra_rev_count):
491
"""Return a list of iterable.
493
If extra_rev_count is None, fully consume iterable.
494
Otherwise, stop at 'stop_at' + extra_rev_count.
497
iterate until you find stop_at, then iterate 10 more times.
499
if extra_rev_count is None:
500
return list(iterable)
509
for count, n in enumerate(iterable):
510
if count >= extra_rev_count:
515
def get_view(self, revid, start_revid, file_id, query=None,
516
extra_rev_count=None):
485
def get_view(self, revid, start_revid, file_id, query=None):
518
487
use the URL parameters (revid, start_revid, file_id, and query) to
519
488
determine the revision list we're viewing (start_revid, file_id, query)
525
494
- if a start_revid is given, we're viewing the branch from a
526
495
specific revision up the tree.
527
- if extra_rev_count is given, find the view from start_revid =>
528
revid, and continue an additional 'extra_rev_count'. If not
529
given, then revid_list will contain the full history of
532
497
these may be combined to view revisions for a specific file, from
533
498
a specific revision, with a specific search query.
547
512
if query is None:
548
513
revid_list = self.get_file_view(start_revid, file_id)
549
revid_list = self._iterate_sufficiently(revid_list, revid,
551
514
if revid is None:
552
515
revid = start_revid
553
516
if revid not in revid_list:
554
517
# if the given revid is not in the revlist, use a revlist that
555
518
# starts at the given revid.
556
519
revid_list = self.get_file_view(revid, file_id)
557
revid_list = self._iterate_sufficiently(revid_list, revid,
559
520
start_revid = revid
560
521
return revid, start_revid, revid_list
722
683
# tag.sort_* functions expect (tag, data) pairs, so we generate them,
723
684
# and then strip them
724
685
tags = [(t, None) for t in self._branch_tags[revision.revision_id]]
725
sort_func = getattr(tag, 'sort_natural', None)
726
if sort_func is None:
729
sort_func(self._branch, tags)
686
tag.sort_natural(self._branch, tags)
730
687
revtags = u', '.join([t[0] for t in tags])
746
703
if isinstance(revision, bzrlib.foreign.ForeignRevision):
747
foreign_revid, mapping = (
748
revision.foreign_revid, revision.mapping)
704
foreign_revid, mapping = (rev.foreign_revid, rev.mapping)
749
705
elif ":" in revision.revision_id:
751
707
foreign_revid, mapping = \
818
774
renamed=sorted(reporter.renamed, key=lambda x: x.new_filename),
819
775
removed=sorted(reporter.removed, key=lambda x: x.filename),
820
776
modified=sorted(reporter.modified, key=lambda x: x.filename),
821
text_changes=sorted(reporter.text_changes,
822
key=lambda x: x.filename))
777
text_changes=sorted(reporter.text_changes, key=lambda x: x.filename))