public override void PostChangeGroupDeltaComputation(AnalysisContext analysisContext, ChangeGroup changeGroup) { // Find the set of all Vobs used in any change action foreach (IMigrationAction action in changeGroup.Actions) { string vobName = ClearCasePath.GetVobName(action.Path); if (!m_vobNames.Contains(vobName)) { m_vobNames.Add(vobName); } } }
//******************************************************************************************** /// <summary> /// Returns the number of levels of path elements in this spec up to the maximum depth. /// \ will return 0 /// \foo will return 1 /// \foo\bar will return 2, and so on... /// </summary> /// <param name="item"></param> /// <returns></returns> //******************************************************************************************** public static int GetFolderDepth(String item) { int count = 0; if (!ClearCasePath.Equals(item, Separator)) { // Count the slashes for (int lastIndex = item.IndexOf(Separator); (lastIndex != -1); lastIndex = item.IndexOf(Separator, lastIndex + 1)) { count++; } } return(count); }
/// <summary> /// Find symbolic links of a vob and store them in the supplied hashset. /// </summary> /// <param name="vob">Vob to be searched for.</param> /// <param name="symbolicLinks">List for symbolic links found.</param> private void FindSymbolicLinks(string vob, HashSet <string> symbolicLinks) { if (symbolicLinks == null) { throw new ArgumentNullException("symbolicLinks"); } if (string.IsNullOrEmpty(vob)) { throw new ArgumentNullException("vob"); } string findOutput = ExecuteClearToolCommand(string.Format(c_findSymbolicLink, ClearCasePath.MakeRelative(vob))); if (string.IsNullOrEmpty(findOutput)) { return; } string outputLine; using (StringReader outputReader = new StringReader(findOutput)) { while (true) { outputLine = outputReader.ReadLine(); if (outputLine == null) { break; } else { // Prepend a \ to convert the output line to an absoluteVOB path string symbolicLinkPath = '\\' + outputLine; // Todo verify it is a valid path if (!symbolicLinks.Contains(symbolicLinkPath)) { symbolicLinks.Add(symbolicLinkPath); } } } } }