Issue #1849 open

Shelve tool deletes patch content if error 32 occours

stefano80
created an issue

TortoiseHG fails with:

[Error 32] The process cannot access teh file because it is being used by another process

if I try to shelve only some hunks of a file and all the chunks are deleted from the original file. However the shelf patch is created with only the shelved hunks.

It's however possible to recover the changes made in .hg\Trashcan, but I feel that should be more comfortable to report the error to the user and let him/her know to stop the other process instead of updating to the original version.

I think that the file is not in use after all if it is possible to update it back to the original version... This happens when I have Visual Studio 6.0 with the same file open when I shelve. Probably after the first update Visual Studio re-reads the file blocking shelve tool to apply only selected chunks?

Comments (2)

  1. Steve Borho
    • changed status to open

    I think it's safe to say Visual Studio causes 90% of the shelve tool failures.

    Recovering from VS holding the file locked is not a simple thing to do. If it won't let us open the file for read or write, it won't let us put the original file back either.

    I've always intended for the shelve tool to have an undo button, but I've not had the time to add the feature.

  2. stefano80 reporter

    I think that Visual Studio is trying to re-load the file and locking it just for a short time.

    I know this sounds a little awkward, but perhaps waiting a little to let Visual Studio release the lock? It seems that just after the TortoiseHg operation the file is writable again.

    In any case an "Undo" button is a good solution, but this will not allow to proceed unless the file is closed in Visual Studio.

  3. Log in to comment