开发者

Clear case check in method c#

开发者 https://www.devze.com 2023-03-25 18:33 出处:网络
Within my program I have a method that checks out a file but I need to be able to check it back in again,

Within my program I have a method that checks out a file but I need to be able to check it back in again,

 ClearCase.ClearTool CCTool = new ClearCase.ClearTool();
    ClearCase.Application m_CC = new ClearCase.Application();
    ClearCase.CCCheckedOutFile file = null;

            void GetVersions(string sourcefile, string destinationP开发者_如何学Goath)
            {
                ClearCase.CCElement element = m_CC.get_Element(sourcefile);

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

                    latestVersion = element.get_Version("\\main\\LATEST");
                    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;
                    }
                }
            }

What this will do is check out the latest version and create it on your own branch, would there be a way of checking it back in so you are putting it on the main with a new version.

Thanks, Berbies


Once you have CCCheckoutFile objects, you can call the checkin method on them to check them in:

Function CheckIn([ Comment As String = "" ], 
                 [ EvenIfIdentical As Boolean = False ], 
                 [ FromPath As String = "" ], 
                 [ KeepState As CCKeepState = ccKeep ]) As CCVersion

If you don't have those objects, you need to get them first, like in this CCCheckedOutFileQuery for instance.

Or, for just one given file, you can determine if a file is checked-out to a particular view.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号