You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2016/04/10 13:11:26 UTC

[whimsy] branch master updated: Convert to using svnmucc

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  819fec4   Convert to using svnmucc
819fec4 is described below

commit 819fec4ebf830cec4ec824774c5c9d39f13a5017
Author: Sebb <se...@apache.org>
AuthorDate: Sun Apr 10 12:11:21 2016 +0100

    Convert to using svnmucc
---
 www/committers/subscribe.cgi | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/www/committers/subscribe.cgi b/www/committers/subscribe.cgi
index 886e3e8..aee23a4 100755
--- a/www/committers/subscribe.cgi
+++ b/www/committers/subscribe.cgi
@@ -66,13 +66,9 @@ _html do
         _h2_.error "Invalid input"
         break
       end
-      Dir.chdir '/var/tools/infra/subreq'
-      `svn update --non-interactive`
-      fn = "#{$USER}-#{@list}-#{Time.now.strftime '%Y%m%d-%H%M%S-%L'}.json".untaint
-      if File.exist? fn
-        _h2_.error "Too many concurrent requests"
-        break
-      end
+
+      # Each user can only subscribe once to each list in each timeslot
+      fn = "#{$USER}-#{@list}.json".untaint
 
       vars = {
         version: FORMAT_NUMBER,
@@ -86,17 +82,21 @@ _html do
       request = JSON.pretty_generate(vars) + "\n"
       _pre request
 
-      # commit it
-      File.open(fn, 'w') { |file| file.write request }
-      _.system(['svn', 'add', '--', fn])
-      _.system [
-        'svn', 'commit', ['--no-auth-cache', '--non-interactive'],
+      SUBREQ = 'https://svn.apache.org/repos/infra/infrastructure/trunk/subreq'
+
+      # add file to svn (--revision 0 means it won't overwrite an existing file)
+      _.system ['svnmucc',
+        ['--revision', '0'],
+        '--message', "#{@list}@ += #{$USER}",
         '--with-revprop', "whimsy:author=#{$USER}",
-        '-m', "#{@list}@ += #{$USER}",
-        (['--username', $USER, '--password', $PASSWORD] if $PASSWORD),
-        '--', fn
-      ]
-      _ 'Request successful. You will be subscribed within the hour.'
+         ['--no-auth-cache', '--non-interactive'],
+         ['--root-url', SUBREQ],
+         (['--username', $USER, '--password', $PASSWORD] if $PASSWORD),
+        '--', 'put', '-', fn],
+        stdin: request+ "\n" # seems to need extra EOL
+      
+      _p 'Request successful (unless indicated otherwise above). You will be subscribed within the hour.'
+
     end
     unless _.post?
     end

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].