public PvcsCompleteSystemArchiveDetail(string reportPath, PvcsArchiveDetailLevel pvcsArchiveDetailLevel) { bool useProdChange = true; const string allGroupFilename = "AllGroup.txt"; const string prodChangeFilename = "ProdChange.txt"; string prodChangeFilenameWithPath = Path.Combine(reportPath, prodChangeFilename); string allGroupFilenameWithPath = Path.Combine(reportPath, allGroupFilename); if (useProdChange) { // Import from ProdChange Report if (File.Exists(prodChangeFilenameWithPath)) { Console.WriteLine(); Console.WriteLine("{0} : Adding PVCS Archive revisions that contain changes", DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss")); try { using (StreamReader fileStream = new StreamReader(prodChangeFilenameWithPath)) { string currentArchiveName = null; while (!fileStream.EndOfStream) { string fileLine = fileStream.ReadLine().Trim(); string archiveName; string archiveDetailText; ParseArchiveInformation(fileLine, out archiveName, out archiveDetailText); PvcsArchiveDetail pvcsArchiveDetail; if (currentArchiveName == null) { // No archive name so far currentArchiveName = archiveName; pvcsArchiveDetail = new PvcsArchiveDetail(archiveName); PvcsArchiveDetailCollection.Add(archiveName, pvcsArchiveDetail); } else { // Existing current archive if (String.Compare(currentArchiveName, archiveName, /*ignore case*/ true) == 0) { // Get the existing Archive Detail pvcsArchiveDetail = PvcsArchiveDetailCollection[archiveName]; } else { // Different Archive currentArchiveName = archiveName; pvcsArchiveDetail = new PvcsArchiveDetail(archiveName); PvcsArchiveDetailCollection.Add(archiveName, pvcsArchiveDetail); } } // Existing current archive pvcsArchiveDetail.AddArchiveDetail(archiveDetailText); } // while not end of stream } // using StreamReader } catch (Exception) { throw new UnableToOpenFileException(prodChangeFilename); } Console.WriteLine(); Console.WriteLine("{0} : Completed adding PVCS Archives revisions that contain changes", DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss")); } else { throw new FileNotFoundException(prodChangeFilenameWithPath); } } // Import from ProdChange Report if (File.Exists(allGroupFilenameWithPath)) { // Import any archives not included in the ProdChange import // The ProdChange Report only contains Archives with changes Console.WriteLine(); Console.WriteLine("{0} : Adding revisions for PVCS Archives that contain no changes (Production only)", DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss")); Console.WriteLine(); try { using (StreamReader fileStream = new StreamReader(allGroupFilenameWithPath)) { while (!fileStream.EndOfStream) { string fileLine = fileStream.ReadLine().Trim(); string archiveName; string archiveDetailText; ParseArchiveInformation(fileLine, out archiveName, out archiveDetailText); if (!PvcsArchiveDetailCollection.ContainsKey(archiveName)) { // Add a report entry for an Archive that has no changes if (useProdChange) { Console.WriteLine("{0}{1} : Adding \"{2}\"", ConsoleDisplay.Indent(1), archiveName, archiveDetailText); } PvcsArchiveDetail pvcsArchiveDetail = new PvcsArchiveDetail(archiveName); pvcsArchiveDetail.AddArchiveDetail(archiveDetailText); PvcsArchiveDetailCollection.Add(archiveName, pvcsArchiveDetail); } // Add a report entry for an Archive that has no changes } } } catch (Exception) { throw new UnableToOpenFileException(allGroupFilenameWithPath); } Console.WriteLine(); Console.WriteLine("{0} : Completed adding revisions for PVCS Archives that contain no changes (Production only)", DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss")); } // Import any archives not included in the ProdChange import else { throw new FileNotFoundException(allGroupFilenameWithPath); } Console.WriteLine(); Console.WriteLine("{0} : Adding list of PVCS Source Revisions that represent generated files", DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss")); Console.WriteLine(); // These generated files should really be read from a file but I've put them here // Don't add these files as ignored because, although most of them are generated and will represent // differences between a Promotion Group Share and a Repository, they should be change controlled //_pvcsArchiveIgnoreSet.Add(@"Z:\Endsleigh\AssemblyInfo.cpp"); //_pvcsArchiveIgnoreSet.Add(@"Z:\Endsleigh\AssemblyInfo.cs"); //_pvcsArchiveIgnoreSet.Add(@"Z:\Endsleigh\AssemblyInfo.vb"); _pvcsArchiveIgnoreSet.Add(@"Z:\Endsleigh\Legacy\INETFoundation\Types\BaseEnumerations.cs"); _pvcsArchiveIgnoreSet.Add(@"Z:\Endsleigh\Legacy\INETFoundation\Types\ClientEnumerations.cs"); _pvcsArchiveIgnoreSet.Add(@"Z:\Endsleigh\Legacy\INETFoundation\Types\HouseholdEnumerations.cs"); _pvcsArchiveIgnoreSet.Add(@"Z:\Endsleigh\Legacy\INETFoundation\Types\MotorEnumerations.cs"); _pvcsArchiveIgnoreSet.Add(@"Z:\Endsleigh\Legacy\INETFoundation\Types\NicheEnumerations.cs"); // This one is not generated //_pvcsArchiveIgnoreSet.Add(@"Z:\Endsleigh\Legacy\INETFoundation\Types\TravelEnumerations.cs"); if (_pvcsArchiveIgnoreSet.Count < 1) { Console.WriteLine("{0} : No PVCS Source Revisions exist in the set of generated files", DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss")); } else { foreach (string archiveSetIgnoreEntry in _pvcsArchiveIgnoreSet) { Console.WriteLine("{0}{1}", ConsoleDisplay.Indent(1), archiveSetIgnoreEntry); } } Console.WriteLine(); Console.WriteLine("{0} : Completed adding list of PVCS Source Revisions that represent generated files", DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss")); } // Constructor
public PvcsCompleteSystemArchiveDetail(string reportPath, PvcsArchiveDetailLevel pvcsArchiveDetailLevel) { const string allGroupFilename = "AllGroup.txt"; const string prodChangeFilename = "ProdChange.txt"; string prodChangeFilenameWithPath = Path.Combine(reportPath, prodChangeFilename); string allGroupFilenameWithPath = Path.Combine(reportPath, allGroupFilename); if (File.Exists(prodChangeFilenameWithPath)) { using (StreamReader fileStream = new StreamReader(prodChangeFilenameWithPath)) { string currentArchiveName = null; while (!fileStream.EndOfStream) { string fileLine = fileStream.ReadLine().Trim(); string archiveName; string archiveDetailText; ParseArchiveInformation(fileLine, out archiveName, out archiveDetailText); PvcsArchiveDetail pvcsArchiveDetail; if (currentArchiveName == null) { // No archive name so far currentArchiveName = archiveName; pvcsArchiveDetail = new PvcsArchiveDetail(archiveName); PvcsArchiveDetailCollection.Add(archiveName, pvcsArchiveDetail); } else { // Existing current archive if (String.Compare(currentArchiveName, archiveName, /*ignore case*/ true) == 0) { // Get the existing Archive Detail pvcsArchiveDetail = PvcsArchiveDetailCollection[archiveName]; } else { // Different Archive currentArchiveName = archiveName; pvcsArchiveDetail = new PvcsArchiveDetail(archiveName); PvcsArchiveDetailCollection.Add(archiveName, pvcsArchiveDetail); } } // Existing current archive pvcsArchiveDetail.AddArchiveDetail(archiveDetailText); } // while not end of stream } // using StreamReader } if (File.Exists(allGroupFilenameWithPath)) { using (StreamReader fileStream = new StreamReader(allGroupFilenameWithPath)) { while (!fileStream.EndOfStream) { string fileLine = fileStream.ReadLine().Trim(); string archiveName; string archiveDetailText; ParseArchiveInformation(fileLine, out archiveName, out archiveDetailText); if (!PvcsArchiveDetailCollection.ContainsKey(archiveName)) { // Add a report entry for an Archive that has no changes PvcsArchiveDetail pvcsArchiveDetail = new PvcsArchiveDetail(archiveName); pvcsArchiveDetail.AddArchiveDetail(archiveDetailText); PvcsArchiveDetailCollection.Add(archiveName, pvcsArchiveDetail); } // Add a report entry for an Archive that has no changes } } } } // Constructor
public PvcsAllArchiveDetail(string filename) { if (File.Exists(filename)) { using (StreamReader fileStream = new StreamReader(filename)) { string currentArchiveName = null; while (!fileStream.EndOfStream) { string fileLine = fileStream.ReadLine().Trim(); string archiveName; string archiveDetailText; if (fileLine[0] != '"') { // Spaces in the filename string[] archiveDetailPart = fileLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); archiveName = archiveDetailPart[0]; archiveDetailText = fileLine.Substring(archiveName.Length).TrimStart(new char [] { ' ', '-' }); } // Spaces in the filename else { // No spaces in the filename int endDoubleQuoteIndex = fileLine.IndexOf('"', 1); archiveName = fileLine.Substring(1, endDoubleQuoteIndex - 1); string[] archiveDetailPart = fileLine.Substring(endDoubleQuoteIndex + 1).Split(new char[] { ' ' }, StringSplitOptions. RemoveEmptyEntries); // The Archive Details follow the last double quote archiveDetailText = fileLine.Substring(archiveName.Length + 2).TrimStart(new char[] { ' ', '-' }); } // No spaces in the filename PvcsArchiveDetail pvcsArchiveDetail; if (currentArchiveName == null) { // No archive name so far currentArchiveName = archiveName; pvcsArchiveDetail = new PvcsArchiveDetail(archiveName); PvcsArchiveDetailCollection.Add(archiveName, pvcsArchiveDetail); } else { // Existing current archive if (String.Compare(currentArchiveName, archiveName, /*ignore case*/ true) == 0) { // Get the existing Archive Detail pvcsArchiveDetail = PvcsArchiveDetailCollection[archiveName]; } else { // Different Archive currentArchiveName = archiveName; pvcsArchiveDetail = new PvcsArchiveDetail(archiveName); PvcsArchiveDetailCollection.Add(archiveName, pvcsArchiveDetail); } } // Existing current archive pvcsArchiveDetail.AddArchiveDetail(archiveDetailText); } // while not end of stream } // using StreamReader } } // Default Constructor