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 2020/06/27 13:04:09 UTC

[whimsy] branch master updated: Use library update method

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8273789  Use library update method
8273789 is described below

commit 82737897ccb520088005a274fc6d887dcd919c3a
Author: Sebb <se...@apache.org>
AuthorDate: Sat Jun 27 14:04:02 2020 +0100

    Use library update method
---
 www/roster/views/actions/ppmc.json.rb | 34 ++++------------------------------
 1 file changed, 4 insertions(+), 30 deletions(-)

diff --git a/www/roster/views/actions/ppmc.json.rb b/www/roster/views/actions/ppmc.json.rb
index 897e288..e0d1320 100644
--- a/www/roster/views/actions/ppmc.json.rb
+++ b/www/roster/views/actions/ppmc.json.rb
@@ -86,18 +86,9 @@ if env.password
 
   # update podlings.xml
   if @targets.include? 'mentor'
-    Dir.mktmpdir do |tmpdir|
-      # checkout committers/board
-      Kernel.system 'svn', 'checkout', '--quiet', '--depth=empty',
-        '--no-auth-cache', '--non-interactive',
-        '--username', env.user.untaint, '--password', env.password.untaint,
-        'https://svn.apache.org/repos/asf/incubator/public/trunk/content',
-         tmpdir.untaint
-
-      # read in podlings.xml
-      file = File.join(tmpdir, 'podlings.xml')
-      Kernel.system 'svn', 'update', '--quiet', file
-      podlings = File.read(file)
+    path = File.join(ASF::SVN.svnurl('incubator-content'), 'podlings.xml').untaint
+    msg = "#{@project} #{target} #{@action == 'add' ? '+' : '-'}= #{who}".untaint
+    ASF::SVN.update(path, msg, env, _, {}) do |tmpdir, podlings|
 
       pre = /<podling[^>]* resource="#{@project}".*?<\/podling>/m
       people.each do |person|
@@ -121,24 +112,7 @@ if env.password
         end
       end
 
-      # write file out to disk
-      File.write(file, podlings)
-
-      # commit changes
-      rc = Kernel.system 'svn', 'commit', '--quiet',
-        '--no-auth-cache', '--non-interactive',
-        '--username', env.user.untaint, '--password', env.password.untaint,
-        tmpdir.untaint, '--message',
-        "#{@project} #{target} #{@action == 'add' ? '+' : '-'}= #{who}".untaint
-
-      if rc
-        # update cache
-        cache = ASF::Config.get(:cache)
-        File.write("#{cache}/podlings.xml", podlings) if Dir.exist? cache
-      else
-        # die
-        raise Exception.new('Update podlings.xml failed')
-      end
+      podlings
     end
   end