whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Convert to using svnmucc
Date Sun, 10 Apr 2016 11:11:26 GMT
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 <sebb@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" <commits@whimsical.apache.org>'].

Mime
View raw message