Locked .csproj file breaking Mercurial respository
I am using VisualHG inside Visual Studio. On occasion when pulling (with Fetch) I get this error message:
[Errno 13] C:\inetpub\Websites\SomeProject.csproj: The process cannot access the file because it is being used by another process
This in turn makes a mess of my repository causing me to have to delete everything and pull again. Is there anything I can do to prevent开发者_如何学Python this? It seems this issue never happens when pulling from TortoiseHG or from the command line, only when the project is opened in Visual Studio and pulling with VisualHG.
We're seeing something very similar on a machine here with TortoiseHg 2.0.4 and VS2008. It looks like Visual Studio it briefly locking the file as it detects a file modification event, and this is causing Hg to fail. We're seeing this with both TortoiseHg and the command-line client.
Whilst it's pretty frustrating when it happens during a pull
, it also happens during a merge
too, which can be pretty catastrophic.
It may be the only thing you can do is to not have Visual Studio open when you fetch
. It's not the pull
part of fetch
that's causing it, but the update
. Visual Studio seems to have a lock on your project file and won't let Mercurial change it while it's open.
You didn't specify, however, if the project was open when you used fetch
through TortoiseHG or the commandline. You could also try just pulling and updating separately rather than using fetch
.
Edit: It could also be the TortoiseHg version. I tried doing an update to a different revision earlier with an open project and Visual Studio 2008 just wanted to reload it (no file lock error), but I'm using TortoiseHg 2.0.5. You can always go back to 1.1.* if you don't like it or it doesn't work.
We have seen the same issue with file locking with Mercurial and VS2008, but unrelated to the .csproj files. We don't even version control our project files as they are generated by cmake and we version control our cmake files instead.
This problem has caused me to lose a days worth of work in one case and caused improper merges in other cases in that older files were overwriting newer files.
I was using the fetch extension when these things happened.
Z:>hg --version Mercurial Distributed SCM (version 1.9.2) (see http://mercurial.selenic.com for more information)
Copyright (C) 2005-2011 Matt Mackall and others This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
精彩评论