/// <summary> /// Reverts recursively the changes, made before a tree tag/branch /// </summary> /// <returns>true, if successful</returns> private bool RevertSubCopies(IDataElement iDataElement) { // traverse through childs first foreach (IDataElement itm in iDataElement.DataChilds) { if (!RevertSubCopies(itm)) { return(false); } } // reset temporary version mappings if (iDataElement is External) { External ext = (External)iDataElement; if (ext.m_sURLVersionBase.Length > 0) { ext.m_sURLVersionPath = ext.m_sURLVersionPathTemp; ext.m_sPegRevision = ext.m_sPegRevisionTemp; ext.m_sOpRevision = ext.m_sOpRevisionTemp; // update view if (iDataElement.TreeItem != null) { MainWindow wnd = (MainWindow)m_iRootElement.MainWnd; TreeItem ti = (TreeItem)iDataElement.TreeItem; ti.VersionPath = ti.VersionPath; ti.Revision = ti.Revision; wnd.RefreshTreeView(); } } } // apply external changes if (iDataElement is FolderWithExternals) { FolderWithExternals fld = (FolderWithExternals)iDataElement; fld.ApplyChanges(false, true, true); } return(true); }
private bool CreateSubCopies(IDataElement iDataElement, string sRelativePath) { // traverse through childs first foreach (IDataElement itm in iDataElement.DataChilds) { string sPath = sRelativePath; if (itm.Name.Length > 0) { sPath = sPath + "/" + itm.Name; } if (!CreateSubCopies(itm, sPath)) { return(false); } } // if working copy, create a copy for the links above if ((iDataElement is WorkingCopy) && (sRelativePath.Length > 0)) ///< only applies if working copy of sub/external (not same as top project) { WorkingCopy wc = (WorkingCopy)iDataElement; if (null == wc.m_xInfo) { wc.m_xInfo = SvnXmlInfo.GetInfo(wc.m_sPath); } string sURLVersionPath2, sURLVersionBase = General.GetVersionBase(wc.m_xInfo.m_Entries[0].m_sURL, out sURLVersionPath2), sURL = sURLVersionBase + m_sURLVersionPath; if (sURLVersionBase.Length > 0) { // check, if target path exists SvnXmlInfo xTarget = SvnXmlInfo.GetInfo(sURL); if ((xTarget == null) || (xTarget.m_Entries.Count == 0)) { int iRet = svn.Copy(wc.m_sPath, sURL, "hierarchal copy " + m_sRootProject + sRelativePath + " as " + m_sURLVersionPath, true); if (iRet != 0) { return(false); } } else { if (!m_bIgnoreExistingTargets) { MainWindow wnd = (MainWindow)iDataElement.MainWnd; switch (MessageBox.Show("Target URL\n" + sURL + "\nalready exists.\n\nContinue?\n\n(cancel = do not ask again)", "Target exists", MessageBoxButton.YesNoCancel)) { case MessageBoxResult.No: return(false); case MessageBoxResult.Cancel: m_bIgnoreExistingTargets = true; break; } } } } } // re-map version elements to project-specific copy if (iDataElement is External) { External ext = (External)iDataElement; if (ext.m_sURLVersionBase.Length > 0) { ext.m_sURLVersionPathTemp = ext.m_sURLVersionPath; ext.m_sURLVersionPath = m_sURLVersionPath; ext.m_sPegRevisionTemp = ext.m_sPegRevision; ext.m_sPegRevision = ""; ext.m_sOpRevisionTemp = ext.m_sOpRevision; ext.m_sOpRevision = ""; // update view if (iDataElement.TreeItem != null) { MainWindow wnd = (MainWindow)m_iRootElement.MainWnd; TreeItem ti = (TreeItem)iDataElement.TreeItem; ti.VersionPath = ti.VersionPath; ti.Revision = ti.Revision; wnd.RefreshTreeView(); } } } // apply changes of externals if (iDataElement is FolderWithExternals) { FolderWithExternals fld = (FolderWithExternals)iDataElement; fld.ApplyChanges(false, true, true); } return(true); }