• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SvnOperationFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.tmatesoft.svn.core.wc2.SvnOperationFactory的典型用法代码示例。如果您正苦于以下问题:Java SvnOperationFactory类的具体用法?Java SvnOperationFactory怎么用?Java SvnOperationFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SvnOperationFactory类属于org.tmatesoft.svn.core.wc2包,在下文中一共展示了SvnOperationFactory类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getWcCopyRootIf17

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
@Nullable
public static File getWcCopyRootIf17(final File file, @Nullable final File upperBound) {
  File current = getParentWithDb(file);
  if (current == null) return null;

  while (current != null) {
    try {
      final SvnWcGeneration svnWcGeneration = SvnOperationFactory.detectWcGeneration(current, false);
      if (SvnWcGeneration.V17.equals(svnWcGeneration)) return current;
      if (SvnWcGeneration.V16.equals(svnWcGeneration)) return null;
      if (upperBound != null && FileUtil.filesEqual(upperBound, current)) return null;
      current = current.getParentFile();
    }
    catch (SVNException e) {
      return null;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:SvnUtil.java


示例2: downloadPackageFromGithub

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
/**
 * This method downloads an entire github repository or only a sub-directory within a repository.<br>
 * It can also download and extract an archive version of a github repository.
 * It relies on svn export command.<br>
 *
 * @param githubURL
 * @return
 */
private String downloadPackageFromGithub(String githubURL) throws SVNException {
    // Convert the githubRL to an svn format
    String svnURL = transformGithubURLToSvnURL(githubURL);

    // Save files in a system temporary directory
    String tDir = System.getProperty("java.io.tmpdir");
    String packagePath = tDir + "pkg_tmp" + System.nanoTime();
    File outputDir = new File(packagePath);

    // Perform an "svn export" command to download an entire repository or a subdirectory
    final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
    try {
        final SvnExport export = svnOperationFactory.createExport();
        export.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(svnURL)));
        export.setSingleTarget(SvnTarget.fromFile(outputDir));
        //overwrite an existing file
        export.setForce(true);
        export.run();
    } finally {
        //close connection pool associted with this object
        svnOperationFactory.dispose();
    }
    return packagePath;
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:33,代码来源:PackageDownloader.java


示例3: updateRepoForUpdate

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
private void updateRepoForUpdate(String uri)
		throws SVNException, FileNotFoundException, IOException {
	SvnOperationFactory svnFactory = new SvnOperationFactory();
	final SvnCheckout checkout = svnFactory.createCheckout();
	checkout.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(uri)));
	checkout.setSingleTarget(SvnTarget.fromFile(this.workingDir));
	checkout.run();

	// update bar.properties
	File barProps = new File(this.workingDir, "trunk/bar.properties");
	StreamUtils.copy("foo: foo", Charset.defaultCharset(),
			new FileOutputStream(barProps));
	// commit to repo
	SvnCommit svnCommit = svnFactory.createCommit();
	svnCommit.setCommitMessage("update bar.properties");
	svnCommit.setSingleTarget(SvnTarget.fromFile(barProps));
	svnCommit.run();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-config,代码行数:19,代码来源:SVNKitEnvironmentRepositoryIntegrationTests.java


示例4: close

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
@Override
public void close() throws Exception {
  shutdown(0);
  if (safeBranch) {
    new Git(repository)
        .branchDelete()
        .setBranchNames(testBranch)
        .setForce(true)
        .call();
  }
  for (SvnOperationFactory factory : svnFactories) {
    factory.dispose();
  }
  svnFactories.clear();
  repository.close();
  TestHelper.deleteDirectory(tempDirectory);
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:18,代码来源:SvnTestServer.java


示例5: simple

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
@Test
public void simple() throws Exception {
  try (SvnTestServer server = SvnTestServer.createMasterRepository()) {
    final SvnOperationFactory factory = server.createOperationFactory();

    final SvnCheckout checkout = factory.createCheckout();
    checkout.setSource(SvnTarget.fromURL(server.getUrl()));
    checkout.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory()));
    checkout.setRevision(SVNRevision.create(1));
    checkout.run();

    final SvnGetStatus status = factory.createGetStatus();
    status.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory()));
    status.setRevision(SVNRevision.create(2));
    status.run();
  }
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:18,代码来源:StatusCmdTest.java


