~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

Merge from mpool.

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
        self.rev_id = rev_id
207
207
        self.specific_files = specific_files
208
208
        self.allow_pointless = allow_pointless
209
 
        self.revprops = revprops
 
209
        self.revprops = {'branch-nick': branch.nick}
 
210
        if revprops:
 
211
            self.revprops.update(revprops)
210
212
        self.work_tree = WorkingTree(branch.base, branch)
211
213
 
212
214
        if strict:
238
240
        else:
239
241
            self.timezone = int(timezone)
240
242
 
241
 
        assert isinstance(message, basestring), type(message)
 
243
        if isinstance(message, str):
 
244
            message = message.decode(bzrlib.user_encoding)
 
245
        assert isinstance(message, unicode), type(message)
242
246
        self.message = message
243
247
        self._escape_commit_message()
244
248
 
297
301
        # represented in well-formed XML; escape characters that
298
302
        # aren't listed in the XML specification
299
303
        # (http://www.w3.org/TR/REC-xml/#NT-Char).
300
 
        if isinstance(self.message, unicode):
301
 
            char_pattern = u'[^\x09\x0A\x0D\u0020-\uD7FF\uE000-\uFFFD]'
302
 
        else:
303
 
            # Use a regular 'str' as pattern to avoid having re.subn
304
 
            # return 'unicode' results.
305
 
            char_pattern = '[^x09\x0A\x0D\x20-\xFF]'
306
304
        self.message, escape_count = re.subn(
307
 
            char_pattern,
 
305
            u'[^\x09\x0A\x0D\u0020-\uD7FF\uE000-\uFFFD]+',
308
306
            lambda match: match.group(0).encode('unicode_escape'),
309
307
            self.message)
310
308
        if escape_count: