Turns out that --revision 0 no longer works. [1]

However it should be possible to do the following:
Get the revision of the parent directory
Check that the target file does not exist yet
Use svnmucc to put the file using the revision obtained above.

If the target file is created in the meantime, svnmucc put will fail
because the target repo revision will no longer agree.
Not as nice as using --revision 0.

I agree it would be useful to have a method to do it.
I'll get working on it.

[1] https://svn.haxx.se/users/archive-2017-06/0026.shtml

On Mon, 6 Jul 2020 at 20:44, sebb <seb...@gmail.com> wrote:
>
> On Mon, 6 Jul 2020 at 19:41, Craig Russell <apache....@gmail.com> wrote:
> >
> > Hi,
> >
> > I'm looking at updating memstat.json.rb to create a new file, e.g. 
> > foundation/emeritus-requests-received/clr.txt [1]
> >
> > I've looked around and have not found anything that might shorten the work. 
> > What I'd like is something like ASF::SVN.create!(directory, filename, 
> > contents) that would return 0 if everything worked ok or throw a runtime 
> > exception if the file already existed or anything else bad happened.
> >
> > Is this code on the right track? Is it worth trying to make a generic 
> > function for it?
> >
> > Thanks,
> > Craig
> >
> > [1]  # Add the emeritus request to svn
> >   require 'tempfile'
> >   Dir.mktmpdir do |tmpdir|
> >     parenturl = ASF::SVN.svnurl('emeritus-requests-received').untaint
> >     ASF::SVN.svn_!('checkout', [parenturl, tmpdir], _, {depth: 'files', 
> > env: env})
> >     Dir.chdir(tmpdir) do
> >     # Test for file already exists; should not get here (POST request) if 
> > it exists
> >     File.write(filename, signed_request)
> >     ASF::SVN.svn_!('add', filename, _, {env: env})
> >     ASF::SVN.svn_!('propset', ['svn:mime-type', 'text/plain; 
> > charset=utf-8', filename], _, {env: env})
> >     ASF::SVN.svn_!('commit', [filename], _, {env: env})
> >     end
> >   end
>
> Probably easiest to use svnmucc for this.
>
> The put command copies a local file to the repo, and if you specify
> revision 0 it will fail if there is already such a file.
> It also supports propset, and AFAIK it will work on a brand new file.
>
>
> >
> > Craig L Russell
> > c...@apache.org
> >

Reply via email to