Esempio n. 1
0
        private void SyncUserAccount(XmlDocument xmlDocument, WitMetadataSyncPolicy witMetadataSyncPolicy)
        {
            if (witMetadataSyncPolicy != WitMetadataSyncPolicy.TakeTheirs)
            {
                throw new NotImplementedException();
            }

            byte[] newDocHash  = new byte[0];
            bool   hashMatched = m_md5Utility.CompareDocHash(xmlDocument, m_userAccountsDocMD5, ref newDocHash);

            if (!hashMatched)
            {
                XmlNodeList globGroupNodes = xmlDocument.SelectNodes("/UserGroups/GlobalGroups/Identity");
                XmlNodeList projGroupNodes = xmlDocument.SelectNodes("/UserGroups/ProjectGroups/Identity");

                Identity[] globalGroupsOther  = GetIdentities(globGroupNodes);
                Identity[] projectGroupsOther = GetIdentities(projGroupNodes);

                Project    p = m_migrationSource.WorkItemStore.WorkItemStore.Projects[m_migrationSource.WorkItemStore.Core.Config.Project];
                Identity[] globalGroupsThis  = m_migrationSource.WorkItemStore.GetGlobalGroups(p);
                Identity[] projectGroupsThis = m_migrationSource.WorkItemStore.GetProjectGroups(p);

                SymDiff <Identity> globs = new SymDiff <Identity>(globalGroupsOther, globalGroupsThis, this);
                SymDiff <Identity> projs = new SymDiff <Identity>(projectGroupsOther, projectGroupsThis, this);

                m_migrationSource.WorkItemStore.SyncAccounts(globs.LeftOnly, projs.LeftOnly);

                m_md5Utility.UpdateDocHash(ref m_userAccountsDocMD5, newDocHash);
            }
        }
Esempio n. 2
0
        private void SyncIterationPaths(XmlDocument xmlDocument, WitMetadataSyncPolicy witMetadataSyncPolicy)
        {
            bool otherSideIsMaster = false;

            foreach (CustomSetting setting in m_configurationService.PeerMigrationSource.CustomSettings.CustomSetting)
            {
                if (setting.SettingKey.Equals(TfsConstants.DisableIterationPathAutoCreation, StringComparison.InvariantCultureIgnoreCase))
                {
                    otherSideIsMaster = true;
                }
            }

            if (witMetadataSyncPolicy == WitMetadataSyncPolicy.TakeTheirs)
            {
                byte[] newDocHash  = new byte[0];
                bool   hashMatched = m_md5Utility.CompareDocHash(xmlDocument, m_iterationPathDocMD5, ref newDocHash);
                if (!hashMatched)
                {
                    m_migrationSource.WorkItemStore.SyncIterationPaths(xmlDocument, otherSideIsMaster);
                    m_md5Utility.UpdateDocHash(ref m_iterationPathDocMD5, newDocHash);
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Esempio n. 3
0
 private void SyncGlobalList(XmlDocument xmlDocument, WitMetadataSyncPolicy witMetadataSyncPolicy)
 {
     if (witMetadataSyncPolicy == WitMetadataSyncPolicy.TakeTheirs)
     {
         byte[] newDocHash  = new byte[0];
         bool   hashMatched = m_md5Utility.CompareDocHash(xmlDocument, m_globalListDocMD5, ref newDocHash);
         if (!hashMatched)
         {
             m_migrationSource.WorkItemStore.UploadGlobalList(xmlDocument);
             m_md5Utility.UpdateDocHash(ref m_globalListDocMD5, newDocHash);
         }
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Esempio n. 4
0
        private void SyncWorkItemTypeDefinition(XmlDocument xmlDocument, WitMetadataSyncPolicy witMetadataSyncPolicy)
        {
            if (witMetadataSyncPolicy != WitMetadataSyncPolicy.TakeTheirs)
            {
                throw new NotImplementedException();
            }

            var customSettings = m_configurationService.MigrationSource.CustomSettings.CustomSetting;
            WITDUpdateCommands witdUpdateCommands = new WITDUpdateCommands(customSettings);

            AddReflectedWorkItemId(witdUpdateCommands);

            byte[] newDocHash  = new byte[0];
            bool   hashMatched = m_md5Utility.CompareDocHash(xmlDocument, m_witdDocMD5, ref newDocHash);

            if (!hashMatched)
            {
                UpdateSchemaNamespace(xmlDocument);

                XmlNode workItemTypes = xmlDocument.SelectSingleNode("WorkItemTypes");

                XmlNode workItemTypeDef = workItemTypes.FirstChild;
                while (null != workItemTypeDef)
                {
                    XmlDocument witdDoc = new XmlDocument();
                    XmlNode     root    = witdDoc.ImportNode(workItemTypeDef, true);
                    witdDoc.AppendChild(root);

                    IWITDSyncer witdSyncer = new TfsWITDSyncer(witdDoc, m_migrationSource.WorkItemStore);
                    witdUpdateCommands.Process(witdSyncer);
                    witdSyncer.Sync();

                    workItemTypeDef = workItemTypeDef.NextSibling;
                }

                m_md5Utility.UpdateDocHash(ref m_witdDocMD5, newDocHash);
            }
        }