~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

Nathaniel McCallums patch for urandom friendliness on aix.

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, re
 
60
    import time, tempfile
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)
163
147
        rev = Revision(timestamp=timestamp,
164
148
                       timezone=timezone,
165
149
                       committer=committer,
264
248
        if not work_tree.has_id(file_id):
265
249
            if verbose:
266
250
                print('deleted %s%s' % (path, kind_marker(entry.kind)))
267
 
            any_changes = True
 
251
                any_changes = True
268
252
            mutter("    file is missing, removing from inventory")
269
253
            missing_ids.append(file_id)
270
254
            continue
326
310
            else:
327
311
                print 'renamed', marked
328
312
                any_changes = True
329
 
        elif old_ie != entry:
330
 
            any_changes = True
331
 
 
 
313
                        
332
314
    return missing_ids, inv, any_changes
333
315
 
334
316