Exemple #1
0
        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))
                    {
                        createAddActionForSnapshot(snapshotGroup, subDirectory, true);
                    }
                    foreach (string subFile in Directory.GetFiles(localMappingPath, "*", SearchOption.AllDirectories))
                    {
                        createAddActionForSnapshot(snapshotGroup, subFile, false);
                    }
                }
            }
            finally
            {
                m_clearCaseServer.ResetConfigSpec();
            }

            snapshotGroup.Save();
            m_hwmDelta.Update(m_sessionLevelSnapshotTime);
            m_changeGroupService.PromoteDeltaToPending();
            m_sessionlevelSnapshotCompleted = true;
        }
        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;
        }