Unable to commit a directory tree with SVNKit
I've a directory containing files from a legacy build system. i want to recreate the timeline of this build system in a SVN repository.
For that, I have to take each build, extract all its files, put them in a sensible directory structure, commit the whole directory structu开发者_高级运维re to svn, and create tags for each build (in order to easily identify them). For now, I'm able to take the files from that system, put them in a directory structure, and I'm trying to put that whole directory into SVN using SVNKit (as the whole synchronization system is one using Java code).
So, what I do is
- adding all new files to svn using
SVNWCClient.doAdd(main.workDirectory, true, false, false, SVNDepth.INFINITY, false, false /* we only add files below this path */)
- Then commiting the whole directory using
SVNCommitClient.doCommit(changedFiles, false, null, commitProps, null, false, true, SVNDepth.INFINITY)
Unfortunatly, it does not work that well ...
indeed, each time i try to call those methods, i get
Exception in thread "main" org.tmatesoft.svn.core.SVNException: svn: Commit failed (details follow):
svn: 'E:\JavaWorkspace\workDirectory\subpath\deep\below\initial\path' is not under version control
and is not part of the commit,
yet its child is part of the commit
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:85)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:69)
at org.tmatesoft.svn.core.wc.SVNCommitClient.doCollectCommitItems(SVNCommitClient.java:1236)
at org.tmatesoft.svn.core.wc.SVNCommitClient.doCommit(SVNCommitClient.java:825)
at com.perigee.svnsync.SvnExecutor.commit(SvnExecutor.java:229)
at com.perigee.svnsync.SvnSynchronizer.examineRelease(SvnSynchronizer.java:40)
Caused by: org.tmatesoft.svn.core.SVNException: svn: 'E:\JavaWorkspace\workDirectory\subpath\deep\below\initial\path' is not under version control
and is not part of the commit,
yet its child is part of the commit
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
at org.tmatesoft.svn.core.internal.wc.SVNCommitUtil.harvestCommitables(SVNCommitUtil.java:546)
at org.tmatesoft.svn.core.wc.SVNCommitClient.doCollectCommitItems(SVNCommitClient.java:1208)
Notice that, when I look at this folder using TortoiseSVN, it seems like a perfectly "normal" folder to add in SVN... Furthermore, I'm able to commit the root directory and all its children using TortoiseSVn without the smallest issue. So, is it something I could/should change to my code to make it working ?
In fact, there was a subtle issue. let me explain it.
When I call SVNCommitClient.doCommit(changedFiles, false, null, commitProps, null, false, true, SVNDepth.INFINITY)
, SVNKit expects me, like real svn command line client, to give as files array (the first parameter, changedFiles
) a list of commit base directories. For more info, take a look at svn book.
What I did instead with that command is go precisely on each fole to commit it directly. unfortunatly, as it was my first commit, those files directories were not yet in SVN, and as a consequence commit failed miserably.
As a consequence, solution was to replace changedFiles
with the used root dir, and it simply worked.
精彩评论