mirror of
				https://github.com/scm-manager/scm-manager.git
				synced 2025-10-31 10:35:56 +01:00 
			
		
		
		
	Document SimpleGitWorkingCopyFactory
This commit is contained in:
		| @@ -49,11 +49,6 @@ public class SimpleSvnWorkingCopyFactory extends SimpleWorkingCopyFactory<File, | ||||
|     super(workingCopyPool); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   protected Repository getScmRepository(SvnContext context) { | ||||
|     return context.getRepository(); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   protected ParentAndClone<File, File> cloneRepository(SvnContext context, File workingCopy, String initialBranch) { | ||||
|  | ||||
| @@ -63,7 +58,7 @@ public class SimpleSvnWorkingCopyFactory extends SimpleWorkingCopyFactory<File, | ||||
|     try { | ||||
|       source = SVNURL.fromFile(context.getDirectory()); | ||||
|     } catch (SVNException ex) { | ||||
|       throw new InternalRepositoryException(getScmRepository(context), "error creating svn url from central directory", ex); | ||||
|       throw new InternalRepositoryException(context.getRepository(), "error creating svn url from central directory", ex); | ||||
|     } | ||||
|  | ||||
|     try { | ||||
| @@ -72,7 +67,7 @@ public class SimpleSvnWorkingCopyFactory extends SimpleWorkingCopyFactory<File, | ||||
|       checkout.setSource(SvnTarget.fromURL(source)); | ||||
|       checkout.run(); | ||||
|     } catch (SVNException ex) { | ||||
|       throw new InternalRepositoryException(getScmRepository(context), "error running svn checkout", ex); | ||||
|       throw new InternalRepositoryException(context.getRepository(), "error running svn checkout", ex); | ||||
|     } finally { | ||||
|       svnOperationFactory.dispose(); | ||||
|     } | ||||
| @@ -97,6 +92,6 @@ public class SimpleSvnWorkingCopyFactory extends SimpleWorkingCopyFactory<File, | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   protected void closeWorkingCopyInternal(File workingCopy) { | ||||
|   protected void closeWorkingCopy(File workingCopy) { | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -21,7 +21,7 @@ | ||||
|  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
|  * SOFTWARE. | ||||
|  */ | ||||
|      | ||||
|  | ||||
| package sonia.scm.repository.spi; | ||||
|  | ||||
| //~--- non-JDK imports -------------------------------------------------------- | ||||
| @@ -41,12 +41,13 @@ import sonia.scm.repository.SvnUtil; | ||||
|  | ||||
| import java.io.Closeable; | ||||
| import java.io.File; | ||||
| import java.util.function.Supplier; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author Sebastian Sdorra | ||||
|  */ | ||||
| public class SvnContext implements Closeable { | ||||
| public class SvnContext implements Closeable, Supplier<Repository> { | ||||
|  | ||||
|   private static final Logger LOG = LoggerFactory.getLogger(SvnContext.class); | ||||
|  | ||||
| @@ -64,6 +65,11 @@ public class SvnContext implements Closeable { | ||||
|     return repository; | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public Repository get() { | ||||
|     return getRepository(); | ||||
|   } | ||||
|  | ||||
|   public File getDirectory() { | ||||
|     return directory; | ||||
|   } | ||||
|   | ||||
| @@ -96,7 +96,7 @@ public class SimpleSvnWorkingCopyFactoryTest extends AbstractSvnCommandTestBase | ||||
|   @Test | ||||
|   public void shouldReturnRepository() { | ||||
|     SimpleSvnWorkingCopyFactory factory = new SimpleSvnWorkingCopyFactory(new NoneCachingWorkingCopyPool(workdirProvider)); | ||||
|     Repository scmRepository = factory.getScmRepository(createContext()); | ||||
|     Repository scmRepository = createContext().getRepository(); | ||||
|     assertThat(scmRepository).isSameAs(repository); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user