ClearCase使用c#检入和检出, [英] ClearCase checking in and out using c#

查看:307
本文介绍了ClearCase使用c#检入和检出,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我正在一个项目,我可以在clearCase中选择一个Excel文档,并运行我的功能区程序,更新表到它。我想在VisualStudio中做的是使文档,当您运行我的插件,然后检查它,一旦它完成运行后检查它。



这是可能吗?

不幸的是,它不能正常工作与我之前所说的答案,因为什么它最终做的是添加另一个版本到您的分支,而不是在主分支中创建另一个版本,我修复了这个问题:

  void GetVersions(string sourcefile)
{
ClearCase.CCElement element = m_CC.get_Element(sourcefile);

if(element!= null)
{
ClearCase.CCVersion latestVersion = null;
FileInfo fi = new FileInfo(sourcefile);

latestVersion = element.get_Version();
if(latestVersion!= null)
{
ClearCase.CCBranch branch = latestVersion.Branch;
ClearCase.CCCheckedOutFile file = latestVersion.CheckOut(ClearCase.CCReservedState.ccReserved,,false,ClearCase.CCVersionToCheckOut.ccVersion_SpecificVersion,true,false);
string path = file.ExtendedPath;
}
}
}

void checkIn(string sourcefile)
{
ClearCase.CCElement element = m_CC.get_Element(sourcefile);
element.CheckedOutFile.CheckIn(,true,sourcefile,ClearCase.CCKeepState.ccKeep);
}

这种方式你可以使用自己的分支来创建另一个版本为主文档。这在使用源代码控制时非常重要。


Basically I am working on a project where I can select an excel document within clearCase and run my ribbon program which updates the tables onto it. What I want to do in VisualStudio is make it so that the document, gets checked out when you run my addin, but then checks it back in once it is done running.

Is this possible? Thanks for the help.

解决方案

Unfortunately, it doesn't work properly with the answer I stated before because what it ends up doing is adding another version to your branch instead of creating another version in the main branch, I fixed this issue with this:

    void GetVersions(string sourcefile)
    {
        ClearCase.CCElement element = m_CC.get_Element(sourcefile);

        if (element != null)
        {
            ClearCase.CCVersion latestVersion = null;
            FileInfo fi = new FileInfo(sourcefile);

            latestVersion = element.get_Version();
           if (latestVersion != null)
            {
                ClearCase.CCBranch branch = latestVersion.Branch;
                ClearCase.CCCheckedOutFile file = latestVersion.CheckOut(ClearCase.CCReservedState.ccReserved, "", false, ClearCase.CCVersionToCheckOut.ccVersion_SpecificVersion, true, false);
                string path = file.ExtendedPath;
            }
        }
    }

    void checkIn(string sourcefile)
    {
        ClearCase.CCElement element = m_CC.get_Element(sourcefile);
        element.CheckedOutFile.CheckIn("", true, sourcefile, ClearCase.CCKeepState.ccKeep);
    }

This way you can check it back in using your own branch to create another version for the main document. This is really important when using source control.

这篇关于ClearCase使用c#检入和检出,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