/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/mail_client.py

Support user.signingkey configuration variable in .git/config.

Merged from https://code.launchpad.net/~jelmer/brz/local-git-key/+merge/381000

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
 
18
 
17
19
import errno
18
20
import os
19
21
import subprocess
30
32
    urlutils,
31
33
    registry,
32
34
    )
 
35
from .sixish import (
 
36
    PY3,
 
37
    text_type,
 
38
    )
33
39
 
34
40
mail_client_registry = registry.Registry()
35
41
 
229
235
        :param  u:  possible unicode string.
230
236
        :return:    encoded string if u is unicode, u itself otherwise.
231
237
        """
 
238
        if not PY3 and isinstance(u, text_type):
 
239
            return u.encode(osutils.get_user_encoding(), 'replace')
232
240
        return u
233
241
 
234
242
    def _encode_path(self, path, kind):
240
248
                        path itself otherwise.
241
249
        :raise:         UnableEncodePath.
242
250
        """
 
251
        if not PY3 and isinstance(path, text_type):
 
252
            try:
 
253
                return path.encode(osutils.get_user_encoding())
 
254
            except UnicodeEncodeError:
 
255
                raise errors.UnableEncodePath(path, kind)
243
256
        return path
244
257
 
245
258