You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/08/30 17:12:32 UTC

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

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



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

Posted by Joe Schaefer <jo...@yahoo.com>.
Well atm there's only one worker thread, so
the assumption is correct.  It's probably
a future-proof assumption as well going forward
should Greg increase the worker thread pool
for whatever reason- it's certainly not needed
with our current deployments.





>________________________________
> From: Daniel Shahaf <da...@apache.org>
>To: dev@subversion.apache.org; gstein@apache.org; joes@apache.org 
>Sent: Thursday, August 30, 2012 11:22 AM
>Subject: Re: svn commit: r1378980 - /subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py
> 
>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@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."
>> 
>> 
>
>
>

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

Posted by Daniel Shahaf <da...@apache.org>.
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@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."
> 
>