mirror of
				https://github.com/scm-manager/scm-manager.git
				synced 2025-10-31 18:46:07 +01:00 
			
		
		
		
	fix get modifications for SVN
This commit is contained in:
		| @@ -4,6 +4,8 @@ import lombok.extern.slf4j.Slf4j; | ||||
| import org.tmatesoft.svn.core.SVNException; | ||||
| import org.tmatesoft.svn.core.SVNLogEntry; | ||||
| import org.tmatesoft.svn.core.io.SVNRepository; | ||||
| import org.tmatesoft.svn.core.wc.SVNClientManager; | ||||
| import org.tmatesoft.svn.core.wc.admin.SVNLookClient; | ||||
| import sonia.scm.repository.InternalRepositoryException; | ||||
| import sonia.scm.repository.Modifications; | ||||
| import sonia.scm.repository.Repository; | ||||
| @@ -23,20 +25,31 @@ public class SvnModificationsCommand extends AbstractSvnCommand implements Modif | ||||
|   @Override | ||||
|   @SuppressWarnings("unchecked") | ||||
|   public Modifications getModifications(String revision) { | ||||
|     Modifications modifications = null; | ||||
|     final Modifications modifications = new Modifications(); | ||||
|     log.debug("get modifications {}", revision); | ||||
|     try { | ||||
|       long revisionNumber = SvnUtil.parseRevision(revision, repository); | ||||
|       SVNRepository repo = open(); | ||||
|       Collection<SVNLogEntry> entries = repo.log(null, null, revisionNumber, | ||||
|         revisionNumber, true, true); | ||||
|       if (Util.isNotEmpty(entries)) { | ||||
|         modifications = SvnUtil.createModifications(entries.iterator().next(), revision); | ||||
|       if (SvnUtil.isTransactionEntryId(revision)) { | ||||
|  | ||||
|         SVNLookClient client = SVNClientManager.newInstance().getLookClient(); | ||||
|         client.doGetChanged(context.getDirectory(), SvnUtil.getTransactionId(revision), | ||||
|           e -> SvnUtil.appendModification(modifications, e.getType(), e.getPath()), true); | ||||
|  | ||||
|         return modifications; | ||||
|  | ||||
|       } else { | ||||
|  | ||||
|         long revisionNumber = SvnUtil.getRevisionNumber(revision, repository); | ||||
|         SVNRepository repo = open(); | ||||
|         Collection<SVNLogEntry> entries = repo.log(null, null, revisionNumber, | ||||
|           revisionNumber, true, true); | ||||
|         if (Util.isNotEmpty(entries)) { | ||||
|           return SvnUtil.createModifications(entries.iterator().next(), revision); | ||||
|         } | ||||
|       } | ||||
|     } catch (SVNException ex) { | ||||
|       throw new InternalRepositoryException(repository, "could not open repository", ex); | ||||
|     } | ||||
|     return modifications; | ||||
|     return null; | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   | ||||
		Reference in New Issue
	
	Block a user