~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Robert Collins
  • Date: 2005-11-22 21:28:30 UTC
  • mfrom: (1185.33.32 bzr.dev)
  • Revision ID: robertc@robertcollins.net-20051122212830-885c284847f0b17b
Merge from mpool.

Show diffs side-by-side

added added

removed removed

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