On Sat, 6 Jun 2020 at 21:41, Craig Russell <apache....@gmail.com> wrote: > > I tried this: > line 22: > ASF::SVN.multiUpdate (members_txt, message, env, _) do |text| > # default command is empty > command = "" > # remove user's entry > unless text.sub! entry, '' # e.g. if the workspace was out of date > raise Exception.new("Failed to remove existing entry -- try refreshing") > end > > # determine where to put the entry > if @action == 'emeritus' > index = text.index(/^\s\*\)\s/, text.index(/^Emeritus/)) > entry.sub! %r{\s*/\* deceased, .+?\*/},'' # drop the deceased comment if > necessary > # if pending emeritus request was found, move it to emeritus > extra = [] > if @emeritusfilename.index('/emeritus-requests-received/') > emeritus_url = ASF::SVN.svnurl('emeritus') > command = "svn mv #{@emeritusfilename} #{emeritus_url}" > Wunderbar.warn "memstat.json.rb action emeritus commmand: #{command}" > extra << ['mv', @emeritusfilename, emeritus_url] > end > elsif @action == 'active' > index = text.index(/^\s\*\)\s/, text.index(/^Active/)) > entry.sub! %r{\s*/\* deceased, .+?\*/},'' # drop the deceased comment if > necessary > # if emeritus file was found, move it to emeritus-reinstated > if @emeritusfilename.index('/emeritus/') > emeritus_reinstated_url = ASF::SVN.svnurl('emeritus-reinstated') > command = "svn mv #{@emeritusfilename} #{emeritus_reinstated_url}" > Wunderbar.warn "memstat.json.rb action emeritus commmand: #{command}" > end > elsif @action == 'deceased' > index = text.index(/^\s\*\)\s/, text.index(/^Deceased/)) > entry.sub! %r{\n}, " /* deceased, #{@dod} */\n" # add the deceased comment > # else > # raise Exception.new("invalid action #{action.inspect}") > end > > # perform the insertion > text.insert index, entry > > # save the updated text > ASF::Member.text = text
The update must be done by the caller. > # return the updated (and normalized) text and extra svn command > [ASF::Member.text, extra] > end if updmem #only update members.txt for secretary actions > The above is line 66 > > I got this: > { > "exception": "#<SyntaxError: > /Users/clr/apache/git/whimsy/www/roster/views/actions/memstat.json.rb:22: > syntax error, unexpected ')', expecting '='\n > ... (members_txt, message, env, _) do |text|\n... > ^\n/ I think this may indicate that the error is before line 22. > Users/clr/apache/git/whimsy/www/roster/views/actions/memstat.json.rb:66: > syntax error, unexpected `end', expecting end-of-input\n > end if updmem #only update membe...\n^~~\n>", Try using a normal if block instead, i.e. if updmem ASF::SVN... end end Also, it's really difficult to follow such a large conditional. > "backtrace": [ > "/Users/clr/apache/git/whimsy/www/roster/main.rb:204:in `block in <top > (required)>'", > "/Users/clr/apache/git/whimsy/lib/whimsy/asf/rack.rb:223:in `call'", > "/Users/clr/apache/git/whimsy/lib/whimsy/asf/rack.rb:48:in `call'", > "/Users/clr/apache/git/whimsy/lib/whimsy/asf/rack.rb:200:in `call'", > "/Users/clr/apache/git/whimsy/lib/whimsy/asf/rack.rb:254:in `call'" > ] > } > > > On Jun 6, 2020, at 9:04 AM, sebb <seb...@gmail.com> wrote: > > > > The full method name is > > > > ASF::SVN.multiUpdate > > > > There's an example call here: > > > > https://lists.apache.org/thread.html/r97d0fc64bf633e643889cba21e18b5bb60c7d068430c36c447119887%40%3Cdev.whimsical.apache.org%3E > > > > On Sat, 6 Jun 2020 at 15:47, Craig Russell <apache....@gmail.com> wrote: > >> > >> Is there an example of the use of this method? I cannot seem to call it > >> from the memstat.json.rb code. > >> > >> Thanks, > >> Craig > >> > >> > >>> On Jun 6, 2020, at 7:18 AM, s...@apache.org wrote: > >>> > >>> 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 de90463 Add dryrun to multiUpdate > >>> de90463 is described below > >>> > >>> commit de904636aedc54e7707d8e2b1858a6930058d737 > >>> Author: Sebb <s...@apache.org> > >>> AuthorDate: Sat Jun 6 15:18:19 2020 +0100 > >>> > >>> Add dryrun to multiUpdate > >>> --- > >>> lib/whimsy/asf/svn.rb | 8 ++++++-- > >>> 1 file changed, 6 insertions(+), 2 deletions(-) > >>> > >>> diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb > >>> index 6f1d722..9af5dbb 100644 > >>> --- a/lib/whimsy/asf/svn.rb > >>> +++ b/lib/whimsy/asf/svn.rb > >>> @@ -578,7 +578,7 @@ module ASF > >>> # extra << ['rm',url3] > >>> # [out, extra] > >>> # end > >>> - def self.multiUpdate(path, msg, env, _) > >>> + def self.multiUpdate(path, msg, env, _, options = {}) > >>> require 'tempfile' > >>> tmpdir = Dir.mktmpdir.untaint > >>> if File.file? path > >>> @@ -638,7 +638,11 @@ module ASF > >>> end > >>> > >>> # Now commit everything > >>> - ASF::SVN.svnmucc(cmds,msg,env,_,filerev,tmpdir) > >>> + if options[:dryrun] > >>> + puts cmds # TODO: not sure this is correct for Wunderbar > >>> + else > >>> + ASF::SVN.svnmucc(cmds,msg,env,_,filerev,tmpdir) > >>> + end > >>> ensure > >>> FileUtils.rm_rf tmpdir > >>> end > >>> > >> > >> Craig L Russell > >> c...@apache.org > >> > > Craig L Russell > c...@apache.org >