whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] 02/02: rough in commit from temporary directory
Date Fri, 05 Aug 2016 01:31:50 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 244d03964d7ee5cb405d963f7c402a4c24503a7d
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Thu Aug 4 21:31:24 2016 -0400

    rough in commit from temporary directory
    
    (untested)
---
 www/officers/acreq.cgi | 46 ++++++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 20 deletions(-)

diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index dc4cdef..c031b50 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -20,6 +20,7 @@ require 'whimsy/asf/rack'
 require 'mail'
 require 'date'
 require 'open3'
+require 'tmpdir'
 
 user = ASF::Auth.decode(env = {})
 unless user.asf_member? or ASF.pmc_chairs.include? user
@@ -316,27 +317,32 @@ _html do
         end
 
         unless tobe
-          # Update the new-account-reqs file...
-          File.open(REQUESTS, 'w') do |file|
-            file.write("#{requests}#{line}\n")
-          end
+          Dir.mktmpdir do |tmpdir|
+            # Checkout the ACREQ directory
+            `#{SVN} co #{ACREQ} #{tmpdir}`
+
+            # Update the new-account-reqs file...
+            File.open("#{tmpdir}/new-account-reqs.txt", 'a') do |file|
+              file.puts(line)
+            end
 
-          # and commit the change ...
-          command = "#{SVN} commit #{ACREQ}/new-account-reqs.txt -m " + 
-            "#{requestor} account request by #{user.id}".inspect
-          _h2 'Commit messages'
-          Open3.popen3(command) do |pin, pout, perr|
-            [
-              Thread.new do
-                _p.stdout pout.readline.chomp until pout.eof?
-              end,
-              Thread.new do
-                _p.stderr perr.readline.chomp until perr.eof?
-              end,
-              Thread.new do
-                pin.close
-              end
-            ].each {|thread| thread.join}
+            # and commit the change ...
+            command = "#{SVN} commit #{tmpdir}/new-account-reqs.txt -m " + 
+              "#{requestor} account request by #{user.id}".inspect
+            _h2 'Commit messages'
+            Open3.popen3(command) do |pin, pout, perr|
+              [
+                Thread.new do
+                  _p.stdout pout.readline.chomp until pout.eof?
+                end,
+                Thread.new do
+                  _p.stderr perr.readline.chomp until perr.eof?
+                end,
+                Thread.new do
+                  pin.close
+                end
+              ].each {|thread| thread.join}
+            end
           end
         end
 

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

Mime
View raw message