454
454
if revid is None:
455
455
revid = self.last_revid
456
456
if file_id is not None:
457
# since revid is 'start_revid', possibly should start the path
458
# tracing from revid... FIXME
459
revlist = list(self.get_short_revision_history_by_fileid(file_id))
460
revlist = list(self.get_revids_from(revlist, revid))
458
self.get_short_revision_history_by_fileid(file_id, revid))
459
revlist = self.get_revids_from(revlist, revid)
462
revlist = list(self.get_revids_from(None, revid))
461
revlist = self.get_revids_from(None, revid)
465
def get_view(self, revid, start_revid, file_id, query=None):
464
def _iterate_sufficiently(self, iterable, stop_at, extra_rev_count):
465
"""Return a list of iterable.
467
If extra_rev_count is None, fully consume iterable.
468
Otherwise, stop at 'stop_at' + extra_rev_count.
471
iterate until you find stop_at, then iterate 10 more times.
473
if extra_rev_count is None:
474
return list(iterable)
483
for count, n in enumerate(iterable):
485
if count >= extra_rev_count:
489
def get_view(self, revid, start_revid, file_id, query=None,
490
extra_rev_count=None):
467
492
use the URL parameters (revid, start_revid, file_id, and query) to
468
493
determine the revision list we're viewing (start_revid, file_id, query)
474
499
- if a start_revid is given, we're viewing the branch from a
475
500
specific revision up the tree.
501
- if extra_rev_count is given, find the view from start_revid =>
502
revid, and continue an additional 'extra_rev_count'. If not
503
given, then revid_list will contain the full history of
477
506
these may be combined to view revisions for a specific file, from
478
507
a specific revision, with a specific search query.
492
521
if query is None:
493
522
revid_list = self.get_file_view(start_revid, file_id)
523
revid_list = self._iterate_sufficiently(revid_list, revid,
494
525
if revid is None:
495
526
revid = start_revid
496
527
if revid not in revid_list:
497
528
# if the given revid is not in the revlist, use a revlist that
498
529
# starts at the given revid.
499
530
revid_list = self.get_file_view(revid, file_id)
531
revid_list = self._iterate_sufficiently(revid_list, revid,
500
533
start_revid = revid
501
534
return revid, start_revid, revid_list