1751
1756
class cmd_missing(Command):
1752
"""What is missing in this branch relative to other branch.
1754
# TODO: rewrite this in terms of ancestry so that it shows only
1757
takes_args = ['remote?']
1758
aliases = ['mis', 'miss']
1759
takes_options = ['verbose']
1762
def run(self, remote=None, verbose=False):
1763
from bzrlib.errors import BzrCommandError
1764
from bzrlib.missing import show_missing
1766
if verbose and is_quiet():
1767
raise BzrCommandError('Cannot pass both quiet and verbose')
1769
tree = WorkingTree.open_containing(u'.')[0]
1770
parent = tree.branch.get_parent()
1757
"""Show unmerged/unpulled revisions between two branches.
1759
OTHER_BRANCH may be local or remote."""
1760
takes_args = ['other_branch?']
1761
takes_options = [Option('reverse', 'Reverse the order of revisions'),
1763
'Display changes in the local branch only'),
1764
Option('theirs-only',
1765
'Display changes in the remote branch only'),
1773
def run(self, other_branch=None, reverse=False, mine_only=False,
1774
theirs_only=False, long=True, short=False, line=False,
1775
show_ids=False, verbose=False):
1776
from bzrlib.missing import find_unmerged, iter_log_data
1777
from bzrlib.log import log_formatter
1778
local_branch = bzrlib.branch.Branch.open_containing(".")[0]
1779
parent = local_branch.get_parent()
1780
if other_branch is None:
1781
other_branch = parent
1782
if other_branch is None:
1773
1783
raise BzrCommandError("No missing location known or specified.")
1776
print "Using last location: %s" % parent
1778
elif parent is None:
1779
# We only update parent if it did not exist, missing
1780
# should not change the parent
1781
tree.branch.set_parent(remote)
1782
br_remote = Branch.open_containing(remote)[0]
1783
return show_missing(tree.branch, br_remote, verbose=verbose,
1784
print "Using last location: " + local_branch.get_parent()
1785
remote_branch = bzrlib.branch.Branch.open(other_branch)
1786
local_extra, remote_extra = find_unmerged(local_branch, remote_branch)
1787
log_format = get_log_format(long=long, short=short, line=line)
1788
lf = log_formatter(log_format, sys.stdout,
1790
show_timezone='original')
1791
if reverse is False:
1792
local_extra.reverse()
1793
remote_extra.reverse()
1794
if local_extra and not theirs_only:
1795
print "You have %d extra revision(s):" % len(local_extra)
1796
for data in iter_log_data(local_extra, local_branch, verbose):
1798
printed_local = True
1800
printed_local = False
1801
if remote_extra and not mine_only:
1802
if printed_local is True:
1804
print "You are missing %d revision(s):" % len(remote_extra)
1805
for data in iter_log_data(remote_extra, remote_branch, verbose):
1807
if not remote_extra and not local_extra:
1809
print "Branches are up to date."
1812
if parent is None and other_branch is not None:
1813
local_branch.set_parent(other_branch)
1787
1817
class cmd_plugins(Command):