| 164 | | File targetFile = null; |
|---|
| 165 | | if(filePath != null && filePath.length() != 0){ |
|---|
| 166 | | targetFile = new File(destDir, filePath); |
|---|
| 167 | | System.out.println(destDir + "/" + filePath); |
|---|
| 168 | | } |
|---|
| 169 | | else{ |
|---|
| 170 | | targetFile = new File(destDir, entry.getRelativePath()); |
|---|
| 171 | | System.out.println(destDir + "/" + entry.getRelativePath()); |
|---|
| 172 | | } |
|---|
| 173 | | |
|---|
| | 168 | File targetFile = createTargetFile(repository, filePath, destDir, revisionNumber); |
|---|
| 187 | | Iterator iterator = entries.iterator(); |
|---|
| 188 | | while (iterator.hasNext()) { |
|---|
| 189 | | SVNDirEntry entry = (SVNDirEntry) iterator.next(); |
|---|
| 190 | | |
|---|
| 191 | | String childPath = (filePath != null && filePath.length() != 0) ? |
|---|
| 192 | | filePath + "/" + entry.getRelativePath() : |
|---|
| 193 | | entry.getRelativePath(); |
|---|
| 194 | | |
|---|
| 195 | | // 再帰 |
|---|
| 196 | | this.doExport(repository, |
|---|
| 197 | | childPath, |
|---|
| 198 | | revision, |
|---|
| 199 | | destDir); |
|---|
| 200 | | } |
|---|
| | 182 | |
|---|
| | 183 | if(entries.size() == 0 && ignoreEmptyDir == false){ |
|---|
| | 184 | File targetFile = createTargetFile(repository, filePath, destDir, revisionNumber); |
|---|
| | 185 | targetFile.mkdirs(); |
|---|
| | 186 | } |
|---|
| | 187 | else{ |
|---|
| | 188 | Iterator iterator = entries.iterator(); |
|---|
| | 189 | while (iterator.hasNext()) { |
|---|
| | 190 | SVNDirEntry entry = (SVNDirEntry) iterator.next(); |
|---|
| | 191 | |
|---|
| | 192 | String childPath = (filePath != null && filePath.length() != 0) ? |
|---|
| | 193 | filePath + "/" + entry.getRelativePath() : |
|---|
| | 194 | entry.getRelativePath(); |
|---|
| | 195 | |
|---|
| | 196 | // 再帰 |
|---|
| | 197 | this.doExport(repository, |
|---|
| | 198 | childPath, |
|---|
| | 199 | revision, |
|---|
| | 200 | destDir, |
|---|
| | 201 | ignoreEmptyDir); |
|---|
| | 202 | } |
|---|
| | 203 | } |
|---|
| | 212 | } |
|---|
| | 213 | |
|---|
| | 214 | private File createTargetFile(SVNRepository repository, String filePath, |
|---|
| | 215 | String destDir, long revisionNumber) throws SVNException { |
|---|
| | 216 | SVNDirEntry entry = repository.info(filePath, revisionNumber); |
|---|
| | 217 | |
|---|
| | 218 | File targetFile = null; |
|---|
| | 219 | if(filePath != null && filePath.length() != 0){ |
|---|
| | 220 | targetFile = new File(destDir, filePath); |
|---|
| | 221 | System.out.println(destDir + "/" + filePath); |
|---|
| | 222 | } |
|---|
| | 223 | else{ |
|---|
| | 224 | targetFile = new File(destDir, entry.getRelativePath()); |
|---|
| | 225 | System.out.println(destDir + "/" + entry.getRelativePath()); |
|---|
| | 226 | } |
|---|
| | 227 | return targetFile; |
|---|