/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

  • Committer: Martin Pool
  • Date: 2009-11-26 01:42:06 UTC
  • mfrom: (4827 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4828.
  • Revision ID: mbp@sourcefrog.net-20091126014206-qvf8jfpwpro558r4
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
224
224
    else:
225
225
        file_existed = True
226
226
 
 
227
    failure_exc = None
227
228
    success = False
228
229
    try:
229
230
        try:
235
236
            # source and target may be aliases of each other (e.g. on a
236
237
            # case-insensitive filesystem), so we may have accidentally renamed
237
238
            # source by when we tried to rename target
238
 
            if not (file_existed and e.errno in (None, errno.ENOENT)):
239
 
                raise
 
239
            failure_exc = sys.exc_info()
 
240
            if (file_existed and e.errno in (None, errno.ENOENT)
 
241
                and old.lower() == new.lower()):
 
242
                # source and target are the same file on a case-insensitive
 
243
                # filesystem, so we don't generate an exception
 
244
                failure_exc = None
240
245
    finally:
241
246
        if file_existed:
242
247
            # If the file used to exist, rename it back into place
245
250
                unlink_func(tmp_name)
246
251
            else:
247
252
                rename_func(tmp_name, new)
 
253
    if failure_exc is not None:
 
254
        raise failure_exc[0], failure_exc[1], failure_exc[2]
248
255
 
249
256
 
250
257
# In Python 2.4.2 and older, os.path.abspath and os.path.realpath