~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Ian Clatworthy
  • Date: 2009-01-15 22:51:27 UTC
  • mfrom: (3940.1.5 bzr.log-short-file-fix)
  • mto: This revision was merged to the branch mainline in revision 3943.
  • Revision ID: ian.clatworthy@canonical.com-20090115225127-hbl4j2cgoy7zu2oz
Fix log --short/--line FILE (Ian Clatworthy)

Show diffs side-by-side

added added

removed removed

Lines of Context:
251
251
            raise errors.BzrCommandError('Selected log formatter only supports'
252
252
                ' mainline revisions.')
253
253
        generate_merge_revisions = generate_single_revision
 
254
    include_merges = generate_merge_revisions or specific_fileid
254
255
    view_revs_iter = get_view_revisions(mainline_revs, rev_nos, branch,
255
 
                          direction, include_merges=generate_merge_revisions)
 
256
                          direction, include_merges=include_merges)
256
257
 
257
258
    if direction == 'reverse':
258
259
        start_rev_id, end_rev_id = end_rev_id, start_rev_id
263
264
        view_revisions = view_revisions[0:1]
264
265
    if specific_fileid:
265
266
        view_revisions = _filter_revisions_touching_file_id(branch,
266
 
                                                            specific_fileid,
267
 
                                                            view_revisions)
 
267
            specific_fileid, view_revisions,
 
268
            include_merges=generate_merge_revisions)
268
269
 
269
270
    # rebase merge_depth - unless there are no revisions or 
270
271
    # either the first or last revision have merge_depth = 0.
532
533
    return view_revisions
533
534
 
534
535
 
535
 
def _filter_revisions_touching_file_id(branch, file_id, view_revisions):
 
536
def _filter_revisions_touching_file_id(branch, file_id, view_revisions,
 
537
    include_merges=True):
536
538
    r"""Return the list of revision ids which touch a given file id.
537
539
 
538
540
    The function filters view_revisions and returns a subset.
565
567
        assumed that view_revisions is in merge_sort order (i.e. newest
566
568
        revision first ).
567
569
 
 
570
    :param include_merges: include merge revisions in the result or not
 
571
 
568
572
    :return: A list of (revision_id, dotted_revno, merge_depth) tuples.
569
573
    """
570
574
    # Lookup all possible text keys to determine which ones actually modified
604
608
            for idx in xrange(len(current_merge_stack)):
605
609
                node = current_merge_stack[idx]
606
610
                if node is not None:
607
 
                    result.append(node)
608
 
                    current_merge_stack[idx] = None
 
611
                    if include_merges or node[2] == 0:
 
612
                        result.append(node)
 
613
                        current_merge_stack[idx] = None
609
614
    return result
610
615
 
611
616