~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/send.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-29 21:35:05 UTC
  • mfrom: (4576 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4577.
  • Revision ID: john@arbash-meinel.com-20090729213505-tkqsvy1zfpocu75w
Merge bzr.dev 4576 in prep for NEWS

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.
107
107
            if len(revision) == 2:
108
108
                base_revision_id = revision[0].as_revision_id(branch)
109
109
        if revision_id is None:
 
110
            if strict is None:
 
111
                strict = branch.get_config(
 
112
                    ).get_user_option_as_bool('send_strict')
 
113
            if strict is None: strict = True # default value
 
114
            if strict and tree is not None:
 
115
                if (tree.has_changes(tree.basis_tree())
 
116
                    or len(tree.get_parent_ids()) > 1):
 
117
                    raise errors.UncommittedChanges(
 
118
                        tree, more='Use --no-strict to force the send.')
 
119
                if tree.last_revision() != tree.branch.last_revision():
 
120
                    # The tree has lost sync with its branch, there is little
 
121
                    # chance that the user is aware of it but he can still force
 
122
                    # the push with --no-strict
 
123
                    raise errors.OutOfDateTree(
 
124
                        tree, more='Use --no-strict to force the send.')
110
125
            revision_id = branch.last_revision()
111
126
        if revision_id == NULL_REVISION:
112
127
            raise errors.BzrCommandError('No revisions to submit.')
113
128
        if format is None:
114
129
            # TODO: Query submit branch for its preferred format
115
130
            format = format_registry.get()
116
 
        directive = format(branch, revision_id, submit_branch, 
 
131
        directive = format(branch, revision_id, submit_branch,
117
132
            public_branch, no_patch, no_bundle, message, base_revision_id)
118
133
        if output is None:
119
134
            directive.compose_merge_request(mail_client, mail_to, body,