57
57
from bzrlib.commands import Command, display_command
58
from bzrlib.option import (
58
from bzrlib.option import ListOption, Option, RegistryOption, custom_help
65
59
from bzrlib.trace import mutter, note, warning, is_quiet, get_verbosity_level
1919
1895
tree, b, fp = bzrdir.BzrDir.open_containing_tree_or_branch(
1922
file_id = _get_fileid_to_log(revision, tree, b, fp)
1899
tree = b.basis_tree()
1900
file_id = tree.path2id(fp)
1923
1901
if file_id is None:
1924
1902
raise errors.BzrCommandError(
1925
"Path unknown at end or start of revision range: %s" %
1903
"Path does not have any revision history: %s" %
1928
1906
# local dir only
1987
1962
'bzr %s --revision takes one or two values.' % command_name)
1988
1963
return rev1, rev2
1991
def _revision_range_to_revid_range(revision_range):
1994
if revision_range[0] is not None:
1995
rev_id1 = revision_range[0].rev_id
1996
if revision_range[1] is not None:
1997
rev_id2 = revision_range[1].rev_id
1998
return rev_id1, rev_id2
2000
1965
def get_log_format(long=False, short=False, line=False, default='long'):
2001
1966
log_format = default
3543
3508
class cmd_missing(Command):
3544
3509
"""Show unmerged/unpulled revisions between two branches.
3546
3511
OTHER_BRANCH may be local or remote.
3548
To filter on a range of revirions, you can use the command -r begin..end
3549
-r revision requests a specific revision, -r ..end or -r begin.. are
3554
Determine the missing revisions between this and the branch at the
3555
remembered pull location::
3559
Determine the missing revisions between this and another branch::
3561
bzr missing http://server/branch
3563
Determine the missing revisions up to a specific revision on the other
3566
bzr missing -r ..-10
3568
Determine the missing revisions up to a specific revision on this
3571
bzr missing --my-revision ..-10
3574
3514
_see_also = ['merge', 'pull']
3575
3515
takes_args = ['other_branch?']
3576
3516
takes_options = [
3577
Option('reverse', 'Reverse the order of revisions.'),
3579
'Display changes in the local branch only.'),
3580
Option('this' , 'Same as --mine-only.'),
3581
Option('theirs-only',
3582
'Display changes in the remote branch only.'),
3583
Option('other', 'Same as --theirs-only.'),
3587
custom_help('revision',
3588
help='Filter on other branch revisions (inclusive). '
3589
'See "help revisionspec" for details.'),
3590
Option('my-revision',
3591
type=_parse_revision_str,
3592
help='Filter on local branch revisions (inclusive). '
3593
'See "help revisionspec" for details.'),
3594
Option('include-merges', 'Show merged revisions.'),
3517
Option('reverse', 'Reverse the order of revisions.'),
3519
'Display changes in the local branch only.'),
3520
Option('this' , 'Same as --mine-only.'),
3521
Option('theirs-only',
3522
'Display changes in the remote branch only.'),
3523
Option('other', 'Same as --theirs-only.'),
3527
Option('include-merges', 'Show merged revisions.'),
3596
3529
encoding_type = 'replace'
3598
3531
@display_command
3600
3533
theirs_only=False,
3601
3534
log_format=None, long=False, short=False, line=False,
3602
3535
show_ids=False, verbose=False, this=False, other=False,
3603
include_merges=False, revision=None, my_revision=None):
3536
include_merges=False):
3604
3537
from bzrlib.missing import find_unmerged, iter_log_revisions
3605
3538
def message(s):
3606
3539
if not is_quiet():
3634
3567
remote_branch = Branch.open(other_branch)
3635
3568
if remote_branch.base == local_branch.base:
3636
3569
remote_branch = local_branch
3638
local_revid_range = _revision_range_to_revid_range(
3639
_get_revision_range(my_revision, local_branch,
3642
remote_revid_range = _revision_range_to_revid_range(
3643
_get_revision_range(revision,
3644
remote_branch, self.name()))
3646
3570
local_branch.lock_read()
3648
3572
remote_branch.lock_read()
3650
3574
local_extra, remote_extra = find_unmerged(
3651
3575
local_branch, remote_branch, restrict,
3652
3576
backward=not reverse,
3653
include_merges=include_merges,
3654
local_revid_range=local_revid_range,
3655
remote_revid_range=remote_revid_range)
3577
include_merges=include_merges)
3657
3579
if log_format is None:
3658
3580
registry = log.log_formatter_registry
4789
4711
revid1, revid2 = rev1.rev_id, rev2.rev_id
4790
4712
# only show revisions between revid1 and revid2 (inclusive)
4791
4713
tags = [(tag, revid) for tag, revid in tags if
4792
graph.is_between(revid, revid1, revid2)]
4715
graph.is_ancestor(revid, revid2)) and
4717
graph.is_ancestor(revid1, revid))]
4794
4719
branch.unlock()
4795
4720
if sort == 'alpha':