我刚刚创建了一个Java项目.我想在SVNKit的帮助下将此项目签到SVN位置.
我使用下面的代码,它将一个文件夹添加到SVN存储库.但它没有.svn在文件夹中创建任何文件夹/Users/test/svnAddDirCheck.
我希望文件被取消,并且我希望将来提交一些更改的文件.没有查看源代码,我该怎么做?我可以在SVN中添加这些文件,还可以直接提交任何更改的文件?
@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));
}
Run Code Online (Sandbox Code Playgroud)
这就是 SVN 的工作方式,如果您想提交将来的更改,您需要将本地文件夹设为工作副本,并且要获取工作副本,您需要进行签出。
我有时使用的另一种选择是
.svn文件夹的工作副本)| 归档时间: |
|
| 查看次数: |
4165 次 |
| 最近记录: |