946
946
if branch_to.get_parent() is None or remember:
947
947
branch_to.set_parent(branch_from.base)
949
if branch_from is not branch_to:
950
branch_from.lock_read()
949
if revision is not None:
950
revision_id = revision.as_revision_id(branch_from)
952
branch_to.lock_write()
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,
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,
977
if branch_from is not branch_to:
981
974
class cmd_push(Command):
1028
1021
'for the commit history. Only the work not present in the '
1029
1022
'referenced branch is included in the branch created.',
1032
help='Refuse to push if there are uncommitted changes in'
1033
' the working tree.'),
1035
1025
takes_args = ['location?']
1036
1026
encoding_type = 'replace'
1038
1028
def run(self, location=None, remember=False, overwrite=False,
1039
1029
create_prefix=False, verbose=False, revision=None,
1040
1030
use_existing_dir=False, directory=None, stacked_on=None,
1041
stacked=False, strict=None):
1042
1032
from bzrlib.push import _show_push_branch
1034
# Get the source branch and revision_id
1044
1035
if directory is None:
1045
1036
directory = '.'
1046
# Get the source branch
1048
_unused) = bzrdir.BzrDir.open_containing_tree_or_branch(directory)
1050
strict = br_from.get_config().get_user_option('push_strict')
1051
if strict is not None:
1052
# FIXME: This should be better supported by config
1054
bools = dict(yes=True, no=False, on=True, off=False,
1055
true=True, false=False)
1057
strict = bools[strict.lower()]
1061
changes = tree.changes_from(tree.basis_tree())
1062
if changes.has_changed():
1063
raise errors.UncommittedChanges(tree)
1064
# Get the tip's revision_id
1037
br_from = Branch.open_containing(directory)[0]
1065
1038
revision = _get_one_revision('push', revision)
1066
1039
if revision is not None:
1067
1040
revision_id = revision.in_history(br_from).rev_id
1651
1624
branch.set_append_revisions_only(True)
1652
1625
except errors.UpgradeRequired:
1653
1626
raise errors.BzrCommandError('This branch format cannot be set'
1654
' to append-revisions-only. Try --default.')
1627
' to append-revisions-only. Try --experimental-branch6')
1655
1628
if not is_quiet():
1656
1629
from bzrlib.info import describe_layout, describe_format
2397
2370
if path is None:
2401
2375
raise errors.BzrCommandError('cannot specify both --from-root'
2404
2379
tree, branch, relpath = bzrdir.BzrDir.open_containing_tree_or_branch(
2407
# Calculate the prefix to use
2411
prefix = relpath + '/'
2412
elif fs_path != '.':
2413
prefix = fs_path + '/'
2415
2385
if revision is not None or tree is None:
2416
2386
tree = _get_one_revision_tree('ls', revision, branch=branch)
2426
2396
tree.lock_read()
2428
for fp, fc, fkind, fid, entry in tree.list_files(include_root=False,
2429
from_dir=relpath, recursive=recursive):
2430
# Apply additional masking
2431
if not all and not selection[fc]:
2433
if kind is not None and fkind != kind:
2438
fullpath = osutils.pathjoin(relpath, fp)
2441
views.check_path_in_view(tree, fullpath)
2442
except errors.FileOutsideView:
2447
fp = osutils.pathjoin(prefix, fp)
2448
kindch = entry.kind_character()
2449
outstring = fp + kindch
2450
ui.ui_factory.clear_term()
2452
outstring = '%-8s %s' % (fc, outstring)
2453
if show_ids and fid is not None:
2454
outstring = "%-50s %s" % (outstring, fid)
2455
self.outf.write(outstring + '\n')
2457
self.outf.write(fp + '\0')
2460
self.outf.write(fid)
2461
self.outf.write('\0')
2398
for fp, fc, fkind, fid, entry in tree.list_files(include_root=False):
2399
if fp.startswith(relpath):
2400
rp = fp[len(relpath):]
2401
fp = osutils.pathjoin(prefix, rp)
2402
if not recursive and '/' in rp:
2404
if not all and not selection[fc]:
2406
if kind is not None and fkind != kind:
2410
views.check_path_in_view(tree, fp)
2411
except errors.FileOutsideView:
2413
kindch = entry.kind_character()
2414
outstring = fp + kindch
2415
ui.ui_factory.clear_term()
2417
outstring = '%-8s %s' % (fc, outstring)
2418
if show_ids and fid is not None:
2419
outstring = "%-50s %s" % (outstring, fid)
2420
self.outf.write(outstring + '\n')
2422
self.outf.write(fp + '\0')
2425
self.outf.write(fid)
2426
self.outf.write('\0')
2465
2429
if fid is not None:
2469
self.outf.write('%-50s %s\n' % (outstring, my_id))
2471
self.outf.write(outstring + '\n')
2434
self.outf.write('%-50s %s\n' % (outstring, my_id))
2436
self.outf.write(outstring + '\n')
2998
2963
The working tree and branch checks will only give output if a problem is
2999
2964
detected. The output fields of the repository check are:
3002
This is just the number of revisions checked. It doesn't
3006
This is just the number of versionedfiles checked. It
3007
doesn't indicate a problem.
3009
unreferenced ancestors
3010
Texts that are ancestors of other texts, but
3011
are not properly referenced by the revision ancestry. This is a
3012
subtle problem that Bazaar can work around.
3015
This is the total number of unique file contents
3016
seen in the checked revisions. It does not indicate a problem.
3019
This is the total number of repeated texts seen
3020
in the checked revisions. Texts can be repeated when their file
3021
entries are modified, but the file contents are not. It does not
2966
revisions: This is just the number of revisions checked. It doesn't
2968
versionedfiles: This is just the number of versionedfiles checked. It
2969
doesn't indicate a problem.
2970
unreferenced ancestors: Texts that are ancestors of other texts, but
2971
are not properly referenced by the revision ancestry. This is a
2972
subtle problem that Bazaar can work around.
2973
unique file texts: This is the total number of unique file contents
2974
seen in the checked revisions. It does not indicate a problem.
2975
repeated file texts: This is the total number of repeated texts seen
2976
in the checked revisions. Texts can be repeated when their file
2977
entries are modified, but the file contents are not. It does not
3024
2980
If no restrictions are specified, all Bazaar data that is found at the given
3025
2981
location will be checked.
3604
3560
if revision is not None and len(revision) > 0:
3605
3561
raise errors.BzrCommandError('Cannot use --uncommitted and'
3606
3562
' --revision at the same time.')
3607
merger = self.get_merger_from_uncommitted(tree, location, pb,
3563
location = self._select_branch_location(tree, location)[0]
3564
other_tree, other_path = WorkingTree.open_containing(location)
3565
merger = _mod_merge.Merger.from_uncommitted(tree, other_tree,
3609
3567
allow_pending = False
3568
if other_path != '':
3569
merger.interesting_files = [other_path]
3611
3571
if merger is None:
3612
3572
merger, allow_pending = self._get_merger_from_branch(tree,
3725
3685
allow_pending = True
3726
3686
return merger, allow_pending
3728
def get_merger_from_uncommitted(self, tree, location, pb, cleanups):
3729
"""Get a merger for uncommitted changes.
3731
:param tree: The tree the merger should apply to.
3732
:param location: The location containing uncommitted changes.
3733
:param pb: The progress bar to use for showing progress.
3734
:param cleanups: A list of operations to perform to clean up the
3735
temporary directories, unfinalized objects, etc.
3737
location = self._select_branch_location(tree, location)[0]
3738
other_tree, other_path = WorkingTree.open_containing(location)
3739
merger = _mod_merge.Merger.from_uncommitted(tree, other_tree, pb)
3740
if other_path != '':
3741
merger.interesting_files = [other_path]
3744
3688
def _select_branch_location(self, tree, user_location, revision=None,
3746
3690
"""Select a branch location, according to possible inputs.