상속: Tp.SourceControl.VersionControlSystem.VersionControlSystem
 public void GetTextFileContentUnknownPath()
 {
     using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
     {
         s.GetTextFileContent(6066.ToString(), "/thisfiledoesnotexist.txt");
     }
 }
 public void GetTextFileContentUnknownRevision()
 {
     using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
     {
         s.GetTextFileContent(99999.ToString(), "/TempSubversionTest/readme.txt");
     }
 }
 public void GetLastRevisionInfoOnEmptyLocalRepository()
 {
     using (var s = new Subversion(GetEmptyRepositorySettings(), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
     {
         var range = s.GetFromTillHead(0.ToString(), 100).Single();
         s.GetRevisions(range).Should(Be.Empty);
     }
 }
 public void ConnectToLocalRepository()
 {
     using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
     {
         var range = s.GetFromTillHead(0.ToString(), 100).Single();
         s.GetRevisions(range).Should(Be.Not.Empty);
     }
 }
        public void GetRevisionInfosForPath()
        {
            using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
            {
                IEnumerable <RevisionInfo> revisionInfos = s.GetRevisions(new RevisionRange(new SvnRevisionId(1), new SvnRevisionId(5)), "readme.txt");

                Assert.IsNotNull(revisionInfos);
            }
        }
        public void GetBinaryFileContent()
        {
            using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
            {
                byte[] content = s.GetBinaryFileContent(3.ToString(), "readme.txt");

                Assert.AreEqual(Encoding.UTF8.GetBytes("Test repository to verify subversion integration."), content);
            }
        }
 private static void TestSubversionRepository(string firstFolder, params long[] revisionIds)
 {
     using (var sourceControlService = new Subversion(GetLocalRepositorySettings(firstFolder), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
     {
         var range             = sourceControlService.GetFromTillHead(0.ToString(), 100).Single();
         var revisionsFromRepo = sourceControlService.GetRevisions(range).Select(x => long.Parse(x.Id.Value)).ToArray();
         revisionsFromRepo.Should(Be.EquivalentTo(revisionIds));
     }
 }
 public void ShouldRetrieveLastRevision()
 {
     using (var subversion = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
     {
         var revisions = subversion.GetAfterTillHead(new SvnRevisionId(8), 50).ToArray();
         revisions.Single().FromChangeset.Value.Should(Be.EqualTo(9.ToString()));
         revisions.Single().ToChangeset.Value.Should(Be.EqualTo(9.ToString()));
     }
 }
        public void GetTextFileContent()
        {
            using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
            {
                string content = s.GetTextFileContent(3.ToString(), "/readme.txt");

                Assert.AreEqual("Test repository to verify subversion integration.", content);
                // there is extra newline char at the end of file
            }
        }
        public void ShouldRetrieveAuthors()
        {
            using (var subversion = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
            {
                var revisions = subversion.GetRevisions(subversion.GetFromTillHead(new SvnRevisionId(0), 100).Single()).OrderBy(x => x.Time);

                var authors = subversion.RetrieveAuthors(new DateRange(revisions.First().Time, revisions.Last().Time));
                authors.Should(Be.EquivalentTo(revisions.Select(x => x.Author).Distinct().ToArray()));
            }
        }
		public void ShouldRetrieve()
		{
			var settings = GetLocalRepositorySettings();
			settings.Uri = new Uri("http://svn.apache.org/repos/asf/spamassassin/trunk").ToString();
			var vcs = new Subversion(settings, ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>());
			var svnRevisionId = new SvnRevisionId(1000000);
			var endRevision = vcs.GetFromTillHead(svnRevisionId, 50);
			var result = vcs.GetRevisions(endRevision.Last());
			result.Should(Be.Not.Empty);
		}
        public void ShouldRetrieve()
        {
            var settings = GetLocalRepositorySettings();

            settings.Uri = new Uri("http://svn.apache.org/repos/asf/spamassassin/trunk").ToString();
            var vcs           = new Subversion(settings, ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>());
            var svnRevisionId = new SvnRevisionId(1000000);
            var endRevision   = vcs.GetFromTillHead(svnRevisionId, 50);
            var result        = vcs.GetRevisions(endRevision.Last());

            result.Should(Be.Not.Empty);
        }
        public void GetRevisionInfos()
        {
            using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
            {
                IEnumerable <RevisionInfo> revisionInfos = s.GetRevisions(new RevisionRange(new SvnRevisionId(8), new SvnRevisionId(8)));

                Assert.IsNotNull(revisionInfos);

                foreach (RevisionInfo info in revisionInfos)
                {
                    Assert.AreEqual("#112 state:invalid  time :0.25 comment: Linich, Maksim", info.Comment);
                    // Haha, mistaken!!!
                }
            }
        }
        public void GetRevisionRanges()
        {
            using (var subversion = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()))
            {
                var revisionRanges = subversion.GetFromTillHead(new SvnRevisionId(2), 3);
                revisionRanges.Count().Should(Be.EqualTo(3));
                revisionRanges[0].FromChangeset.Value.Should(Be.EqualTo(2.ToString()));
                revisionRanges[0].ToChangeset.Value.Should(Be.EqualTo(4.ToString()));

                revisionRanges[1].FromChangeset.Value.Should(Be.EqualTo(5.ToString()));
                revisionRanges[1].ToChangeset.Value.Should(Be.EqualTo(7.ToString()));

                revisionRanges[2].FromChangeset.Value.Should(Be.EqualTo(8.ToString()));
                revisionRanges[2].ToChangeset.Value.Should(Be.EqualTo(9.ToString()));
            }
        }
		public void GetBinaryFileContent()
		{
			using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
			{
				byte[] content = s.GetBinaryFileContent(3.ToString(), "readme.txt");

				Assert.AreEqual(Encoding.UTF8.GetBytes("Test repository to verify subversion integration."), content);
			}
		}
		public void GetTextFileContentUnknownRevision()
		{
			using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
			{
				s.GetTextFileContent(99999.ToString(), "/TempSubversionTest/readme.txt");
			}
		}
		public void GetTextFileContentUnknownPath()
		{
			using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
			{
				s.GetTextFileContent(6066.ToString(), "/thisfiledoesnotexist.txt");
			}
		}
		public void GetTextFileContent()
		{
			using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
			{
				string content = s.GetTextFileContent(3.ToString(), "/readme.txt");

				Assert.AreEqual("Test repository to verify subversion integration.", content);
				// there is extra newline char at the end of file
			}
		}
		public void GetRevisionInfosForPath()
		{
			using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
			{
				IEnumerable<RevisionInfo> revisionInfos = s.GetRevisions(new RevisionRange(new SvnRevisionId(1), new SvnRevisionId(5)), "readme.txt");

				Assert.IsNotNull(revisionInfos);
			}
		}
		public void GetRevisionInfos()
		{
			using (var s = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
			{
				IEnumerable<RevisionInfo> revisionInfos = s.GetRevisions(new RevisionRange(new SvnRevisionId(8), new SvnRevisionId(8)));

				Assert.IsNotNull(revisionInfos);

				foreach (RevisionInfo info in revisionInfos)
				{
					Assert.AreEqual("#112 state:invalid  time :0.25 comment: Linich, Maksim", info.Comment);
					// Haha, mistaken!!!
				}
			}
		}
		private static void TestSubversionRepository(string firstFolder, params long[] revisionIds)
		{
			using (var sourceControlService = new Subversion(GetLocalRepositorySettings(firstFolder), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
			{
				var range = sourceControlService.GetFromTillHead(0.ToString(), 100).Single();
				var revisionsFromRepo = sourceControlService.GetRevisions(range).Select(x => long.Parse(x.Id.Value)).ToArray();
				revisionsFromRepo.Should(Be.EquivalentTo(revisionIds));
			}
		}
		public void GetRevisionRanges()
		{
			using (var subversion = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
			{
				var revisionRanges = subversion.GetFromTillHead(new SvnRevisionId(2), 3);
				revisionRanges.Count().Should(Be.EqualTo(3));
				revisionRanges[0].FromChangeset.Value.Should(Be.EqualTo(2.ToString()));
				revisionRanges[0].ToChangeset.Value.Should(Be.EqualTo(4.ToString()));

				revisionRanges[1].FromChangeset.Value.Should(Be.EqualTo(5.ToString()));
				revisionRanges[1].ToChangeset.Value.Should(Be.EqualTo(7.ToString()));

				revisionRanges[2].FromChangeset.Value.Should(Be.EqualTo(8.ToString()));
				revisionRanges[2].ToChangeset.Value.Should(Be.EqualTo(9.ToString()));
			}
		}
		public void ShouldRetrieveAuthors()
		{
			using (var subversion = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
			{
				var revisions = subversion.GetRevisions(subversion.GetFromTillHead(new SvnRevisionId(0), 100).Single()).OrderBy(x => x.Time);

				var authors = subversion.RetrieveAuthors(new DateRange(revisions.First().Time, revisions.Last().Time));
				authors.Should(Be.EquivalentTo(revisions.Select(x => x.Author).Distinct().ToArray()));
			}
		}
		public void ShouldRetrieveLastRevision()
		{
			using (var subversion = new Subversion(GetLocalRepositorySettings(), ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()))
			{
				var revisions = subversion.GetAfterTillHead(new SvnRevisionId(8), 50).ToArray();
				revisions.Single().FromChangeset.Value.Should(Be.EqualTo(9.ToString()));
				revisions.Single().ToChangeset.Value.Should(Be.EqualTo(9.ToString()));
			}
		}