946
946
if branch_to.get_parent() is None or remember:
947
947
branch_to.set_parent(branch_from.base)
949
if revision is not None:
950
revision_id = revision.as_revision_id(branch_from)
952
branch_to.lock_write()
949
if branch_from is not branch_to:
950
branch_from.lock_read()
954
if tree_to is not None:
955
view_info = _get_view_info_for_change_reporter(tree_to)
956
change_reporter = delta._ChangeReporter(
957
unversioned_filter=tree_to.is_ignored, view_info=view_info)
958
result = tree_to.pull(branch_from, overwrite, revision_id,
960
possible_transports=possible_transports,
963
result = branch_to.pull(branch_from, overwrite, revision_id,
966
result.report(self.outf)
967
if verbose and result.old_revid != result.new_revid:
968
log.show_branch_change(branch_to, self.outf, result.old_revno,
952
if revision is not None:
953
revision_id = revision.as_revision_id(branch_from)
955
branch_to.lock_write()
957
if tree_to is not None:
958
view_info = _get_view_info_for_change_reporter(tree_to)
959
change_reporter = delta._ChangeReporter(
960
unversioned_filter=tree_to.is_ignored,
962
result = tree_to.pull(
963
branch_from, overwrite, revision_id, change_reporter,
964
possible_transports=possible_transports, local=local)
966
result = branch_to.pull(
967
branch_from, overwrite, revision_id, local=local)
969
result.report(self.outf)
970
if verbose and result.old_revid != result.new_revid:
971
log.show_branch_change(
972
branch_to, self.outf, result.old_revno,
977
if branch_from is not branch_to:
974
981
class cmd_push(Command):
1021
1028
'for the commit history. Only the work not present in the '
1022
1029
'referenced branch is included in the branch created.',
1032
help='Refuse to push if there are uncommitted changes in'
1033
' the working tree.'),
1025
1035
takes_args = ['location?']
1026
1036
encoding_type = 'replace'
1028
1038
def run(self, location=None, remember=False, overwrite=False,
1029
1039
create_prefix=False, verbose=False, revision=None,
1030
1040
use_existing_dir=False, directory=None, stacked_on=None,
1041
stacked=False, strict=None):
1032
1042
from bzrlib.push import _show_push_branch
1034
# Get the source branch and revision_id
1035
1044
if directory is None:
1036
1045
directory = '.'
1037
br_from = Branch.open_containing(directory)[0]
1046
# Get the source branch
1047
tree, br_from = bzrdir.BzrDir.open_tree_or_branch(directory)
1049
strict = br_from.get_config().get_user_option('push_strict')
1050
if strict is not None:
1051
# FIXME: This should be better supported by config
1053
bools = dict(yes=True, no=False, on=True, off=False,
1054
true=True, false=False)
1056
strict = bools[strict.lower()]
1060
changes = tree.changes_from(tree.basis_tree())
1061
if changes.has_changed():
1062
raise errors.UncommittedChanges(tree)
1063
# Get the tip's revision_id
1038
1064
revision = _get_one_revision('push', revision)
1039
1065
if revision is not None:
1040
1066
revision_id = revision.in_history(br_from).rev_id
1080
1106
class cmd_branch(Command):
1081
"""Create a new copy of a branch.
1107
"""Create a new branch that is a copy of an existing branch.
1083
1109
If the TO_LOCATION is omitted, the last component of the FROM_LOCATION will
1084
1110
be used. In other words, "branch ../foo/bar" will attempt to create ./bar.
1113
1139
accelerator_tree, br_from = bzrdir.BzrDir.open_tree_or_branch(
1141
if (accelerator_tree is not None and
1142
accelerator_tree.supports_content_filtering()):
1143
accelerator_tree = None
1115
1144
revision = _get_one_revision('branch', revision)
1116
1145
br_from.lock_read()
1621
1650
branch.set_append_revisions_only(True)
1622
1651
except errors.UpgradeRequired:
1623
1652
raise errors.BzrCommandError('This branch format cannot be set'
1624
' to append-revisions-only. Try --experimental-branch6')
1653
' to append-revisions-only. Try --default.')
1625
1654
if not is_quiet():
1626
1655
from bzrlib.info import describe_layout, describe_format
2410
2439
kindch = entry.kind_character()
2411
2440
outstring = fp + kindch
2441
ui.ui_factory.clear_term()
2413
2443
outstring = '%-8s %s' % (fc, outstring)
2414
2444
if show_ids and fid is not None:
4665
4695
containing_tree.extract(sub_id)
4666
4696
except errors.RootNotRich:
4667
raise errors.UpgradeRequired(containing_tree.branch.base)
4697
raise errors.RichRootUpgradeRequired(containing_tree.branch.base)
4670
4700
class cmd_merge_directive(Command):