简体   繁体   English

如何从Java应用程序读取SVN Tortoise命令

[英]How to read SVN Tortoise Command from Java application

当我正在做一个需要执行所有操作(如签出,签入,提交,回滚等)的应用程序时。请问有人可以给SVN乌龟提供命令行选项吗?

As I understand, you want to implement a Java application that calls Subversion commands. 据我了解,您想实现一个调用Subversion命令的Java应用程序。 I think there are 3 options you could go with: 我认为您可以使用3种选择:

  1. (and best one): Use SVNKit as a pure Java implementation of the Subversion API in Java. (也是最好的):将SVNKit用作Java中Subversion API的纯Java实现。 So you have there Java classes and methods and can do anything you want (if you understand how to use it correctly). 因此,您拥有Java类和方法,并且可以做任何您想做的事情(如果您了解如何正确使用它)。
  2. You could use JavaHL which is more difficult to install, but then comparable in usage to SVNKit. 您可以使用JavaHL进行安装,安装起来比较困难,但其用法与SVNKit相当。 However, the implementation differs on different platforms (no Java-only implementation), so depending on your usage scenario, it may not be an option. 但是,实现在不同的平台上有所不同(没有仅Java的实现),因此根据您的使用场景,它可能不是一个选择。
  3. You could just start svn commands from Java, but I would not do that. 您可以只从Java启动svn命令,但我不会这样做。

There is enough information available on the internet how to do the base commands with SVNKit, so just give it a try. 互联网上有足够的信息可用SVNKit执行基本命令,因此请尝试一下。

Why would you not call svn commands directly from java? 为什么不直接从Java调用svn命令? I mean can't we open a command prompt using a RunTime instance and passing the svn command to it.Is that a bad idea?If yes, what are the disadvantages? 我的意思是我们不能使用RunTime实例打开命令提示符并将svn命令传递给它,这是一个坏主意吗?

TortoiseSVN is a front end to subversion. TortoiseSVN是Subversion的前端。 See the Version Control with Subversion book for a list of all the command line commands. 有关所有命令行命令的列表,请参见《 带Subversion版本控制》一书。 Appendix E. Command Line Interface Cross Reference of the TortoiseSVN documentation provides another source for the commands. TortoiseSVN文档的附录E.命令行界面交叉参考提供了命令的另一个来源。

You will get enough help from internet about tortoise SVN . 您会从Internet上获得有关SVN乌龟的足够帮助。

You can create a repository in system folder or in Eclipse. 您可以在系统文件夹或Eclipse中创建存储库。

These steps will install SVN plug-in in Eclipse. 这些步骤将在Eclipse中安装SVN插件。

Open Eclipse. 打开Eclipse。 Go to Help Click Install New Software Click “Add” button Put “Subclipse 1.2.x (Eclipse 3.2+)” under Name and “http://subclipse.tigris.org/update_1.8.x” under Location: 转到帮助,单击“安装新软件”,然后单击“添加”按钮。将“ Subclipse 1.2.x(Eclipse 3.2+)”放在“名称”下,并将“ http://subclipse.tigris.org/update_1.8.x”放在“位置”:
Click ok Select subclipse selection option in selection window. 在选择窗口中单击确定,选择子剪辑选择选项。 Select all Click next button n/a In review the items to be installed window. 全选单击下一步按钮不适用在“检查要安装的项目”窗口中。 Click next. 点击下一步。 Licenses must be reviewed and accepted before the software can be installed. 在安装软件之前,必须检查并接受许可证。 Click I accept radio box. 单击我接受单选框。 Click finish. 单击完成。 During installation eclipse may ask for the validity of plugin being installed. 在安装过程中,eclipse可能会询问所安装插件的有效性。 Click ok After installation. 安装后单击“确定”。 Restart Eclipse. 重新启动Eclipse。

Create SVN Repository Location in Eclipse 在Eclipse中创建SVN存储库位置

In the navigator perspective, right click and choose new Choose SVN > Checkout Projects from SVN Select the option to create a new repository location. 在导航器透视图中,右键单击并选择新建。选择SVN>从SVN检出项目选择选项以创建新的存储库位置。
Fill in the location of the SVN repository (https://link-to-repository) and click next. 填写SVN信息库的位置(https:// link-to-repository),然后单击“下一步”。 Project info is loaded. 项目信息已加载。 It may ask username and password or validation of repository site certificates. 它可能会询问用户名和密码或验证存储库站点证书。 Click “accept permanently”. 点击“永久接受”。 From RAD File menu, choose Import to display the import manager. 从RAD File菜单中,选择Import以显示导入管理器。 Choose Checkout Projects from SVN. 从SVN中选择“签出项目”。 Click Next Select Use existing repository location option to enable the Next button. 单击下一步,选择使用现有存储库位置选项以启用下一步按钮。 It will load all projects from repository in “trunk”. 它将从存储库中的“ trunk”中加载所有项目。 Expand trunk menu option Select all the projects one by one to import in projects in workspace. 展开中继菜单选项,一个接一个地选择所有项目,以将其导入工作区中的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM