Пример #1
0
 /// <summary>
 /// ctor
 /// </summary>
 public CvsChangeLog(string module, string localDirectory)
 {
     logCommand = new LogReportCommand(module, localDirectory);
 }
Пример #2
0
 /// <summary>
 /// Create a new instance of the cvs changelog command.
 /// </summary>
 /// <param name="workingDirectory"></param>
 /// <param name="module"></param>
 public CvsChangeLog(WorkingDirectory workingDirectory, string module) {
     logCommand = new LogReportCommand(workingDirectory, module);
 }
        public void Test()
        {
            SharpCvsLibTestsConfig settings;
            string section = SharpCvsLibTestsConfigHandler.APP_CONFIG_SECTION;

//System.Console.WriteLine("section={0}", section);
            settings = (SharpCvsLibTestsConfig)ConfigurationSettings.GetConfig(section);

//System.Console.WriteLine("target-directory={0}", settings.TargetDirectory);
//System.Console.WriteLine("password={0}", settings.ValidPassword);
            string          moduleName     = settings.Module;
            string          workingDir     = settings.TargetDirectory;
            string          password       = settings.ValidPassword;
            bool            foundTestFile1 = false;
            bool            foundTestFile2 = false;
            LogRevision     logRevision;
            LogSymbolicName symbolicName;

            LogReportCommand logCommand = new LogReportCommand(moduleName, workingDir);
            //
            //    logCommand.SetLastNDays(7);
            //    // or logCommand.StartDate = new DateTime(...);
            //    // and/or logCommand.EndDate = new DateTime(...);
            //
            LogReport logReport = logCommand.Run(password);

            Assert.AreEqual(16, logReport.Count);
            foreach (LogFile logFile in logReport)
            {
                if (logFile.WorkingFnm.EndsWith("test-file.txt"))
                {
                    Assert.IsTrue(!foundTestFile1);
                    foundTestFile1 = true;

                    Assert.AreEqual("/cvsroot/sharpcvslib-test/sharpcvslib-test-repository/test-file.txt,v", logFile.RepositoryFnm);
                    Assert.AreEqual("test-file.txt", logFile.WorkingFnm);
                    Assert.AreEqual("", logFile.Description);

                    // check the revisions
                    Assert.AreEqual(3, logFile.Count);
                    // most recent version will be first
                    logRevision = logFile[0];
                    Assert.AreEqual("1.3", logRevision.Revision);
                    CheckDate(2003, 9, 14, 1, 8, 21, logRevision.Timestamp);
                    Assert.AreEqual("claytonharbour", logRevision.Author);
                    Assert.AreEqual("Exp", logRevision.State);
                    Assert.AreEqual(3, logRevision.LinesAdded);
                    Assert.AreEqual(1, logRevision.LinesDeleted);
                    Assert.AreEqual("*** empty log message ***", logRevision.Comment);

                    logRevision = logFile[1];
                    Assert.AreEqual("1.2", logRevision.Revision);
                    CheckDate(2003, 9, 14, 1, 7, 15, logRevision.Timestamp);
                    Assert.AreEqual("claytonharbour", logRevision.Author);
                    Assert.AreEqual("Exp", logRevision.State);
                    Assert.AreEqual(3, logRevision.LinesAdded);
                    Assert.AreEqual(1, logRevision.LinesDeleted);
                    Assert.AreEqual("Added line.", logRevision.Comment);

                    logRevision = logFile[2];
                    Assert.AreEqual("1.1", logRevision.Revision);
                    CheckDate(2003, 9, 14, 1, 5, 51, logRevision.Timestamp);
                    Assert.AreEqual("claytonharbour", logRevision.Author);
                    Assert.AreEqual("Exp", logRevision.State);
                    Assert.AreEqual(0, logRevision.LinesAdded);
                    Assert.AreEqual(0, logRevision.LinesDeleted);
                    Assert.AreEqual("Various changes for sticky tag support.  Looked at implementing a message event handling system for request/ responses to output server messages (similar to tortoise).", logRevision.Comment);

                    // check the symbolic names
                    // check the revisions
                    Assert.AreEqual(3, logFile.SymbolicNames.Count);
                    symbolicName = logFile.SymbolicNames[0];
                    Assert.AreEqual("V0_3", symbolicName.Name);
                    Assert.AreEqual("1.3", symbolicName.Revision);

                    symbolicName = logFile.SymbolicNames[1];
                    Assert.AreEqual("V0_2", symbolicName.Name);
                    Assert.AreEqual("1.2", symbolicName.Revision);

                    symbolicName = logFile.SymbolicNames[2];
                    Assert.AreEqual("V0_1", symbolicName.Name);
                    Assert.AreEqual("1.1", symbolicName.Revision);
                }
                if (logFile.WorkingFnm.EndsWith("test-file-2.txt"))
                {
                    Assert.IsTrue(!foundTestFile2);
                    foundTestFile2 = true;

                    Assert.AreEqual("/cvsroot/sharpcvslib-test/sharpcvslib-test-repository/src/test-file-2.txt,v", logFile.RepositoryFnm);
                    Assert.AreEqual("src/test-file-2.txt", logFile.WorkingFnm);
                    Assert.AreEqual("", logFile.Description);

                    Assert.AreEqual(1, logFile.Count);
                    // most recent version will be first
                    logRevision = logFile[0];
                    Assert.AreEqual("1.1", logRevision.Revision);
                    CheckDate(2003, 9, 14, 15, 57, 48, logRevision.Timestamp);
                    Assert.AreEqual("claytonharbour", logRevision.Author);
                    Assert.AreEqual("Exp", logRevision.State);
                    Assert.AreEqual(0, logRevision.LinesAdded);
                    Assert.AreEqual(0, logRevision.LinesDeleted);
                    Assert.AreEqual("*** empty log message ***", logRevision.Comment);
                }
            }

            Assert.IsTrue(foundTestFile1);
            Assert.IsTrue(foundTestFile2);
            //            ...
            //	        foreach (LogRevision logRevision in logFile)
            //	        {
            //              ...
            //	        }
            //	   }
        }