Hello Stephane,
> So when looking at the API, I cannot see any decent way to actually do
> while being already in a transaction (CommitEditor) as it just breaks if
> a directory/file is already there. It does not allow me to check if
> something is already added...I have to keep a hashmap of nodes and more
> or less duplicate what is already done within DAVCommitEditor. Is this
> correct ?
I'd suggest you to use another instance of SVNRepository and call
checkPath for each file prior to commit - this way you'll get the
information on whether file or directory already exist in repository.
Then, call editor.addFile/Dir for new files and editor.openFile/Dir for
existing files. Or report an error if you wouldn't like to commit a file
if it is already there.
Using checkPath will also make your code work over all protocols, not
only over DAV.
Alexander Kitaev,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!
Stephane Bailliez wrote:
> hello,
>
> I just spent a few hours with the API and I fail to find a decent
> solution that would not require massive amount of plumbing...
> I went over the wiki but cannot find anything remotely close to my
> problems. I'm trying to port some code that is doing multiple commits of
> files and directories (basically each addDir and addFile has its own
> associated commit) into a single unique one.
>
> I have a list of files and path that I need to add to a repository base
> url.
> Each file may be in a path that may or may not be already in the
> repository.
>
> So I may have repository url
https://svn.me.com/repos/project/module> and a list of files to add to this directory such as:
> this/is/path/1/file.txt
> this/is/path/1/a/a.txt
> this/is/path/1/b/b.txt
>
> (and I need to have everything in a single transaction)
>
> So when looking at the API, I cannot see any decent way to actually do
> while being already in a transaction (CommitEditor) as it just breaks if
> a directory/file is already there. It does not allow me to check if
> something is already added...I have to keep a hashmap of nodes and more
> or less duplicate what is already done within DAVCommitEditor. Is this
> correct ?
>
> Now 2nd question. It is possible that one or more of this path is
> already existing on the remote repository. What is the most appropriate
> way to do it within an open commiteditor ? Is duplicating a repository
> instance and checking each node the way to go or is there something that
> already exists to simplify this work ?
>
> cheers
>
> -- stephane
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
svnkit-users-unsubscribe@...
> For additional commands, e-mail:
svnkit-users-help@...
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail:
svnkit-users-unsubscribe@...
For additional commands, e-mail:
svnkit-users-help@...