Error “Unlinking directory not permitted” when I&#

2019-09-07 11:08发布

问题:

When I'm trying to change the branch where I am, I'm getting this error everytime:

# Just check in which branch I am
$ hg branch
django1.6

$ hg update --clean default
abandon: Unlinking directory not permitted: 'D:\Projects\abc\abc'

(abc is the project name, replace for simplicity here). Since it's a Django project, named abc, I have a subfolder abc that I have created in the django1.6 branch. This folder doesn't exist yet in the default branch, so if I'm changing the branch, the folder has to be deleted in theory
When I check the properties, I see the folder is in read-only mode, so in cygwin I chmod the folder and try again...

$ chmod -R 0777 hstareal/
$ hg update --clean default
abandon: Unlinking directory not permitted: 'D:\Projects\abc\abc'
$ hg update --clean another-already-existing-branch
abandon: Unlinking directory not permitted: 'D:\Projects\abc\abc'

For information, I can create a branch and get back to django1.6 without problems:

$ hg branch test
marked working directory as branch test
(branches are permanent and global, did you want a bookmark?)

$ hg update --clean django1.6
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

Does anyone see where the problem is? I'm sure it's something related to cygwin, but I can't see why.

回答1:

The single workaround I found for the moment is to delete the folder by hand and then update the branch.

$ rm -rf abc/
$ hg update --clean default
27 files updated, 0 files merged, 4 files removed, 0 files unresolved

Really dirty but at least it works... I'm still listening to better suggestions :)