1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
public void ajouterFichierContenuTexte(String nomFichier,
String urlSVNDestination, String contenuFichier)
throws SVNException, IOException {
// svn://, svn+xxx:// (svn+ssh:// in particular)
SVNRepositoryFactoryImpl.setup();
// create directories along the path to trunk
SVNURL trunkPath = SVNURL.parseURIDecoded(urlSVNDestination);
SVNClientManager SVN = createClientManager();
// check out a working copy of the repo
File wc = createTempDir("non-standard-layout-wc");
SVN.getUpdateClient().doCheckout(trunkPath, wc, SVNRevision.UNDEFINED,
SVNRevision.HEAD, SVNDepth.INFINITY, false);
cd(wc);
// add a file
File textFile = new File(wc, nomFichier);
FileUtils.writeStringToFile(textFile, contenuFichier);
SVN.getWCClient().doAdd(textFile, false, false, false, SVNDepth.EMPTY,
false, false);
SVN.getCommitClient().doCommit(new File[] { wc }, false, "committing",
null, null, false, false, SVNDepth.INFINITY);
} |
Partager