Am Donnerstag, den 11.06.2009, 16:26 +0200 schrieb Adrian Buehlmann:
> On 10.06.2009 13:23, Simon Heimberg wrote:
> > # HG changeset patch
> > # User Simon Heimberg <[email protected]>
> > # Date 1243410000 -7200
> > # Node ID a703c9b518d5fe94002f30bd5b5b7ae73792016e
> > # Parent  62587c4f0e577faca23d03048c3ad6a070660001
> > shlib: use repo.opener with atomic file for writing status file
> > 
> > like this, there is never a partialy written file
> > 
> > diff -r 62587c4f0e57 -r a703c9b518d5 thgutil/shlib.py
> > --- a/thgutil/shlib.py      Mit Jun 10 12:24:31 2009 +0200
> > +++ b/thgutil/shlib.py      Mit Mai 27 09:40:00 2009 +0200
> > @@ -92,12 +92,12 @@
> >              dirstatus[dirname(fn)] = 'm'
> >          for fn in removed + deleted:
> >              dirstatus[dirname(fn)] = 'r'
> > -        f = open(repo.join("thgstatus"), 'wb')
> > +        f = repo.opener('thgstatus', 'wb', atomictemp=True)
> >          for dn in sorted(dirstatus):
> >              s = dirstatus[dn]
> >              f.write(s + dn + '\n')
> >              ui.note("%s %s\n" % (s, dn))
> > -        f.close()
> > +        f.rename()
> >  
> >  else:
> >      def shell_notify(paths):
> > 
> 
> Simon's patch above can be applied and pushed, provided my
> patch I just sent to the list [1]:
> 
> shellext: allow other processes to rename files we have open
> 
> is applied first.
> 
> [1] 
> http://www.mail-archive.com/[email protected]/msg04595.html

Good job!

Should fh be closed when _open_osfhandle fails (and f if _fdopen fails)?

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