212
217
implicitly add the parent, and so on up to the root. This means
213
218
you should never need to explictly add a directory, they'll just
214
219
get added when you add a file in the directory.
221
--dry-run will show which files would be added, but not actually
216
224
takes_args = ['file*']
217
takes_options = ['no-recurse']
219
def run(self, file_list, no_recurse=False):
220
from bzrlib.add import smart_add, add_reporter_print, add_reporter_null
222
reporter = add_reporter_null
225
takes_options = ['no-recurse', 'dry-run', 'verbose']
227
def run(self, file_list, no_recurse=False, dry_run=False, verbose=False):
232
# This is pointless, but I'd rather not raise an error
233
action = bzrlib.add.add_action_null
235
action = bzrlib.add.add_action_print
237
action = bzrlib.add.add_action_add
224
reporter = add_reporter_print
225
smart_add(file_list, not no_recurse, reporter)
239
action = bzrlib.add.add_action_add_and_print
241
added, ignored = bzrlib.add.smart_add(file_list, not no_recurse,
244
for glob in sorted(ignored.keys()):
245
match_len = len(ignored[glob])
247
for path in ignored[glob]:
248
print "ignored %s matching \"%s\"" % (path, glob)
250
print "ignored %d file(s) matching \"%s\"" % (match_len,
252
print "If you wish to add some of these files, please add them"\
228
256
class cmd_mkdir(Command):
384
412
print "Using saved location: %s" % stored_loc
385
413
location = stored_loc
386
415
br_from = Branch.open(location)
387
416
br_to = tree_to.branch
389
old_rh = br_to.revision_history()
390
count = tree_to.pull(br_from, overwrite)
391
except DivergedBranches:
392
# FIXME: Just make DivergedBranches display the right message
394
raise BzrCommandError("These branches have diverged."
418
old_rh = br_to.revision_history()
419
count = tree_to.pull(br_from, overwrite)
396
421
if br_to.get_parent() is None or remember:
397
422
br_to.set_parent(location)
398
423
note('%d revision(s) pulled.' % (count,))
478
503
raise BzrCommandError("Could not creeate "
480
505
br_to = Branch.initialize(location)
506
old_rh = br_to.revision_history()
482
old_rh = br_to.revision_history()
483
count = br_to.pull(br_from, overwrite)
509
tree_to = br_to.working_tree()
510
except NoWorkingTree:
511
# TODO: This should be updated for branches which don't have a
512
# working tree, as opposed to ones where we just couldn't
514
warning('Unable to update the working tree of: %s' % (br_to.base,))
515
count = br_to.pull(br_from, overwrite)
517
count = tree_to.pull(br_from, overwrite)
484
518
except DivergedBranches:
485
519
raise BzrCommandError("These branches have diverged."
486
520
" Try a merge then push with overwrite.")
1234
1275
unchanged=False, strict=False):
1235
1276
from bzrlib.errors import (PointlessCommit, ConflictsInTree,
1236
1277
StrictCommitFailed)
1237
from bzrlib.msgeditor import edit_commit_message
1278
from bzrlib.msgeditor import edit_commit_message, \
1279
make_commit_message_template
1238
1280
from bzrlib.status import show_status
1239
1281
from tempfile import TemporaryFile
1284
# TODO: Need a blackbox test for invoking the external editor; may be
1285
# slightly problematic to run this cross-platform.
1242
1287
# TODO: do more checks that the commit will succeed before
1243
1288
# spending the user's valuable time typing a commit message.
1720
1765
class cmd_missing(Command):
1721
"""What is missing in this branch relative to other branch.
1723
# TODO: rewrite this in terms of ancestry so that it shows only
1726
takes_args = ['remote?']
1727
aliases = ['mis', 'miss']
1728
takes_options = ['verbose']
1731
def run(self, remote=None, verbose=False):
1732
from bzrlib.errors import BzrCommandError
1733
from bzrlib.missing import show_missing
1735
if verbose and is_quiet():
1736
raise BzrCommandError('Cannot pass both quiet and verbose')
1738
tree = WorkingTree.open_containing(u'.')[0]
1739
parent = tree.branch.get_parent()
1766
"""Show unmerged/unpulled revisions between two branches.
1768
OTHER_BRANCH may be local or remote."""
1769
takes_args = ['other_branch?']
1770
takes_options = [Option('reverse', 'Reverse the order of revisions'),
1772
'Display changes in the local branch only'),
1773
Option('theirs-only',
1774
'Display changes in the remote branch only'),
1782
def run(self, other_branch=None, reverse=False, mine_only=False,
1783
theirs_only=False, long=True, short=False, line=False,
1784
show_ids=False, verbose=False):
1785
from bzrlib.missing import find_unmerged, iter_log_data
1786
from bzrlib.log import log_formatter
1787
local_branch = bzrlib.branch.Branch.open_containing(u".")[0]
1788
parent = local_branch.get_parent()
1789
if other_branch is None:
1790
other_branch = parent
1791
if other_branch is None:
1742
1792
raise BzrCommandError("No missing location known or specified.")
1745
print "Using last location: %s" % parent
1747
elif parent is None:
1748
# We only update parent if it did not exist, missing
1749
# should not change the parent
1750
tree.branch.set_parent(remote)
1751
br_remote = Branch.open_containing(remote)[0]
1752
return show_missing(tree.branch, br_remote, verbose=verbose,
1793
print "Using last location: " + local_branch.get_parent()
1794
remote_branch = bzrlib.branch.Branch.open(other_branch)
1795
local_extra, remote_extra = find_unmerged(local_branch, remote_branch)
1796
log_format = get_log_format(long=long, short=short, line=line)
1797
lf = log_formatter(log_format, sys.stdout,
1799
show_timezone='original')
1800
if reverse is False:
1801
local_extra.reverse()
1802
remote_extra.reverse()
1803
if local_extra and not theirs_only:
1804
print "You have %d extra revision(s):" % len(local_extra)
1805
for data in iter_log_data(local_extra, local_branch, verbose):
1807
printed_local = True
1809
printed_local = False
1810
if remote_extra and not mine_only:
1811
if printed_local is True:
1813
print "You are missing %d revision(s):" % len(remote_extra)
1814
for data in iter_log_data(remote_extra, remote_branch, verbose):
1816
if not remote_extra and not local_extra:
1818
print "Branches are up to date."
1821
if parent is None and other_branch is not None:
1822
local_branch.set_parent(other_branch)
1756
1826
class cmd_plugins(Command):