~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Aaron Bentley
  • Date: 2005-09-19 02:33:09 UTC
  • mfrom: (1185.3.27)
  • mto: (1185.1.29)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: aaron.bentley@utoronto.ca-20050919023309-24e8871f7f8b31cf
Merged latest from mpool

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        If null (default), a time/random revision id is generated.
58
58
    """
59
59
 
60
 
    import time, tempfile
 
60
    import time, tempfile, re
61
61
 
62
62
    from bzrlib.osutils import local_time_offset, username
63
63
    from bzrlib.branch import gen_file_id
144
144
            timezone = local_time_offset()
145
145
 
146
146
        mutter("building commit log message")
 
147
        # Python strings can include characters that can't be
 
148
        # represented in well-formed XML; escape characters that
 
149
        # aren't listed in the XML specification
 
150
        # (http://www.w3.org/TR/REC-xml/#NT-Char).
 
151
        if isinstance(message, unicode):
 
152
            char_pattern = u'[^\x09\x0A\x0D\u0020-\uD7FF\uE000-\uFFFD]'
 
153
        else:
 
154
            # Use a regular 'str' as pattern to avoid having re.subn
 
155
            # return 'unicode' results.
 
156
            char_pattern = '[^x09\x0A\x0D\x20-\xFF]'
 
157
        message, escape_count = re.subn(
 
158
            char_pattern,
 
159
            lambda match: match.group(0).encode('unicode_escape'),
 
160
            message)
 
161
        if escape_count:
 
162
            note("replaced %d control characters in message", escape_count)
147
163
        rev = Revision(timestamp=timestamp,
148
164
                       timezone=timezone,
149
165
                       committer=committer,
248
264
        if not work_tree.has_id(file_id):
249
265
            if verbose:
250
266
                print('deleted %s%s' % (path, kind_marker(entry.kind)))
251
 
                any_changes = True
 
267
            any_changes = True
252
268
            mutter("    file is missing, removing from inventory")
253
269
            missing_ids.append(file_id)
254
270
            continue
310
326
            else:
311
327
                print 'renamed', marked
312
328
                any_changes = True
313
 
                        
 
329
        elif old_ie != entry:
 
330
            any_changes = True
 
331
 
314
332
    return missing_ids, inv, any_changes
315
333
 
316
334