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): >
This makes us susceptible to the problem: windows can't rename a file that is open for reading. And shellext *is* constantly reading. We are not manipulating sensitive data here, so I would prefer not doing this. I haven't seen any problem with "partially written file" yet. thgstatus is only read for display of overlay icons for directories. So I don't want this patch ------------------------------------------------------------------------------ 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
