1

I have a Hg repository I created by cloning an SVN repository using hgsubversion. When I do a 'hg update --clean' I get an error: abort: Unlinking directory not permitted: 'E:\Scratch\svn_to_hg\WorkProject_hg\My Project\PublishProfiles'.

If I specify a revision, 1487, the update works fine. If I specify the revision 1488, I get the error. So rev 1488 must be the issue. This is what 1488 looks like:

> hg log -v -r 1488
changeset:   1488:d2292eeddb4e
user:        smartin@c08dbded-914e-0410-8527-b5f3b8929523
date:        Wed May 07 15:29:46 2014 +0000
files:       My Project/PublishProfiles/Shea FS.pubxml

which is me adding a file to the folder it is complaining that it can not delete.

I have 200 revisions after 1488, so I am not sure what to do here...

I am on windows 7, using hg 3.1.1, that came with Tortise HG. I did a update to the latest hgsubversion, I have also tried running the command as an administrator, and the good old 'reboot'.

Any one else have an ideas?

Update: I have an update. I am able to do the update, if I update to 1487, then I notice that the 'PublishProfiles' folder is actually an empty file! I delete that file, and then I can update to 1488 or right to tip. I guess the question now, is how can I get this so others don't have to do this everytime get clone this repository?

sheamus
  • 3,001
  • 4
  • 31
  • 54
  • 1
    You should check that the directory doesn't have the read-only flag set. (Not sure how that might happen, but just in case.) Can you remove the directory manually? – Harry Johnston Oct 09 '14 at 02:36
  • See also http://stackoverflow.com/questions/22363360/error-unlinking-directory-not-permitted-when-im-doing-hg-update-with-cygwin – Lazy Badger Oct 09 '14 at 07:00
  • Before the hg update -C the directory does not exist. After the failed update, the directory in question is there, and is read-only. When I uncheck the read-only flag via the properties dialog, it seems to set itself back to read-only immediately after again. I also notice that my other Hg repositories (which work fine) appear to have the r/o flag set on their directories. – sheamus Oct 09 '14 at 14:03
  • I ran into this problem today. For some odd reason I managed to commit an empty directory. hg doesn't support tracking dirs, only files. So it created a file with the dir name and committed that instead of a dir. When the build server build the project it created the dir correctly but made it readonly. My fix was to delete the dir-file and commit that. If you build scripts needs the dir then just create it from the build script. – Paw Baltzersen Oct 23 '14 at 11:29
  • Paw, my problem was the commit that created the empty directory was 200 commits before. No way to strip it out. Git seems to support this situation, so my solution before works fine. – sheamus Oct 23 '14 at 16:00

2 Answers2

0

I don't know if this will solve your specific problem but maybe it will help others. I'm working on windows (with sourcetree) and Linux with hg. whenever i try to do push/pull/whatever i get that message. what I did in source tree is right click the probplem causing file > stop tracking then right click again and discard file. I'm aware that this is just a temporary work around but it's better then nothing

elad silver
  • 9,222
  • 4
  • 43
  • 67
-1

Not sure if this is the best answer or not... install git. No I am not being sarcastic. The following work flawlessly for me:

git svn clone REMOTE_SVN --no-metadata --author-file=user_map.txt TEMP_GIT_REPO
hg convert -s git -d hg TEMP_GIT_REPO MY_GIT_REPO

This was actually almost twice as fast as using hgsubversion as well. You will need enable the convert extension, but I think hg ships with it, so nothing to download.

~S

sheamus
  • 3,001
  • 4
  • 31
  • 54
  • Why was this down voted, this is a good solution. Especially if you are doing one time conversions like I was. – sheamus Oct 23 '14 at 16:01