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
80
83
submit_br = Branch.open(submit_branch)
81
84
submit_config = submit_br.get_config()
82
85
if mail_to is None:
108
111
base_revision_id = revision[0].as_revision_id(branch)
109
112
if revision_id is None:
110
113
if strict is None:
111
strict = branch.get_config().get_user_option('send_strict')
112
if strict is not None:
113
# FIXME: This should be better supported by config
115
bools = dict(yes=True, no=False, on=True, off=False,
116
true=True, false=False)
118
strict = bools[strict.lower()]
121
if tree is not None and (strict is None or strict):
122
changes = tree.changes_from(tree.basis_tree())
123
if changes.has_changed() or len(tree.get_parent_ids()) > 1:
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()):
124
119
raise errors.UncommittedChanges(
125
120
tree, more='Use --no-strict to force the send.')
126
121
if tree.last_revision() != tree.branch.last_revision():
127
122
# The tree has lost sync with its branch, there is little
128
123
# chance that the user is aware of it but he can still force
129
# the push with --no-strict
124
# the send with --no-strict
130
125
raise errors.OutOfDateTree(
131
126
tree, more='Use --no-strict to force the send.')
132
127
revision_id = branch.last_revision()
133
128
if revision_id == NULL_REVISION:
134
129
raise errors.BzrCommandError('No revisions to submit.')
135
130
if format is None:
136
# TODO: Query submit branch for its preferred format
137
131
format = format_registry.get()
138
132
directive = format(branch, revision_id, submit_branch,
139
133
public_branch, no_patch, no_bundle, message, base_revision_id)