Would appreciate a review of this revision. In particular I assumed that _update() will never be run by two threads concurrently on the same wc path.
Thanks Daniel danie...@apache.org wrote on Thu, Aug 30, 2012 at 15:12:32 -0000: > Author: danielsh > Date: Thu Aug 30 15:12:32 2012 > New Revision: 1378980 > > URL: http://svn.apache.org/viewvc?rev=1378980&view=rev > Log: > [in tools/server-side/svnpubsub/] > > * svnwcsub.py > (BackgroundWorker._update): > Delete .revision and recreate it (just in case it's a symlink). > > Modified: > subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py > > Modified: subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py > URL: > http://svn.apache.org/viewvc/subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py?rev=1378980&r1=1378979&r2=1378980&view=diff > ============================================================================== > --- subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py (original) > +++ subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py Thu Aug 30 > 15:12:32 2012 > @@ -29,6 +29,7 @@ > # See svnwcsub.conf for more information on its contents. > # > > +import errno > import subprocess > import threading > import sys > @@ -252,7 +253,15 @@ class BackgroundWorker(threading.Thread) > ### check the loglevel before running 'svn info'? > info = svn_info(self.svnbin, self.env, wc.path) > logging.info("updated: %s now at r%s", wc.path, info['Revision']) > - open(os.path.join(wc.path, '.revision'), 'w').write(info['Revision']) > + > + ### update the .revision file > + dotrevision = os.path.join(wc.path, '.revision') > + try: > + os.unlink(dotrevision) > + except IOError, e: > + if e.errno != errno.ENOENT: > + raise > + open(dotrevision, 'w').write(info['Revision']) > > def _cleanup(self, wc): > "Run a cleanup on the specified working copy." > >