Am Donnerstag, den 11.06.2009, 11:47 +0200 schrieb Adrian Buehlmann:
> On 11.06.2009 11:01, Adrian Buehlmann wrote:
> > On 11.06.2009 08:47, Simon Heimberg wrote:
> >> Am Mittwoch, den 10.06.2009, 21:54 +0200 schrieb Adrian Buehlmann:
> >>> On 10.06.2009 21:38, Adrian Buehlmann wrote:
> >>>> What I got was this nice little traceback here:
> >>> I forgot to mention that I get *no* traceback without Simon's patch.
> >> I confirm your test results. I agree that a possibly wrong display is
> >> better than a traceback.
> > 
> > I just tried using CreateFile [1] of windows API instead of fopen
> > 
> > I've pushed my opentest hack to bitbucket:
> > http://bitbucket.org/abuehl/opentest/src/64cc3eafedbe/opentest.cpp
> > http://bitbucket.org/abuehl/opentest/changeset/64cc3eafedbe/
> > 
> > If I specify FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE
> > for dwShareMode of CreateFile,  I can do hgtk thgstatus with your patch
> > applied while the file is held open by CreateFile.
> > 
> > The temporary file of the atomictemp is then kept as long as
> > the reading process holds the file handle open (or the process
> > dies) and then the temporary file is deleted.
> > 
> > It could be that this is the way to go anyway, as I fear we have this
> > problem anyway too with reading ".hg/dirstate" and there we can't control
> > the writing side as this is done by Mercurial.
> 
> Yes, we definitely have this problem:
> http://bitbucket.org/mirror/mercurial-crew/src/c5f36402daad/mercurial/dirstate.py#cl-371
> dirstate.write uses atomictemp+rename as well.
> 
> CuteHg project has the same problem:
> http://bitbucket.org/bfrog/cutehg-crew/src/cbd421e34fd9/win32/shellext/dirstate.c

The problem is probably not there in Mercurial because CreateFile is
used in osutil.c (Line 475). _open_osfhandle is used to get the fd (Line
488). Maybe you can do something similar?
Mercurial has the problem when it is in pure mode. When a file is opened
in python (no mater which mode), rename is not possible.
(This is what I understand after some testing and reading the message
for the changeset 7de68012f86e in hg repo.)

> > I will look into changing the shellext to use CreateFile instead of
> > fopen. First for the dirstate reader.
> > 
> > A bit annoying is, we then have to do the file reading using
> > ReadFile of winAPI ourselves (I can't use the C runtime FILE stuff
> > or the std C++ lib together with CreateFile)
> > 
> > [1] http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to