/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 17:57:15 UTC
  • mfrom: (4454 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4460.
  • Revision ID: john@arbash-meinel.com-20090617175715-p9ebpwx5rhc0qin1
Merge bzr.dev 4454 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
946
946
            if branch_to.get_parent() is None or remember:
947
947
                branch_to.set_parent(branch_from.base)
948
948
 
949
 
        if revision is not None:
950
 
            revision_id = revision.as_revision_id(branch_from)
951
 
 
952
 
        branch_to.lock_write()
 
949
        if branch_from is not branch_to:
 
950
            branch_from.lock_read()
953
951
        try:
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,
959
 
                                      change_reporter,
960
 
                                      possible_transports=possible_transports,
961
 
                                      local=local)
962
 
            else:
963
 
                result = branch_to.pull(branch_from, overwrite, revision_id,
964
 
                                      local=local)
965
 
 
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,
969
 
                                       result.old_revid)
 
952
            if revision is not None:
 
953
                revision_id = revision.as_revision_id(branch_from)
 
954
 
 
955
            branch_to.lock_write()
 
956
            try:
 
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,
 
961
                        view_info=view_info)
 
962
                    result = tree_to.pull(
 
963
                        branch_from, overwrite, revision_id, change_reporter,
 
964
                        possible_transports=possible_transports, local=local)
 
965
                else:
 
966
                    result = branch_to.pull(
 
967
                        branch_from, overwrite, revision_id, local=local)
 
968
 
 
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,
 
973
                        result.old_revid)
 
974
            finally:
 
975
                branch_to.unlock()
970
976
        finally:
971
 
            branch_to.unlock()
 
977
            if branch_from is not branch_to:
 
978
                branch_from.unlock()
972
979
 
973
980
 
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.',
1023
1030
            type=unicode),
 
1031
        Option('strict',
 
1032
               help='Refuse to push if there are uncommitted changes in'
 
1033
               ' the working tree.'),
1024
1034
        ]
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,
1031
 
        stacked=False):
 
1041
        stacked=False, strict=None):
1032
1042
        from bzrlib.push import _show_push_branch
1033
1043
 
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)
 
1048
        if strict is None:
 
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
 
1052
                # -- vila 20090611
 
1053
                bools = dict(yes=True, no=False, on=True, off=False,
 
1054
                             true=True, false=False)
 
1055
                try:
 
1056
                    strict = bools[strict.lower()]
 
1057
                except KeyError:
 
1058
                    strict = None
 
1059
        if strict:
 
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
1078
1104
 
1079
1105
 
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.
1082
1108
 
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.
1112
1138
 
1113
1139
        accelerator_tree, br_from = bzrdir.BzrDir.open_tree_or_branch(
1114
1140
            from_location)
 
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()
1117
1146
        try:
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
1627
1656
            try:
2409
2438
                            continue
2410
2439
                    kindch = entry.kind_character()
2411
2440
                    outstring = fp + kindch
 
2441
                    ui.ui_factory.clear_term()
2412
2442
                    if verbose:
2413
2443
                        outstring = '%-8s %s' % (fc, outstring)
2414
2444
                        if show_ids and fid is not None:
4664
4694
        try:
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)
4668
4698
 
4669
4699
 
4670
4700
class cmd_merge_directive(Command):