~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Marius Kruger
  • Date: 2009-01-01 11:06:37 UTC
  • mto: (3969.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3970.
  • Revision ID: amanic@gmail.com-20090101110637-t6d0xytq2gyiquji
add support to filter on local and remote revisions

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    )
50
50
from bzrlib.branch import Branch
51
51
from bzrlib.conflicts import ConflictList
 
52
from bzrlib.option import _parse_revision_str
52
53
from bzrlib.revisionspec import RevisionSpec
53
54
from bzrlib.smtp_connection import SMTPConnection
54
55
from bzrlib.workingtree import WorkingTree
1895
1896
            'bzr %s --revision takes one or two values.' % command_name)
1896
1897
    return rev1, rev2
1897
1898
 
 
1899
 
 
1900
def _revision_range_to_revid_range(revision_range):
 
1901
    rev_id1 = None
 
1902
    rev_id2 = None
 
1903
    if revision_range[0] is not None:
 
1904
        rev_id1 = revision_range[0].rev_id
 
1905
    if revision_range[1] is not None:
 
1906
        rev_id2 = revision_range[1].rev_id
 
1907
    return rev_id1, rev_id2
 
1908
 
1898
1909
def get_log_format(long=False, short=False, line=False, default='long'):
1899
1910
    log_format = default
1900
1911
    if long:
3457
3468
            'log-format',
3458
3469
            'show-ids',
3459
3470
            'verbose',
3460
 
            'revision',
 
3471
             custom_help('revision',
 
3472
                 help='Filter on local branch revisions. '
 
3473
                    'See "help revisionspec" for details.'),
 
3474
             Option('other-revision',
 
3475
               type=_parse_revision_str,
 
3476
               short_name='o',
 
3477
               help='Filter on other branch revisions. '
 
3478
                'See "help revisionspec" for details.'),
3461
3479
            Option('include-merges', 'Show merged revisions.'),
3462
3480
            ]
3463
3481
    encoding_type = 'replace'
3467
3485
            theirs_only=False,
3468
3486
            log_format=None, long=False, short=False, line=False,
3469
3487
            show_ids=False, verbose=False, this=False, other=False,
3470
 
            include_merges=False, revision=None):
 
3488
            include_merges=False, revision=None, other_revision=None):
3471
3489
        from bzrlib.missing import find_unmerged, iter_log_revisions
3472
3490
        def message(s):
3473
3491
            if not is_quiet():
3501
3519
        remote_branch = Branch.open(other_branch)
3502
3520
        if remote_branch.base == local_branch.base:
3503
3521
            remote_branch = local_branch
3504
 
                
3505
 
        revisionid_range = [None, None]
3506
 
        if revision is not None:
3507
 
            for i, rev in enumerate(revision):
3508
 
                branch = revision_specs[i].get_branch()
3509
 
                if branch == None:
3510
 
                    branch = local_branch
3511
 
                revisionid_range[i] = revision_specs[i].as_revision_id(branch)
 
3522
 
 
3523
        local_revid_range = _revision_range_to_revid_range(
 
3524
            _get_revision_range(revision, local_branch,
 
3525
                self.name()))#Todo singlerev_mode='right' 
 
3526
 
 
3527
        remote_revid_range = _revision_range_to_revid_range(
 
3528
            _get_revision_range(other_revision,
 
3529
                remote_branch, self.name()))#Todo singlerev_mode='right' 
 
3530
 
3512
3531
        local_branch.lock_read()
3513
3532
        try:
3514
3533
            remote_branch.lock_read()
3517
3536
                    local_branch, remote_branch, restrict,
3518
3537
                    backward=not reverse,
3519
3538
                    include_merges=include_merges,
3520
 
                    revid_range=revisionid_range)
 
3539
                    local_revid_range=local_revid_range,
 
3540
                    remote_revid_range= remote_revid_range)
3521
3541
 
3522
3542
                if log_format is None:
3523
3543
                    registry = log.log_formatter_registry