Making util.unlink() check the readonly flag for Windows support

Issue #4 open
created an issue

hg update currently dies when it tries to remove a readonly file on Windows - os.Unlink() fails unless the file is read-write. Here's a change that monkeypatches util.unlink() to behave the same way as the modified util.opener. I've factored out a couple of functions to avoid duplication.

This is useful for those of us who have to bridge to Microsoft's VCS, team foundation server. The common pattern is to clone a repo created in TFS's working directory, and work in the clone. Makewritable makes it easy to push and update changes back into the TFS working folder, but if any files have been deleted in the clone they currently need to be set read/write by hand or the update fails.

Comments (3)

  1. Log in to comment