1715
1720
class cmd_missing(Command):
1716
"""What is missing in this branch relative to other branch.
1718
# TODO: rewrite this in terms of ancestry so that it shows only
1721
takes_args = ['remote?']
1722
aliases = ['mis', 'miss']
1723
takes_options = ['verbose']
1726
def run(self, remote=None, verbose=False):
1727
from bzrlib.errors import BzrCommandError
1728
from bzrlib.missing import show_missing
1730
if verbose and is_quiet():
1731
raise BzrCommandError('Cannot pass both quiet and verbose')
1733
tree = WorkingTree.open_containing(u'.')[0]
1734
parent = tree.branch.get_parent()
1737
raise BzrCommandError("No missing location known or specified.")
1740
print "Using last location: %s" % parent
1742
elif parent is None:
1743
# We only update parent if it did not exist, missing
1744
# should not change the parent
1745
tree.branch.set_parent(remote)
1746
br_remote = Branch.open_containing(remote)[0]
1747
return show_missing(tree.branch, br_remote, verbose=verbose,
1721
"""Show unmerged/unpulled revisions between two branches.
1723
OTHER_BRANCH may be local or remote."""
1724
takes_args = ['other_branch?']
1725
takes_options = [Option('reverse', 'Reverse the order of revisions'),
1727
'Display changes in the local branch only'),
1728
Option('theirs-only',
1729
'Display changes in the remote branch only'),
1736
def run(self, other_branch=None, reverse=False, mine_only=False,
1737
theirs_only=False, long=True, short=False, line=False,
1739
from bzrlib.missing import find_unmerged
1740
from bzrlib.log import log_formatter
1741
local_branch = bzrlib.branch.Branch.open_containing(".")[0]
1742
if other_branch is None:
1743
print "Using last location: " + local_branch.get_parent()
1744
other_branch = local_branch.get_parent()
1745
remote_branch = bzrlib.branch.Branch.open(other_branch)
1746
local_extra, remote_extra = find_unmerged(local_branch, remote_branch)
1747
log_format = get_log_format(long=long, short=short, line=line)
1748
lf = log_formatter(log_format, sys.stdout,
1750
show_timezone='original')
1751
if reverse is False:
1752
local_extra.reverse()
1753
remote_extra.reverse()
1754
if local_extra and not theirs_only:
1755
print "You have the following extra revisions:"
1756
for revno, revision_id in local_extra:
1757
lf.show(revno, local_branch.get_revision(revision_id), None)
1758
printed_local = True
1760
printed_local = False
1761
if remote_extra and not mine_only:
1762
if printed_local is True:
1764
print "You are missing the following revisions:"
1765
for revno, revision_id in remote_extra:
1766
lf.show(revno, remote_branch.get_revision(revision_id), None)
1767
if not remote_extra and not local_extra:
1768
print "Branches are up to date."
1751
1771
class cmd_plugins(Command):