示例#1
0
        public IEnumerable <IVCDiffItem> GetFolderSubDiffItems(IVCDiffItem folderDiffItem)
        {
            List <IVCDiffItem> diffItems = new List <IVCDiffItem>();

            try
            {
                string directoryPath = m_clearCaseServer.GetViewLocalPathFromServerPath(folderDiffItem.ServerPath);
                if (Directory.Exists(directoryPath))
                {
                    foreach (string file in Directory.GetFiles(directoryPath))
                    {
                        string serverPath = m_clearCaseServer.GetServerPathFromViewLocalPath(file);
                        diffItems.Add(new ClearCaseDiffItem(serverPath, file, VCItemType.File));
                    }

                    foreach (string subDirectory in Directory.GetDirectories(directoryPath))
                    {
                        string serverPath = m_clearCaseServer.GetServerPathFromViewLocalPath(subDirectory);
                        if (ClearCasePath.Equals(ClearCasePath.GetFileName(serverPath), ClearCasePath.LostFoundFolder))
                        {
                            continue;
                        }
                        diffItems.Add(new ClearCaseDiffItem(serverPath, null, VCItemType.Folder));
                    }
                }
            }
            catch (Exception ex)
            {
                throw new VersionControlDiffException(string.Format(CultureInfo.InvariantCulture,
                                                                    CCResources.GetDiffItemsException, folderDiffItem.ServerPath, ex.Message), ex);
            }

            return(diffItems);
        }
示例#2
0
        private void createAddActionForSnapshot(ChangeGroup snapshotGroup, string localPath, bool isDirectory)
        {
            string    serverPath = m_clearCaseServer.GetServerPathFromViewLocalPath(localPath);
            CCElement element    = null;

            try
            {
                element = m_clearCaseServer.ApplicationClass.get_Element(serverPath);
            }
            catch (ArgumentException)
            {
                TraceManager.TraceWarning(String.Format("Unable to get ClearCase Element corresponding to local path: '{0}'", localPath));
                return;
            }
            snapshotGroup.CreateAction(
                WellKnownChangeActionId.Add,
                new ClearCaseMigrationItem(
                    m_clearCaseServer.ViewName,
                    element.Version.ExtendedPath,
                    isDirectory),
                null,
                serverPath,
                null,
                null,
                isDirectory ? WellKnownContentType.VersionControlledFolder.ReferenceName : WellKnownContentType.VersionControlledFile.ReferenceName,
                null);
        }
        private void generateSnapshotForVCSession()
        {
            foreach (var setting in m_configurationService.VcCustomSetting.Settings.Setting)
            {
                if (setting.SettingKey == "SnapshotStartPoint")
                {
                    m_sessionLevelSnapshotTime = parseSnapShotStartPoint(setting.SettingValue);
                }
            }

            m_hwmDelta.Reload();
            if (m_hwmDelta.Value >= m_sessionLevelSnapshotTime)
            {
                // We've already passed snapshot changeset Id, just return.
                m_sessionlevelSnapshotCompleted = true;
                return;
            }

            ChangeGroup snapshotGroup = createChangeGroupForSnapshot(m_sessionLevelSnapshotTime, 0);

            m_clearCaseServer.SetConfigSpecForSnapshotStartPoint(m_sessionLevelSnapshotTime);

            try
            {
                foreach (MappingEntry mappingEntry in m_configurationService.Filters)
                {
                    if (mappingEntry.Cloak)
                    {
                        continue;
                    }
                    string localMappingPath = m_clearCaseServer.GetViewLocalPathFromServerPath(mappingEntry.Path);
                    foreach (string subDirectory in Directory.GetDirectories(localMappingPath, "*", SearchOption.AllDirectories))
                    {
                        string serverPath = m_clearCaseServer.GetServerPathFromViewLocalPath(subDirectory);
                        snapshotGroup.CreateAction(
                            WellKnownChangeActionId.Add,
                            new ClearCaseMigrationItem(
                                m_clearCaseServer.ViewName,
                                m_clearCaseServer.ApplicationClass.get_Element(serverPath).Version.ExtendedPath,
                                true),
                            null,
                            serverPath,
                            null,
                            null,
                            WellKnownContentType.VersionControlledFolder.ReferenceName,
                            null);
                    }
                    foreach (string subFile in Directory.GetFiles(localMappingPath, "*", SearchOption.AllDirectories))
                    {
                        string serverPath = m_clearCaseServer.GetServerPathFromViewLocalPath(subFile);
                        snapshotGroup.CreateAction(
                            WellKnownChangeActionId.Add,
                            new ClearCaseMigrationItem(
                                m_clearCaseServer.ViewName,
                                m_clearCaseServer.ApplicationClass.get_Element(serverPath).Version.ExtendedPath,
                                true),
                            null,
                            serverPath,
                            null,
                            null,
                            WellKnownContentType.VersionControlledFile.ReferenceName,
                            null);
                    }
                }
            }
            finally
            {
                m_clearCaseServer.ResetConfigSpec();
            }


            snapshotGroup.Save();
            m_hwmDelta.Update(m_sessionLevelSnapshotTime);
            m_changeGroupService.PromoteDeltaToPending();
            m_sessionlevelSnapshotCompleted = true;
        }