示例6: getLocations

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
@Override
public synchronized Locations getLocations(String application, String profile,
		String label) {
	if (label == null) {
		label = this.defaultLabel;
	}
	SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
	if (hasText(getUsername())) {
		svnOperationFactory
				.setAuthenticationManager(new DefaultSVNAuthenticationManager(null,
						false, getUsername(), getPassword()));
	}
	try {
		String version;
		if (new File(getWorkingDirectory(), ".svn").exists()) {
			version = update(svnOperationFactory, label);
		}
		else {
			version = checkout(svnOperationFactory);
		}
		return new Locations(application, profile, label, version,
				getPaths(application, profile, label));
	}
	catch (SVNException e) {
		throw new IllegalStateException("Cannot checkout repository", e);
	}
	finally {
		svnOperationFactory.dispose();
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-config,代码行数:31,代码来源:SvnKitEnvironmentRepository.java


示例7: getWcCopyRootIf17

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
@Nullable
public static File getWcCopyRootIf17(final File file, @Nullable final File upperBound) {
  File current = file;
  boolean wcDbFound = false;
  while (current != null) {
    File wcDb;
    if ((wcDb = getWcDb(current)).exists() && ! wcDb.isDirectory()) {
      wcDbFound = true;
      break;
    }
    current = current.getParentFile();
  }
  if (! wcDbFound) return null;
  while (current != null) {
    try {
      final SvnWcGeneration svnWcGeneration = SvnOperationFactory.detectWcGeneration(current, false);
      if (SvnWcGeneration.V17.equals(svnWcGeneration)) return current;
      if (SvnWcGeneration.V16.equals(svnWcGeneration)) return null;
      if (upperBound != null && FileUtil.filesEqual(upperBound, current)) return null;
      current = current.getParentFile();
    }
    catch (SVNException e) {
      return null;
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:SvnUtil.java


示例8: is17CopyPart

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
public static boolean is17CopyPart(final File file) {
  try {
    return SvnWcGeneration.V17.equals(SvnOperationFactory.detectWcGeneration(file, true));
  }
  catch (SVNException e) {
    return false;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:SvnUtil.java


示例9: SvnPlugin

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
@Autowired
public SvnPlugin(DataConfigService config, FileService fileService,
		@Value("${vcs.plugin.svn.repository}") String repositoryUriString,
		@Value("${vcs.plugin.svn.username}") String repositoryUsername,
		@Value("${vcs.plugin.svn.password}") String repositoryPassword
		) {
	
	this.fileService = fileService;
	
	svnOperationFactory = new SvnOperationFactory();
	if (repositoryUsername != null && repositoryUsername != "") {
		svnOperationFactory.setAuthenticationManager(
				BasicAuthenticationManager.newInstance(repositoryUsername, repositoryPassword.toCharArray()));
	}
	
	try {
		final String uriString = repositoryUriString.replaceAll(" ", "%20");
		final URI uri = new URI(uriString);
		final SVNURL url = SVNURL.parseURIEncoded(uri.toASCIIString());
		repository = SvnTarget.fromURL(url, SVNRevision.HEAD);
		
	} catch (URISyntaxException | SVNException e) {
		throw new IllegalArgumentException("Invalid SVN repository uri!", e);
	}
	checkRepoAvailable();
	
	workingCopyDir = config.assetsNew();
	workingCopy = SvnTarget.fromFile(workingCopyDir.toFile(), SVNRevision.WORKING);
	
	initializeWorkingCopy(workingCopyDir.toFile());
}
 
开发者ID:Katharsas,项目名称:GMM,代码行数:32,代码来源:SvnPlugin.java


示例10: init

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
public void init() throws SVNException {
	
	final ISVNAuthenticationManager authManager =
                  SVNWCUtil.createDefaultAuthenticationManager("(login name)", "(login password)".toCharArray());
	
	final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
	svnOperationFactory.setAuthenticationManager(authManager);
}
 
开发者ID:Katharsas,项目名称:GMM,代码行数:9,代码来源:SVNTest.java


示例11: createOperationFactory

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
@NotNull
private SvnOperationFactory createOperationFactory(@NotNull String userName, @NotNull String password) {
  final SVNWCContext wcContext = new SVNWCContext(new DefaultSVNOptions(getTempDirectory(), true), null);
  wcContext.setSqliteTemporaryDbInMemory(true);
  wcContext.setSqliteJournalMode(SqlJetPagerJournalMode.MEMORY);

  final SvnOperationFactory factory = new SvnOperationFactory(wcContext);
  factory.setAuthenticationManager(BasicAuthenticationManager.newInstance(userName, password.toCharArray()));
  svnFactories.add(factory);
  return factory;
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:12,代码来源:SvnTestServer.java


示例12: addAndUpdate

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
/**
 * Bug: svn up doesnt remove file #18
 * <pre>
 * [email protected]:/tmp/test/git-as-svn$ echo > test.txt
 * [email protected]:/tmp/test/git-as-svn$ svn add test.txt
 * A         test.txt
 * [email protected]:/tmp/test/git-as-svn$ svn commit -m "Add new file"
 * Добавляю          test.txt
 * Передаю данные .
 * Committed revision 58.
 * [email protected]:/tmp/test/git-as-svn$ svn up -r 57
 * Updating '.':
 * В редакции 57.
 * [email protected]:/tmp/test/git-as-svn$ ls -l test.txt
 * -rw-rw-r-- 1 bozaro bozaro 1 авг.  15 00:50 test.txt
 * [email protected]:/tmp/test/git-as-svn$
 * </pre>
 *
 * @throws Exception
 */
@Test
public void addAndUpdate() throws Exception {
  try (SvnTestServer server = SvnTestServer.createEmpty()) {
    final SvnOperationFactory factory = server.createOperationFactory();
    final SVNClientManager client = SVNClientManager.newInstance(factory);
    // checkout
    final SvnCheckout checkout = factory.createCheckout();
    checkout.setSource(SvnTarget.fromURL(server.getUrl()));
    checkout.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory()));
    checkout.setRevision(SVNRevision.HEAD);
    final long revision = checkout.run();
    // create file
    File newFile = new File(server.getTempDirectory(), "somefile.txt");
    TestHelper.saveFile(newFile, "Bla Bla Bla");
    // add file
    client.getWCClient().doAdd(newFile, false, false, false, SVNDepth.INFINITY, false, true);
    // set eof property
    client.getWCClient().doSetProperty(newFile, SVNProperty.EOL_STYLE, SVNPropertyValue.create(SVNProperty.EOL_STYLE_NATIVE), false, SVNDepth.INFINITY, null, null);
    // commit new file
    client.getCommitClient().doCommit(new File[]{newFile}, false, "Add file commit", null, null, false, false, SVNDepth.INFINITY);
    // update for checkout revision
    client.getUpdateClient().doUpdate(server.getTempDirectory(), SVNRevision.create(revision), SVNDepth.INFINITY, false, false);
    // file must be remove
    Assert.assertFalse(newFile.exists());
  }
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:47,代码来源:SvnUpdateTest.java


示例13: executeSingleInfoCommand

import org.tmatesoft.svn.core.wc2.SvnOperationFactory; //导入依赖的package包/类
private InfoItem executeSingleInfoCommand( SvnJavaScmProviderRepository javaRepo, File f, String revision )
    throws ScmException
{
    try
    {
        SVNRevision svnRev = null;
        if ( revision != null )
        {
            svnRev = SVNRevision.parse( revision );
        }

        SVNInfo svnInfo = null;
        
    	boolean isVersionedDirectory = SvnOperationFactory.isVersionedDirectory(f);
    	getLogger().debug("Get info, isVersionedDirectory: " + isVersionedDirectory );
    	
    	if (isVersionedDirectory) 
    	{
        	getLogger().info("Get info from versioned directory: " + f );
    		svnInfo = javaRepo.getClientManager().getWCClient().doInfo( f, svnRev );
    	}
    	else {
    		SVNURL svnUrl = javaRepo.getSvnUrl();
        	getLogger().info("Get info from svnUrl: " + svnUrl );
        	svnInfo = javaRepo.getClientManager().getWCClient().doInfo( svnUrl, SVNRevision.UNDEFINED, svnRev );
    	}

        InfoItem currentItem = new InfoItem();

        currentItem.setRevision(
            svnInfo.getRevision() != null ? Long.toString( svnInfo.getRevision().getNumber() ) : null );
        currentItem.setLastChangedAuthor( svnInfo.getAuthor() );
        currentItem.setLastChangedRevision( svnInfo.getCommittedRevision() != null
                                                ? Long.toString( svnInfo.getCommittedRevision().getNumber() )
                                                : null );
        currentItem.setLastChangedDate(
            svnInfo.getCommittedDate() != null ? svnInfo.getCommittedDate().toString() : null );

        currentItem.setURL( svnInfo.getURL() != null ? svnInfo.getURL().toString() : null );
        currentItem.setRepositoryUUID( svnInfo.getRepositoryUUID() );
        currentItem.setRepositoryRoot(
            svnInfo.getRepositoryRootURL() != null ? svnInfo.getRepositoryRootURL().toString() : null );
        currentItem.setNodeKind( svnInfo.getKind() != null ? svnInfo.getKind().toString() : null );
        return currentItem;
    }
    catch ( SVNException e )
    {
        throw new ScmException( e.getMessage(), e );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:51,代码来源:SvnJavaInfoCommand.java



注:本文中的org.tmatesoft.svn.core.wc2.SvnOperationFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WorldManager类代码示例发布时间:2022-05-22
下一篇:
Java AvroParquetReader类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap