示例#1
0
        /// <summary>
        /// Constructor.
        /// Construct the clearcase item from a version object on ClearCase
        /// </summary>
        /// <param name="version"></param>
        public CCItem(CCVersion version, string vobName)
        {
            ItemType            = ItemType.Version;
            VersionExtendedPath = version.ExtendedPath;
            AbsoluteVobPath     = vobName;

            string[] splittedPath = VersionExtendedPath.Split(new string[] { ClearCasePath.ExtendedNamingSuffix }, StringSplitOptions.None);
            Branch = ClearCasePath.GetBranchName(splittedPath[splittedPath.Length - 1]);

            List <string> parentPaths = new List <string>();

            while (!ClearCasePath.IsVobRoot(version.Element.Path))
            {
                parentPaths.Add(ClearCasePath.GetFileName(version.Element.Path));
                try
                {
                    version = version.Parent;
                }
                catch (COMException)
                {
                    // This is a ClearCase CAL bug.
                    // Ignore the root node.
                    parentPaths.RemoveAt(parentPaths.Count - 1);
                    break;
                }
            }
            parentPaths.Reverse();

            foreach (string parentPath in parentPaths)
            {
                AbsoluteVobPath = ClearCasePath.Combine(AbsoluteVobPath, parentPath);
            }
            AbsoluteVobPath             = AbsoluteVobPath;
            AbsoluteVobPathAtTheVersion = AbsoluteVobPath;
        }
示例#2
0
        /// <summary>
        /// Get the user which did check the given file version in.
        /// </summary>
        /// <param name="fileName">Full Path of file. It can contain a Clearcase file name of the form Drive:\VOB\Directories\filename@@\branch\dd.</param>
        /// <returns>Name of checkin user or String.Empty in case of error.</returns>
        public string GetCheckinUser(string fileName)
        {
            using (Tracer t = new Tracer(myType, "GetCheckinUser"))
            {
                t.Info("Get data for file {0}", fileName);
                string userName = "";

                try
                {
                    string exactFileName = GetExactPathName(fileName);
                    t.Info("Exact cased filename is {0}", exactFileName);
                    CCVersion version    = myCCApp.get_Version(exactFileName);
                    var       createInfo = version.CreationRecord;
                    userName = createInfo.UserLoginName;
                    if (String.Compare(createInfo.Group, "syngo", true) == 0 ||
                        String.Compare(createInfo.Group, "Domain Users", true) == 0)
                    {
                        string tmpUser = createInfo.UserFullName.Replace(' ', '.');
                        if (!String.IsNullOrEmpty(tmpUser))
                        {
                            userName = tmpUser;
                        }
                    }
                }
                catch (Exception ex)
                {
                    t.Error(Level.L1, ex, "Could not retrieve file data.");
                }

                return(userName);
            }
        }