当我使用cygwin进行hg更新时出错“取消链接目录”

时间:2014-03-12 20:42:36

标签: mercurial cygwin branch unlink

当我尝试更改我的分支时,我每次都会收到此错误:

# 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是项目名称,此处为简洁替换)。由于它是一个名为abc的Django项目,因此我在abc分支中创建了一个子文件夹django1.6。此文件夹在默认分支中尚不存在,因此如果我要更改分支,则理论上必须删除该文件夹
当我检查属性时,我看到文件夹处于只读模式,所以在cygwin中我chmod文件夹然后再试一次......

$ 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'

有关信息,我可以创建一个分支并毫无问题地返回django1.6

$ 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

有谁知道问题出在哪里?我确定它与cygwin有关,但我不明白为什么。

1 个答案:

答案 0 :(得分:0)

我目前发现的单一解决方法是手动删除文件夹,然后更新分支。

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

真的很脏,但至少它有效...我还在听更好的建议:)