~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Martin Pool
  • Date: 2009-07-22 06:00:45 UTC
  • mfrom: (4557 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4558.
  • Revision ID: mbp@sourcefrog.net-20090722060045-035t1zgpicwfyk93
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
799
799
        if len(names_list) < 2:
800
800
            raise errors.BzrCommandError("missing file argument")
801
801
        tree, rel_names = tree_files(names_list, canonicalize=False)
802
 
        tree.lock_write()
 
802
        tree.lock_tree_write()
803
803
        try:
804
804
            self._run(tree, names_list, rel_names, after)
805
805
        finally:
813
813
            raise errors.BzrCommandError('--after cannot be specified with'
814
814
                                         ' --auto.')
815
815
        work_tree, file_list = tree_files(names_list, default_branch='.')
816
 
        work_tree.lock_write()
 
816
        work_tree.lock_tree_write()
817
817
        try:
818
818
            rename_map.RenameMap.guess_renames(work_tree, dry_run)
819
819
        finally:
1096
1096
        (tree, br_from,
1097
1097
         _unused) = bzrdir.BzrDir.open_containing_tree_or_branch(directory)
1098
1098
        if strict is None:
1099
 
            strict = br_from.get_config().get_user_option('push_strict')
1100
 
            if strict is not None:
1101
 
                # FIXME: This should be better supported by config
1102
 
                # -- vila 20090611
1103
 
                bools = dict(yes=True, no=False, on=True, off=False,
1104
 
                             true=True, false=False)
1105
 
                try:
1106
 
                    strict = bools[strict.lower()]
1107
 
                except KeyError:
1108
 
                    strict = None
 
1099
            strict = br_from.get_config().get_user_option_as_bool('push_strict')
 
1100
        if strict is None: strict = True # default value
1109
1101
        # Get the tip's revision_id
1110
1102
        revision = _get_one_revision('push', revision)
1111
1103
        if revision is not None:
1112
1104
            revision_id = revision.in_history(br_from).rev_id
1113
1105
        else:
1114
1106
            revision_id = None
1115
 
        if (tree is not None and revision_id is None
1116
 
            and (strict is None or strict)): # Default to True:
 
1107
        if strict and tree is not None and revision_id is None:
1117
1108
            if (tree.has_changes(tree.basis_tree())
1118
 
                 or len(tree.get_parent_ids()) > 1):
 
1109
                or len(tree.get_parent_ids()) > 1):
1119
1110
                raise errors.UncommittedChanges(
1120
1111
                    tree, more='Use --no-strict to force the push.')
1121
1112
            if tree.last_revision() != tree.branch.last_revision():
3797
3788
            base_branch, base_path = Branch.open_containing(base_loc,
3798
3789
                possible_transports)
3799
3790
        # Find the revision ids
3800
 
        if revision is None or len(revision) < 1 or revision[-1] is None:
 
3791
        other_revision_id = None
 
3792
        base_revision_id = None
 
3793
        if revision is not None:
 
3794
            if len(revision) >= 1:
 
3795
                other_revision_id = revision[-1].as_revision_id(other_branch)
 
3796
            if len(revision) == 2:
 
3797
                base_revision_id = revision[0].as_revision_id(base_branch)
 
3798
        if other_revision_id is None:
3801
3799
            other_revision_id = _mod_revision.ensure_null(
3802
3800
                other_branch.last_revision())
3803
 
        else:
3804
 
            other_revision_id = revision[-1].as_revision_id(other_branch)
3805
 
        if (revision is not None and len(revision) == 2
3806
 
            and revision[0] is not None):
3807
 
            base_revision_id = revision[0].as_revision_id(base_branch)
3808
 
        else:
3809
 
            base_revision_id = None
3810
3801
        # Remember where we merge from
3811
3802
        if ((remember or tree.branch.get_submit_branch() is None) and
3812
3803
             user_location is not None):