/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: John Arbash Meinel
  • Date: 2006-06-29 20:26:43 UTC
  • mto: (1711.4.39 win32-accepted)
  • mto: This revision was merged to the branch mainline in revision 1836.
  • Revision ID: john@arbash-meinel.com-20060629202643-db14152615498634
Change _win32_rename() so that it raises ENOENT *before* it tries any renaming.

Show diffs side-by-side

added added

removed removed

Lines of Context:
256
256
 
257
257
 
258
258
def _win32_rename(old, new):
 
259
    """We expect to be able to atomically replace 'new' with old.
 
260
 
 
261
    On win32, if new exists, it must be moved out of the way first, and then
 
262
    deleted. However, if this function is called and 'old' doesn't exist
 
263
    we should get a ENOENT error.
 
264
    """
 
265
    # Force ENOENT in the case that 'old' doesn't exist, before we do
 
266
    # all the work of trying to move the file around
 
267
    os.lstat(old)
259
268
    fancy_rename(old, new, rename_func=os.rename, unlink_func=os.unlink)
260
269
 
261
270