~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/send.py

  • Committer: Jelmer Vernooij
  • Date: 2011-10-06 00:14:01 UTC
  • mto: This revision was merged to the branch mainline in revision 6216.
  • Revision ID: jelmer@samba.org-20111006001401-o14rsyp6gdy5vt3o
Fix plugin use of revision_history.

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:
63
64
            submit_branch = stored_submit_branch
64
65
            remembered_submit_branch = "submit"
65
66
        else:
66
 
            if stored_submit_branch is None or remember:
 
67
            # Remembers if asked explicitly or no previous location is set
 
68
            if remember or (remember is None and stored_submit_branch is None):
67
69
                branch.set_submit_branch(submit_branch)
68
70
        if submit_branch is None:
69
71
            submit_branch = branch.get_parent()
70
72
            remembered_submit_branch = "parent"
71
73
        if submit_branch is None:
72
 
            raise errors.BzrCommandError('No submit branch known or'
73
 
                                         ' specified')
 
74
            raise errors.BzrCommandError(gettext('No submit branch known or'
 
75
                                         ' specified'))
74
76
        if remembered_submit_branch is not None:
75
 
            trace.note('Using saved %s location "%s" to determine what '
76
 
                       'changes to submit.', remembered_submit_branch,
77
 
                       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))
78
80
 
79
81
        if mail_to is None or format is None:
80
82
            # TODO: jam 20090716 we open the submit_branch here, but we *don't*
89
91
                try:
90
92
                    format = format_registry.get(formatname)
91
93
                except KeyError:
92
 
                    raise errors.BzrCommandError("No such send format '%s'." % 
 
94
                    raise errors.BzrCommandError(gettext("No such send format '%s'.") % 
93
95
                                                 formatname)
94
96
 
95
97
        stored_public_branch = branch.get_public_branch()
96
98
        if public_branch is None:
97
99
            public_branch = stored_public_branch
98
 
        elif stored_public_branch is None or remember:
 
100
        # Remembers if asked explicitly or no previous location is set
 
101
        elif (remember
 
102
              or (remember is None and stored_public_branch is None)):
99
103
            branch.set_public_branch(public_branch)
100
104
        if no_bundle and public_branch is None:
101
 
            raise errors.BzrCommandError('No public branch specified or'
102
 
                                         ' known')
 
105
            raise errors.BzrCommandError(gettext('No public branch specified or'
 
106
                                         ' known'))
103
107
        base_revision_id = None
104
108
        revision_id = None
105
109
        if revision is not None:
106
110
            if len(revision) > 2:
107
 
                raise errors.BzrCommandError('bzr send takes '
108
 
                    'at most two one revision identifiers')
 
111
                raise errors.BzrCommandError(gettext('bzr send takes '
 
112
                    'at most two one revision identifiers'))
109
113
            revision_id = revision[-1].as_revision_id(branch)
110
114
            if len(revision) == 2:
111
115
                base_revision_id = revision[0].as_revision_id(branch)
117
121
                    more_warning='Uncommitted changes will not be sent.')
118
122
            revision_id = branch.last_revision()
119
123
        if revision_id == NULL_REVISION:
120
 
            raise errors.BzrCommandError('No revisions to submit.')
 
124
            raise errors.BzrCommandError(gettext('No revisions to submit.'))
121
125
        if format is None:
122
126
            format = format_registry.get()
123
127
        directive = format(branch, revision_id, submit_branch,
128
132
        else:
129
133
            if directive.multiple_output_files:
130
134
                if output == '-':
131
 
                    raise errors.BzrCommandError('- not supported for '
132
 
                        '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.'))
133
137
                if not os.path.exists(output):
134
138
                    os.mkdir(output, 0755)
135
139
                for (filename, lines) in directive.to_files():
170
174
        if not no_patch:
171
175
            patch_type = 'bundle'
172
176
        else:
173
 
            raise errors.BzrCommandError('Format 0.9 does not'
174
 
                ' permit bundle with no patch')
 
177
            raise errors.BzrCommandError(gettext('Format 0.9 does not'
 
178
                ' permit bundle with no patch'))
175
179
    else:
176
180
        if not no_patch:
177
181
            patch_type = 'diff'