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/06 14:18:28 UTC

[whimsy] branch master updated: Add dryrun to multiUpdate

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 <se...@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


Re: [whimsy] branch master updated: Add dryrun to multiUpdate

Posted by Sam Ruby <ru...@intertwingly.net>.
On Sat, Jun 6, 2020 at 4:41 PM Craig Russell <ap...@gmail.com> wrote:
>
> I tried this:
> line 22:
> ASF::SVN.multiUpdate (members_txt, message, env, _) do |text|

delete the space between multiUpdate and the open parenthesis.

In Ruby, parenthesis are generally optional on method calls.  With the
space after the method name, Ruby tries to parse what follows as a
single parenthesized expression, and fails.

- Sam Ruby

Re: [whimsy] branch master updated: Add dryrun to multiUpdate

Posted by Craig Russell <ap...@gmail.com>.

> On Jun 6, 2020, at 3:32 PM, sebb <se...@gmail.com> wrote:
> 
> On Sat, 6 Jun 2020 at 21:41, Craig Russell <apache.clr@gmail.com <ma...@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.

Not the problem I'm trying to solve today.
> 
>>  # 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.

Could you explain a bit more? 

The code immediately before line 22:
# identify file to be updated
members_txt = File.join(ASF::SVN['foundation'], 'members.txt')

# construct commit message
message = "Move #{ASF::Person.find(@userid).member_name} to #{@action}"

# only update members if needed
updmem = @action == 'emeritus' or @action == 'active' or @action == 'deceased'

# update members.txt only for secretary actions

> 
>> 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.

I was trying to avoid indenting 44 lines just for a conditional. That will be next.

Is there some working code that uses the multiUpdate function? Love to see it.

Thanks,
Craig
> 
>>  "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 <se...@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 <ap...@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, sebb@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 <se...@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
>>>> clr@apache.org
>>>> 
>> 
>> Craig L Russell
>> clr@apache.org

Craig L Russell
clr@apache.org


Re: [whimsy] branch master updated: Add dryrun to multiUpdate

Posted by sebb <se...@gmail.com>.
On Sat, 6 Jun 2020 at 21:41, Craig Russell <ap...@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 <se...@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 <ap...@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, sebb@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 <se...@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
> >> clr@apache.org
> >>
>
> Craig L Russell
> clr@apache.org
>

Re: [whimsy] branch master updated: Add dryrun to multiUpdate

Posted by sebb <se...@gmail.com>.
The authentication is provided by the 'env' parameter.
This must support env.user and env.password queries.

It's rather difficult to advise further without sight of the full code.

On Sun, 7 Jun 2020 at 01:20, Craig Russell <ap...@gmail.com> wrote:
>
> Next problem should be easy to fix. Looks like there is some authentication needed here:
> {
>   "transcript": [
>     "$ svn checkout --depth empty --non-interactive --no-auth-cache https://svn.apache.org/repos/private/foundation /var/folders/mx/t44d3_bs437dpnywzk_mwl_0002msd/T/d20200606-97419-zmn43o",
>     "svn: E170013: Unable to connect to a repository at URL 'https://svn.apache.org/repos/private/foundation'",
>     "svn: E215004: No more credentials or we tried too many times.",
>     "Authentication failed",
>     "",
>     "$ svn update --non-interactive --no-auth-cache /var/folders/mx/t44d3_bs437dpnywzk_mwl_0002msd/T/d20200606-97419-zmn43o/members.txt",
>     "Skipped '/var/folders/mx/t44d3_bs437dpnywzk_mwl_0002msd/T/d20200606-97419-zmn43o/members.txt'",
>     "svn: E155007: None of the targets are working copies"
>   ],
>   "exception": "#<Errno::ENOENT: No such file or directory @ rb_sysopen - /var/folders/mx/t44d3_bs437dpnywzk_mwl_0002msd/T/d20200606-97419-zmn43o/members.txt>",
>   "backtrace": [
>     "/Users/clr/apache/git/whimsy/lib/whimsy/asf/svn.rb:627:in `read'",
>     "/Users/clr/apache/git/whimsy/lib/whimsy/asf/svn.rb:627:in `multiUpdate'",
>     "/Users/clr/apache/git/whimsy/www/roster/views/actions/memstat.json.rb:28:in `_evaluate'",
>     "/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'"
>   ]
> }
>
>
> Craig
> > On Jun 6, 2020, at 5:07 PM, Craig Russell <ap...@gmail.com> wrote:
> >
> > FYI: The line 22 that finally worked:
> > # update members.txt only for secretary actions
> > ASF::SVN.multiUpdate members_txt, message, env, _ do |text|
> >
> > I don't know why having the () around the arguments is a problem, but it is. Could this be a bug in the "ruby compiler"?
> >
> > Craig
> >
> >> On Jun 6, 2020, at 1:41 PM, Craig Russell <apache.clr@gmail.com <ma...@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
> >>
> >>   # 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/
> >> 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>",
> >>   "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 <sebbaz@gmail.com <ma...@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 <https://lists.apache.org/thread.html/r97d0fc64bf633e643889cba21e18b5bb60c7d068430c36c447119887%40%3Cdev.whimsical.apache.org%3E>
> >>>
> >>> On Sat, 6 Jun 2020 at 15:47, Craig Russell <apache.clr@gmail.com <ma...@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, sebb@apache.org <ma...@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 <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 <sebb@apache.org <ma...@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
> >>>> clr@apache.org <ma...@apache.org>
> >>>>
> >>
> >> Craig L Russell
> >> clr@apache.org <ma...@apache.org>
> >>
> >
> > Craig L Russell
> > clr@apache.org <ma...@apache.org>
> >
>
> Craig L Russell
> clr@apache.org
>

