I've just created a Java project. I want to check-in this project to SVN location with help of SVNKit.
I use the below code, which adds a folder to SVN repository. But it didn't create any .svn
folder in the folder /Users/test/svnAddDirCheck
.
I want the files to be cheked-in and also I want to commit some changed files in future. Without checking out the source code, how can I do this ? Can I add these files in SVN as well as I can commit any changed files directly ?
@Test
public void importWholeDir() throws Exception {
try {
DAVRepositoryFactory.setup();
SVNRepositoryFactoryImpl.setup();
FSRepositoryFactory.setup();
String svnUrl = "https://abc.com/svn/repos/projects/test/CREATE2";
File dir = new File("/Users/test/svnAddDirCheck");
SVNURL url = SVNURL.parseURIDecoded(svnUrl);
String userName = "XXXXXXX";
String userPassword = "XXXXXXXXX";
importDirectoryContentToSubversion(svnUrl, dir.getPath(), userName, userPassword, "directory and file added");
} catch (Exception e) {
e.printStackTrace();
}
}
public static SVNCommitInfo importDirectoryContentToSubversion(final String repositoryURL, final String subVersionedDirectory, final String userName, final String hashedPassword, final String commitMessage) throws SVNException {
final SVNClientManager cm = SVNClientManager.newInstance(new DefaultSVNOptions(), userName, hashedPassword);
return cm.getCommitClient().doImport(new File(subVersionedDirectory), SVNURL.parseURIEncoded(repositoryURL), "<import> " + commitMessage, null, false, true, SVNDepth.fromRecurse(true));
}