57
57
from bzrlib.commands import Command, display_command
58
from bzrlib.option import ListOption, Option, RegistryOption, custom_help
58
from bzrlib.option import (
59
65
from bzrlib.trace import mutter, note, warning, is_quiet, get_verbosity_level
1967
1973
'bzr %s --revision takes one or two values.' % command_name)
1968
1974
return rev1, rev2
1977
def _revision_range_to_revid_range(revision_range):
1980
if revision_range[0] is not None:
1981
rev_id1 = revision_range[0].rev_id
1982
if revision_range[1] is not None:
1983
rev_id2 = revision_range[1].rev_id
1984
return rev_id1, rev_id2
1970
1986
def get_log_format(long=False, short=False, line=False, default='long'):
1971
1987
log_format = default
3513
3529
class cmd_missing(Command):
3514
3530
"""Show unmerged/unpulled revisions between two branches.
3516
3532
OTHER_BRANCH may be local or remote.
3534
To filter on a range of revirions, you can use the command -r begin..end
3535
-r revision requests a specific revision, -r ..end or -r begin.. are
3540
Determine the missing revisions between this and the branch at the
3541
remembered pull location::
3545
Determine the missing revisions between this and another branch::
3547
bzr missing http://server/branch
3549
Determine the missing revisions up to a specific revision on the other
3552
bzr missing -r ..-10
3554
Determine the missing revisions up to a specific revision on this
3557
bzr missing --my-revision ..-10
3519
3560
_see_also = ['merge', 'pull']
3520
3561
takes_args = ['other_branch?']
3521
3562
takes_options = [
3522
Option('reverse', 'Reverse the order of revisions.'),
3524
'Display changes in the local branch only.'),
3525
Option('this' , 'Same as --mine-only.'),
3526
Option('theirs-only',
3527
'Display changes in the remote branch only.'),
3528
Option('other', 'Same as --theirs-only.'),
3532
Option('include-merges', 'Show merged revisions.'),
3563
Option('reverse', 'Reverse the order of revisions.'),
3565
'Display changes in the local branch only.'),
3566
Option('this' , 'Same as --mine-only.'),
3567
Option('theirs-only',
3568
'Display changes in the remote branch only.'),
3569
Option('other', 'Same as --theirs-only.'),
3573
custom_help('revision',
3574
help='Filter on other branch revisions (inclusive). '
3575
'See "help revisionspec" for details.'),
3576
Option('my-revision',
3577
type=_parse_revision_str,
3578
help='Filter on local branch revisions (inclusive). '
3579
'See "help revisionspec" for details.'),
3580
Option('include-merges', 'Show merged revisions.'),
3534
3582
encoding_type = 'replace'
3536
3584
@display_command
3538
3586
theirs_only=False,
3539
3587
log_format=None, long=False, short=False, line=False,
3540
3588
show_ids=False, verbose=False, this=False, other=False,
3541
include_merges=False):
3589
include_merges=False, revision=None, my_revision=None):
3542
3590
from bzrlib.missing import find_unmerged, iter_log_revisions
3543
3591
def message(s):
3544
3592
if not is_quiet():
3572
3620
remote_branch = Branch.open(other_branch)
3573
3621
if remote_branch.base == local_branch.base:
3574
3622
remote_branch = local_branch
3624
local_revid_range = _revision_range_to_revid_range(
3625
_get_revision_range(my_revision, local_branch,
3628
remote_revid_range = _revision_range_to_revid_range(
3629
_get_revision_range(revision,
3630
remote_branch, self.name()))
3575
3632
local_branch.lock_read()
3577
3634
remote_branch.lock_read()
3579
3636
local_extra, remote_extra = find_unmerged(
3580
3637
local_branch, remote_branch, restrict,
3581
3638
backward=not reverse,
3582
include_merges=include_merges)
3639
include_merges=include_merges,
3640
local_revid_range=local_revid_range,
3641
remote_revid_range=remote_revid_range)
3584
3643
if log_format is None:
3585
3644
registry = log.log_formatter_registry
4716
4775
revid1, revid2 = rev1.rev_id, rev2.rev_id
4717
4776
# only show revisions between revid1 and revid2 (inclusive)
4718
4777
tags = [(tag, revid) for tag, revid in tags if
4720
graph.is_ancestor(revid, revid2)) and
4722
graph.is_ancestor(revid1, revid))]
4778
graph.is_between(revid, revid1, revid2)]
4724
4780
branch.unlock()
4725
4781
if sort == 'alpha':