~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/send.py

merge 2.0 branch rev 4647

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
 
39
39
def send(submit_branch, revision, public_branch, remember, format,
40
 
         no_bundle, no_patch, output, from_, mail_to, message, body, 
41
 
         to_file):
 
40
         no_bundle, no_patch, output, from_, mail_to, message, body,
 
41
         to_file, strict=None):
42
42
    tree, branch = bzrdir.BzrDir.open_containing_tree_or_branch(from_)[:2]
43
43
    # we may need to write data into branch's repository to calculate
44
44
    # the data to send.
77
77
                       submit_branch)
78
78
 
79
79
        if mail_to is None or format is None:
 
80
            # TODO: jam 20090716 we open the submit_branch here, but we *don't*
 
81
            #       pass it down into the format creation, so it will have to
 
82
            #       open it again
80
83
            submit_br = Branch.open(submit_branch)
81
84
            submit_config = submit_br.get_config()
82
85
            if mail_to is None:
107
110
            if len(revision) == 2:
108
111
                base_revision_id = revision[0].as_revision_id(branch)
109
112
        if revision_id is None:
 
113
            if strict is None:
 
114
                strict = branch.get_config(
 
115
                    ).get_user_option_as_bool('send_strict')
 
116
            if strict is None: strict = True # default value
 
117
            if strict and tree is not None:
 
118
                if (tree.has_changes(tree.basis_tree())
 
119
                    or len(tree.get_parent_ids()) > 1):
 
120
                    raise errors.UncommittedChanges(
 
121
                        tree, more='Use --no-strict to force the send.')
 
122
                if tree.last_revision() != tree.branch.last_revision():
 
123
                    # The tree has lost sync with its branch, there is little
 
124
                    # chance that the user is aware of it but he can still force
 
125
                    # the push with --no-strict
 
126
                    raise errors.OutOfDateTree(
 
127
                        tree, more='Use --no-strict to force the send.')
110
128
            revision_id = branch.last_revision()
111
129
        if revision_id == NULL_REVISION:
112
130
            raise errors.BzrCommandError('No revisions to submit.')
113
131
        if format is None:
114
 
            # TODO: Query submit branch for its preferred format
115
132
            format = format_registry.get()
116
 
        directive = format(branch, revision_id, submit_branch, 
 
133
        directive = format(branch, revision_id, submit_branch,
117
134
            public_branch, no_patch, no_bundle, message, base_revision_id)
118
135
        if output is None:
119
136
            directive.compose_merge_request(mail_client, mail_to, body,