~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/send.py

  • Committer: Benoît Pierre
  • Date: 2011-10-10 20:55:52 UTC
  • mto: This revision was merged to the branch mainline in revision 6215.
  • Revision ID: benoit.pierre@gmail.com-20111010205552-7o6qoaiihy31hhxb
Avoid prompt duplication for shelf_ui tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    registry,
26
26
    trace,
27
27
    )
 
28
from bzrlib.i18n import gettext
28
29
from bzrlib.branch import (
29
30
    Branch,
30
31
    )
51
52
            mail_client = config.get_mail_client()
52
53
            if (not getattr(mail_client, 'supports_body', False)
53
54
                and body is not None):
54
 
                raise errors.BzrCommandError(
55
 
                    'Mail client "%s" does not support specifying body' %
 
55
                raise errors.BzrCommandError(gettext(
 
56
                    'Mail client "%s" does not support specifying body') %
56
57
                    mail_client.__class__.__name__)
57
58
        if remember and submit_branch is None:
58
 
            raise errors.BzrCommandError(
59
 
                '--remember requires a branch to be specified.')
 
59
            raise errors.BzrCommandError(gettext(
 
60
                '--remember requires a branch to be specified.'))
60
61
        stored_submit_branch = branch.get_submit_branch()
61
62
        remembered_submit_branch = None
62
63
        if submit_branch is None:
70
71
            submit_branch = branch.get_parent()
71
72
            remembered_submit_branch = "parent"
72
73
        if submit_branch is None:
73
 
            raise errors.BzrCommandError('No submit branch known or'
74
 
                                         ' specified')
 
74
            raise errors.BzrCommandError(gettext('No submit branch known or'
 
75
                                         ' specified'))
75
76
        if remembered_submit_branch is not None:
76
 
            trace.note('Using saved %s location "%s" to determine what '
77
 
                       'changes to submit.', remembered_submit_branch,
78
 
                       submit_branch)
 
77
            trace.note(gettext('Using saved {0} location "{1}" to determine '
 
78
                       'what changes to submit.').format(
 
79
                                    remembered_submit_branch, submit_branch))
79
80
 
80
81
        if mail_to is None or format is None:
81
82
            # TODO: jam 20090716 we open the submit_branch here, but we *don't*
90
91
                try:
91
92
                    format = format_registry.get(formatname)
92
93
                except KeyError:
93
 
                    raise errors.BzrCommandError("No such send format '%s'." % 
 
94
                    raise errors.BzrCommandError(gettext("No such send format '%s'.") % 
94
95
                                                 formatname)
95
96
 
96
97
        stored_public_branch = branch.get_public_branch()
101
102
              or (remember is None and stored_public_branch is None)):
102
103
            branch.set_public_branch(public_branch)
103
104
        if no_bundle and public_branch is None:
104
 
            raise errors.BzrCommandError('No public branch specified or'
105
 
                                         ' known')
 
105
            raise errors.BzrCommandError(gettext('No public branch specified or'
 
106
                                         ' known'))
106
107
        base_revision_id = None
107
108
        revision_id = None
108
109
        if revision is not None:
109
110
            if len(revision) > 2:
110
 
                raise errors.BzrCommandError('bzr send takes '
111
 
                    'at most two one revision identifiers')
 
111
                raise errors.BzrCommandError(gettext('bzr send takes '
 
112
                    'at most two one revision identifiers'))
112
113
            revision_id = revision[-1].as_revision_id(branch)
113
114
            if len(revision) == 2:
114
115
                base_revision_id = revision[0].as_revision_id(branch)
120
121
                    more_warning='Uncommitted changes will not be sent.')
121
122
            revision_id = branch.last_revision()
122
123
        if revision_id == NULL_REVISION:
123
 
            raise errors.BzrCommandError('No revisions to submit.')
 
124
            raise errors.BzrCommandError(gettext('No revisions to submit.'))
124
125
        if format is None:
125
126
            format = format_registry.get()
126
127
        directive = format(branch, revision_id, submit_branch,
131
132
        else:
132
133
            if directive.multiple_output_files:
133
134
                if output == '-':
134
 
                    raise errors.BzrCommandError('- not supported for '
135
 
                        'merge directives that use more than one output file.')
 
135
                    raise errors.BzrCommandError(gettext('- not supported for '
 
136
                        'merge directives that use more than one output file.'))
136
137
                if not os.path.exists(output):
137
138
                    os.mkdir(output, 0755)
138
139
                for (filename, lines) in directive.to_files():
173
174
        if not no_patch:
174
175
            patch_type = 'bundle'
175
176
        else:
176
 
            raise errors.BzrCommandError('Format 0.9 does not'
177
 
                ' permit bundle with no patch')
 
177
            raise errors.BzrCommandError(gettext('Format 0.9 does not'
 
178
                ' permit bundle with no patch'))
178
179
    else:
179
180
        if not no_patch:
180
181
            patch_type = 'diff'