How commit several files in one shot ???

View: New views
2 Messages — Rating Filter:   Alert me  

How commit several files in one shot ???

by Giola jean-Philippe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I have a problem commiting files with svnkit!!
I can't commit several files in only 1 commit in order to have only 1
revision number for all the added files.
I have 2 repository; i want to copy files from the first repository to
the second
the repository trees aren't the same.

here my code :

editor = cibleRepositoryCheck.getCommitEditor( logMessage , null, true,
null); //cibleRepositoryCheck is the second repository
for (SVNDirEntry entry : configFilesCollection) { // I iterate on the
entries of the first repository (cibleRepository)
                ByteArrayOutputStream entryBaos = new
ByteArrayOutputStream();
               
                String entryPath = path + "/" + entry.getRelativePath();
                baseRepository.getFile( entryPath , -1 , null , entryBaos );
             
                String filePath = mission+"/"+batiment+"/"+entry.getName();
               
                editor.openRoot( -1 );
                editor.openDir(dirPath, -1 );
                editor.addFile( filePath , null , -1 );
                editor.applyTextDelta( filePath , null );

                SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator( );
                String checksum = deltaGenerator.sendDelta( filePath ,
new ByteArrayInputStream( data ) , editor , true );
                editor.closeFile(filePath, checksum);
                editor.closeDir();
                editor.closeDir();
            }
editor.closeEdit();

I have an error message : svn: File not found: transaction '325-e4'

If i open and close the editor in the "for", it works but i have several
revisions number, and i don't want that.

Please, help me.

PS : Sorry for my bad english but i'm french!

---------------------------------------------------------------------
To unsubscribe, e-mail: svnkit-users-unsubscribe@...
For additional commands, e-mail: svnkit-users-help@...


Re: How commit several files in one shot ???

by Alexander Sinyushkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!

Each path segment must be opened and closed with its own openDir() call
to ISVNEditor.
That is, if, say, you are going to open "/trunk/dirA/dirB/dirC", first
of all you need to open the root dir (suppose we have SVNRepository
bound to "/") and then
call openDir 4 times for each segment to be opened:

editor.openRoot(..);//root

editor.openDir("/trunk",..);
editor.openDir("/trunk/dirA",..);
editor.openDir("/trunk/dirA/dirB",..);
editor.openDir("/trunk/dirA/dirB/dirC",..);

then, say, you add "/trunk/dirA/dirB/dirC/file1":

editor.addFile("/trunk/dirA/dirB/dirC/file1", ..);
..
editor.closeFile(..);//close file1

and close all the segments:

editor.closeDir()://close /trunk/dirA/dirB/dirC
editor.closeDir()://close /trunk/dirA/dirB
editor.closeDir()://close /trunk/dirA
editor.closeDir()://close /trunk/
editor.closeDir()://close root - "/"

----
Alexander Sinyushkin,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!
http://sqljet.com/ - Java SQLite Library!



Giola jean-Philippe wrote:

> Hi!
>
> I have a problem commiting files with svnkit!!
> I can't commit several files in only 1 commit in order to have only 1
> revision number for all the added files.
> I have 2 repository; i want to copy files from the first repository to
> the second
> the repository trees aren't the same.
>
> here my code :
>
> editor = cibleRepositoryCheck.getCommitEditor( logMessage , null,
> true, null); //cibleRepositoryCheck is the second repository
> for (SVNDirEntry entry : configFilesCollection) { // I iterate on the
> entries of the first repository (cibleRepository)
>                ByteArrayOutputStream entryBaos = new
> ByteArrayOutputStream();
>                              String entryPath = path + "/" +
> entry.getRelativePath();
>                baseRepository.getFile( entryPath , -1 , null ,
> entryBaos );
>                            String filePath =
> mission+"/"+batiment+"/"+entry.getName();
>                              editor.openRoot( -1 );
>                editor.openDir(dirPath, -1 );
>                editor.addFile( filePath , null , -1 );
>                editor.applyTextDelta( filePath , null );
>
>                SVNDeltaGenerator deltaGenerator = new
> SVNDeltaGenerator( );
>                String checksum = deltaGenerator.sendDelta( filePath ,
> new ByteArrayInputStream( data ) , editor , true );
>                editor.closeFile(filePath, checksum);
>                editor.closeDir();
>                editor.closeDir();
>            }
> editor.closeEdit();
>
> I have an error message : svn: File not found: transaction '325-e4'
>
> If i open and close the editor in the "for", it works but i have
> several revisions number, and i don't want that.
>
> Please, help me.
>
> PS : Sorry for my bad english but i'm french!
>
> ---------------------------------------------------------------------
> 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@...