~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Vincent Ladeuil
  • Date: 2010-04-12 16:54:35 UTC
  • mto: (5148.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5151.
  • Revision ID: v.ladeuil+lp@free.fr-20100412165435-gzdnwuybj9rvddiz
Fix bug #519319 by defaulting to a warning for dirty trees.

* bzrlib/mutabletree.py:
(MutableTree.warn_if_changed_or_out_of_date): Factor out the
checks done by send, push and dpush.

* bzrlib/send.py:
(send): Use warn_if_changed_or_out_of_date().

* bzrlib/foreign.py:
(cmd_dpush.run): Use warn_if_changed_or_out_of_date().

* bzrlib/builtins.py:
(cmd_push.run): Use warn_if_changed_or_out_of_date().

Show diffs side-by-side

added added

removed removed

Lines of Context:
1126
1126
        # Get the source branch
1127
1127
        (tree, br_from,
1128
1128
         _unused) = bzrdir.BzrDir.open_containing_tree_or_branch(directory)
1129
 
        if strict is None:
1130
 
            strict = br_from.get_config().get_user_option_as_bool('push_strict')
1131
 
        if strict is None: strict = True # default value
1132
1129
        # Get the tip's revision_id
1133
1130
        revision = _get_one_revision('push', revision)
1134
1131
        if revision is not None:
1135
1132
            revision_id = revision.in_history(br_from).rev_id
1136
1133
        else:
1137
1134
            revision_id = None
1138
 
        if strict and tree is not None and revision_id is None:
1139
 
            if (tree.has_changes()):
1140
 
                raise errors.UncommittedChanges(
1141
 
                    tree, more='Use --no-strict to force the push.')
1142
 
            if tree.last_revision() != tree.branch.last_revision():
1143
 
                # The tree has lost sync with its branch, there is little
1144
 
                # chance that the user is aware of it but he can still force
1145
 
                # the push with --no-strict
1146
 
                raise errors.OutOfDateTree(
1147
 
                    tree, more='Use --no-strict to force the push.')
1148
 
 
 
1135
        if tree is not None and revision_id is None:
 
1136
            tree.warn_if_changed_or_out_of_date(
 
1137
                strict, 'push_strict', 'Use --no-strict to force the push.')
1149
1138
        # Get the stacked_on branch, if any
1150
1139
        if stacked_on is not None:
1151
1140
            stacked_on = urlutils.normalize_url(stacked_on)