Re: [whimsy] branch master updated: Add dryrun to multiUpdate

Posted by Craig Russell <ap...@gmail.com>.
Next problem should be easy to fix. Looks like there is some authentication needed here:
{
  "transcript": [
    "$ svn checkout --depth empty --non-interactive --no-auth-cache https://svn.apache.org/repos/private/foundation /var/folders/mx/t44d3_bs437dpnywzk_mwl_0002msd/T/d20200606-97419-zmn43o",
    "svn: E170013: Unable to connect to a repository at URL 'https://svn.apache.org/repos/private/foundation'",
    "svn: E215004: No more credentials or we tried too many times.",
    "Authentication failed",
    "",
    "$ svn update --non-interactive --no-auth-cache /var/folders/mx/t44d3_bs437dpnywzk_mwl_0002msd/T/d20200606-97419-zmn43o/members.txt",
    "Skipped '/var/folders/mx/t44d3_bs437dpnywzk_mwl_0002msd/T/d20200606-97419-zmn43o/members.txt'",
    "svn: E155007: None of the targets are working copies"
  ],
  "exception": "#<Errno::ENOENT: No such file or directory @ rb_sysopen - /var/folders/mx/t44d3_bs437dpnywzk_mwl_0002msd/T/d20200606-97419-zmn43o/members.txt>",
  "backtrace": [
    "/Users/clr/apache/git/whimsy/lib/whimsy/asf/svn.rb:627:in `read'",
    "/Users/clr/apache/git/whimsy/lib/whimsy/asf/svn.rb:627:in `multiUpdate'",
    "/Users/clr/apache/git/whimsy/www/roster/views/actions/memstat.json.rb:28:in `_evaluate'",
    "/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'"
  ]
}


Craig
> On Jun 6, 2020, at 5:07 PM, Craig Russell <ap...@gmail.com> wrote:
> 
> FYI: The line 22 that finally worked:
> # update members.txt only for secretary actions
> ASF::SVN.multiUpdate members_txt, message, env, _ do |text|
> 
> I don't know why having the () around the arguments is a problem, but it is. Could this be a bug in the "ruby compiler"?
> 
> Craig
> 
>> On Jun 6, 2020, at 1:41 PM, Craig Russell <apache.clr@gmail.com <ma...@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
>> 
>>   # 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/
>> 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>",
>>   "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 <sebbaz@gmail.com <ma...@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 <https://lists.apache.org/thread.html/r97d0fc64bf633e643889cba21e18b5bb60c7d068430c36c447119887%40%3Cdev.whimsical.apache.org%3E>
>>> 
>>> On Sat, 6 Jun 2020 at 15:47, Craig Russell <apache.clr@gmail.com <ma...@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, sebb@apache.org <ma...@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 <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 <sebb@apache.org <ma...@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
>>>> clr@apache.org <ma...@apache.org>
>>>> 
>> 
>> Craig L Russell
>> clr@apache.org <ma...@apache.org>
>> 
> 
> Craig L Russell
> clr@apache.org <ma...@apache.org>
> 

Craig L Russell
clr@apache.org


Re: [whimsy] branch master updated: Add dryrun to multiUpdate

Posted by Craig Russell <ap...@gmail.com>.
FYI: The line 22 that finally worked:
# update members.txt only for secretary actions
ASF::SVN.multiUpdate members_txt, message, env, _ do |text|

I don't know why having the () around the arguments is a problem, but it is. Could this be a bug in the "ruby compiler"?

Craig

> On Jun 6, 2020, at 1:41 PM, Craig Russell <ap...@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
> 
>   # 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/
> 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>",
>   "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 <sebbaz@gmail.com <ma...@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 <https://lists.apache.org/thread.html/r97d0fc64bf633e643889cba21e18b5bb60c7d068430c36c447119887%40%3Cdev.whimsical.apache.org%3E>
>> 
>> On Sat, 6 Jun 2020 at 15:47, Craig Russell <ap...@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, sebb@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 <se...@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
>>> clr@apache.org
>>> 
> 
> Craig L Russell
> clr@apache.org <ma...@apache.org>
> 

Craig L Russell
clr@apache.org


Re: [whimsy] branch master updated: Add dryrun to multiUpdate

Posted by Craig Russell <ap...@gmail.com>.
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

  # 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/
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>",
  "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 <se...@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 <ap...@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, sebb@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 <se...@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
>> clr@apache.org
>> 

Craig L Russell
clr@apache.org


Re: [whimsy] branch master updated: Add dryrun to multiUpdate

Posted by sebb <se...@gmail.com>.
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 <ap...@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, sebb@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 <se...@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
> clr@apache.org
>

Re: [whimsy] branch master updated: Add dryrun to multiUpdate

Posted by Craig Russell <ap...@gmail.com>.
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, sebb@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 <se...@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
clr@apache.org