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/09 20:00:52 UTC
[whimsy] branch master updated: Use the library method SVN.update
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 2409ee1 Use the library method SVN.update
2409ee1 is described below
commit 2409ee184cf8f2597e82243af452bd42a3ad5dd5
Author: Sebb <se...@apache.org>
AuthorDate: Tue Jun 9 21:00:12 2020 +0100
Use the library method SVN.update
---
www/secretary/public-names.cgi | 50 ++++++++++++++++--------------------------
1 file changed, 19 insertions(+), 31 deletions(-)
diff --git a/www/secretary/public-names.cgi b/www/secretary/public-names.cgi
index 7b5fc2a..fd042fc 100755
--- a/www/secretary/public-names.cgi
+++ b/www/secretary/public-names.cgi
@@ -60,33 +60,7 @@ _html do
# update SVN
unless svn_updates.empty?
- officers = Dir.mktmpdir.untaint
- _.system ['svn', 'checkout', '--depth', 'empty',
- (['--username', $USER, '--password', $PASSWORD] if $PASSWORD),
- 'https://svn.apache.org/repos/private/foundation/officers',
- officers]
-
- _.system ['svn', 'update',
- (['--username', $USER, '--password', $PASSWORD] if $PASSWORD),
- officers + '/iclas.txt']
- next unless File.exist? officers + '/iclas.txt'
- iclas = File.read(officers + '/iclas.txt')
-
- updates.each do |id, names|
- pattern = Regexp.new("^#{Regexp.escape(id)}:(.*?):(.*?):")
-
- if names['legal_name']
- iclas[pattern,1] = names['legal_name'].gsub("\u00A0", ' ')
- end
-
- if names['public_name']
- iclas[pattern,2] = names['public_name'].gsub("\u00A0", ' ')
- end
- end
-
- File.write(officers + '/iclas.txt', ASF::ICLA.sort(iclas))
- _.system ['svn', 'diff', officers + '/iclas.txt']
-
+ # construct the commit message
if svn_updates.length > 8
message = "Update #{svn_updates.length} names"
else
@@ -107,11 +81,25 @@ _html do
end
end
end
+ path = File.join(ASF::SVN.svnurl('officers'),'iclas.txt')
+ env = Struct.new(:user, :password).new($USER, $PASSWORD)
+ ASF::SVN.update(path,message,env,_) do |tmpdir, iclas|
+ updates.each do |id, names|
+ pattern = Regexp.new("^#{Regexp.escape(id)}:(.*?):(.*?):")
+
+ if names['legal_name']
+ iclas[pattern,1] = names['legal_name'].gsub("\u00A0", ' ')
+ end
+
+ if names['public_name']
+ iclas[pattern,2] = names['public_name'].gsub("\u00A0", ' ')
+ end
+ end
+
+ iclas # return the updated file
+
+ end
- _.system ['svn', 'commit', '-m', message,
- ['--no-auth-cache', '--non-interactive'],
- (['--username', $USER, '--password', $PASSWORD] if $PASSWORD),
- officers + '/iclas.txt']
end
# update LDAP