/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

Merge up bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
234
234
 
235
235
    success = False
236
236
    try:
237
 
        # This may throw an exception, in which case success will
238
 
        # not be set.
239
 
        rename_func(old, new)
240
 
        success = True
 
237
        try:
 
238
            # This may throw an exception, in which case success will
 
239
            # not be set.
 
240
            rename_func(old, new)
 
241
            success = True
 
242
        except (IOError, OSError), e:
 
243
            # source and target may be aliases of each other (e.g. on a
 
244
            # case-insensitive filesystem), so we may have accidentally renamed
 
245
            # source by when we tried to rename target
 
246
            if not (file_existed and e.errno in (None, errno.ENOENT)):
 
247
                raise
241
248
    finally:
242
249
        if file_existed:
243
250
            # If the file used to exist, rename it back into place