`
fireinjava
  • 浏览: 476218 次
  • 性别: Icon_minigender_1
  • 来自: 福州
社区版块
存档分类
最新评论

Java打Tag CvsClient

    博客分类:
  • Java
阅读更多

增量编译的时候需要一个一个文件打Tag,不方便,网上也没发现现成的资料,

还好碰到个参考http://gblyh.bokee.com/6107026.html的,下了jar包,

以下是看了参考文章与jar反编译源代码写的用Java代码打Tag。

(本人写这个目的其实是为了对用wincvs工具cvs -history的导出清单文件进行逐一打tag时方便些,

 不用在Eclipse一个一个文件右击Team-->Tag as version-->...)

 

步骤:

 

1.下载http://javacvs.netbeans.org/files/documents/51/640/org-netbeans-lib-cvsclient.jar

2.相应的代码

   

import org.netbeans.lib.cvsclient.CVSRoot;
import org.netbeans.lib.cvsclient.Client;
import org.netbeans.lib.cvsclient.admin.StandardAdminHandler;
import org.netbeans.lib.cvsclient.command.Command;
import org.netbeans.lib.cvsclient.command.CommandAbortedException;
import org.netbeans.lib.cvsclient.command.GlobalOptions;
import org.netbeans.lib.cvsclient.command.tag.TagCommand;
import org.netbeans.lib.cvsclient.commandLine.BasicListener;
import org.netbeans.lib.cvsclient.connection.AuthenticationException;
import org.netbeans.lib.cvsclient.connection.Connection;
import org.netbeans.lib.cvsclient.connection.ConnectionFactory;

public class CVSClient {

	private Client cvsclient;
	private final CVSRoot cvsroot;
	private Connection connection;
	private String localPath;

	public CVSClient(String connectionString) {
		cvsroot = CVSRoot.parse(connectionString);
	}

	public String getLocalPath() {
		return localPath;
	}

	public void setLocalPath(String localPath) {
		this.localPath = localPath;
	}

	public void openConnection() throws AuthenticationException, CommandAbortedException {
		connection = ConnectionFactory.getConnection(cvsroot);
		connection.open();
	}

	public void closeConnection() throws IOException {
		connection.close();
	}

	public void excute(Command command) throws Exception {
		cvsclient = new Client(connection, new StandardAdminHandler());
		cvsclient.setLocalPath(localPath);
		cvsclient.getEventManager().addCVSListener(new BasicListener());
		System.out.println("Command>>>>>" + command.getCVSCommand());
		cvsclient.executeCommand(command, new GlobalOptions());
	}

	public static void main(String[] args) throws Exception {
		CVSClient cvsclient = new CVSClient(":pserver:username:password@IP:/dir/dir1/dir2");
		cvsclient.setLocalPath("E:/workspace/");
		cvsclient.openConnection();
		TagCommand tagCommon = new TagCommand();
		tagCommon.setTag("TagNameXXXXX");
		tagCommon.setFiles(new File[] { new File("E:/workspace/CVSClient/src/FileVersion.java") });
		tagCommon.setTagByRevision("1.4");// 设定Tag打到哪个版本的文件上,不加的话Tag会默认打到最新版本上
		tagCommon.setOverrideExistingTag(true);// 一定要加这句
		cvsclient.excute(tagCommon);

		cvsclient.closeConnection();
	}
}

/**
 * WARNING TO DEVELOPERS: Please be warned that attempting to reuse one open connection for more commands is not
 * supported by cvs servers very well. You are advised to open a new Connection each time. If you still want to proceed,
 * please do: System.setProperty("javacvs.multiple_commands_warning", "false") That will disable this message.
 */

 

 

分享到:
评论

相关推荐

    netbean java cvs client 源码

    netbean java cvs client 源码

    CVSClient

    ADA cvs client

    Windows环境下I源码管理工具cvs client使用入门.pdf

    Windows环境下cvs client使用入门.pdf

    java导出excel (CVS格式)

    java导出CVS,csv只是一种文件的形式。。。就是按照逗号(英文逗号)分隔的文件 它的做成跟普通的文件做成是一样一样的,只需要创建一个文件(*.csv),把字符串按照一定的格式(AAA,BBB\nCCC,DDD注意必须是英文的...

    org-netbeans-lib-cvsclient.jar

    netbeans cvs lib 源码,可以方便的进行CVS编程操作

    cvs client for solaris10

    cvs client for solaris10

    eclipse-CVS-Client source code

    eclipse-CVS-Client source code

    JAVA CVS导出实例

    JAVACVS导出源码 性能比EXCEL高多了,推荐使用

    cvsclient 包+源代码

    cvsclient 开发包+源码,供大家开发学习。测试使用。

    cvs的java调用

    基于netbeans的用java改写的cvs客户端demo,包括客户端方法和调用demo;本人增加了几个客户端方法,如项目导入,获取历史各版本号,删除文件等,对需要的人可是很有用哦.发扬开源的共享精神,与各位分享,同时赚点分.

    java导出excel(CVS格式)

    java导出CVS,csv只是一种文件的形式。。。就是按照逗号(英文逗号)分隔的文件 它的做成跟普通的文件做成是一样一样的,只需要创建一个文件(*.csv),把字符串按照一定的格式(AAA,BBB\nCCC,DDD注意必须是英文的...

    java 调用cvs

    用java调用cvs客户端的过程,现在的资料很少,本人由于项目的需要下载了这个包,提供给大家

    JAVA CVS 导出实例

    JAVA源码 要点有 1. CSV的换行符号要使用CRLF既" 回车符+换行符"的形式. 2. 文字可以使用双引号围起来, 逗号可以围在双引号里面 3. 每个单引号要换成""(两个单引号)且字段要用一对单引号围住 简单的说,就是csv...

    CVS client interface in Java-开源

    Java中CVS客户端/服务器协议的实现。 它还具有用于通过命令行或使用Swing GUI进行用户交互的类。

    新linux低版本java运行cvs 和ant

    在新linux上安装 cvs 和ant,并用低版本java运行

    java_cvs_解析

    解析cvs

    ,javaswf-CVS-SNAPSHOT-1.jar包

    heritrix3项目爬虫中所使用到的一个依赖包,javaswf-CVS-SNAPSHOT-1.jar包,有需要的朋友们,赶紧下载吧, 本人亲测过. 有积分的猿友们,赏个积分,没积分的,关注博主,私信发.

    MyEclipse使用CVS.doc

    1、在eclipse中配置CVS client; 3、创建一个CVS实例; 4、实践CVS; CVS 全称Concurrent Versions System,主要用于管理在开发过程中生成的源代码、文档等资料,记录他们的更新历史,使开发团队各成员可以更好的...

    批量导出CVS-千万级数据处理

    采用POI、JXL框架导出CVS文件,支持千万级数据导出,无内存溢出,自己项目中使用中。

    NetBeans CVS source

    Java CVS Client,written in Java. Full source code is available for the library. The source is hosted as part of the Netbeans open source project.

Global site tag (gtag.js) - Google Analytics