[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1378980 - /subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py

From: Daniel Shahaf <danielsh_at_apache.org>
Date: Thu, 30 Aug 2012 16:22:16 +0100

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

danielsh_at_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."
>
>
Received on 2012-08-30 17:22:27 CEST

This is an archived mail posted to the Subversion Dev mailing list.