~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/msgeditor.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-24 19:55:19 UTC
  • mto: (1685.1.1 bzr-encoding)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20051224195519-760ffd6985aff587
[patch] from Ivan Vilata i Balaguer: infotext should be encoded from unicode to flat strings

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
"""Commit message editor support."""
21
21
 
 
22
import codecs
22
23
import os
23
24
from subprocess import call
24
25
 
 
26
import bzrlib
25
27
import bzrlib.config as config
26
28
from bzrlib.errors import BzrError
27
29
 
84
86
        if infotext is not None and infotext != "":
85
87
            hasinfo = True
86
88
            msgfile = file(msgfilename, "w")
87
 
            msgfile.write("\n\n%s\n\n%s" % (ignoreline, infotext))
 
89
            msgfile.write("\n\n%s\n\n%s" % (ignoreline,
 
90
                                        infotext.encode(bzrlib.user_encoding)))
88
91
            msgfile.close()
89
92
        else:
90
93
            hasinfo = False
95
98
        started = False
96
99
        msg = []
97
100
        lastline, nlines = 0, 0
98
 
        for line in file(msgfilename, "r"):
 
101
        for line in codecs.open(msgfilename, 'r', bzrlib.user_encoding):
99
102
            stripped_line = line.strip()
100
103
            # strip empty line before the log message starts
101
104
            if not started: