Beispiel #1
0
		public override Annotation[] GetAnnotations (Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd)
		{
			if (file == FilePath.Null)
				throw new ArgumentNullException ();
				
			LibSvnClient.Rev revisionStart = (LibSvnClient.Rev) revStart;
			LibSvnClient.Rev revisionEnd = (LibSvnClient.Rev) revEnd;
			
			int numAnnotations = File.ReadAllLines (((SubversionRepository)repo).GetPathToBaseText(file)).Length;
			Annotation[] annotations = new Annotation [numAnnotations];
			
			AnnotationCollector collector = new AnnotationCollector (annotations);
			
			IntPtr localpool = newpool (pool);
			
			try {
				string path = NormalizePath (file.FullPath, localpool);
				CheckError (svn.client_blame (path, ref revisionStart, ref revisionEnd, new LibSvnClient.svn_client_blame_receiver_t (collector.Func), IntPtr.Zero, ctx, localpool));
			} finally {
				apr.pool_destroy (localpool);
			}
			
			return annotations;
		}
		public override Annotation[] GetAnnotations (Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd)
		{
			if (file == FilePath.Null)
				throw new ArgumentNullException ();
				
			LibSvnClient.Rev revisionStart = (LibSvnClient.Rev) revStart;
			LibSvnClient.Rev revisionEnd = (LibSvnClient.Rev) revEnd;

			MemoryStream data = new MemoryStream ();
			int numAnnotations = 0;
			Cat (file, SvnRevision.Base, data);

			using (StreamReader reader = new StreamReader (data)) {
				reader.BaseStream.Seek (0, SeekOrigin.Begin);
				while (reader.ReadLine () != null)
					numAnnotations++;
			}

			Annotation[] annotations = new Annotation [numAnnotations];
			AnnotationCollector collector = new AnnotationCollector (annotations, repo);

			IntPtr localpool = IntPtr.Zero;
			try {
				localpool = TryStartOperation (null);
				string path = NormalizePath (file.FullPath, localpool);
				CheckError (svn.client_blame (path, ref revisionStart, ref revisionEnd, collector.Func, IntPtr.Zero, ctx, localpool));
			} finally {
				TryEndOperation (localpool);
			}
			
			return annotations;
		}
		public override List<string> GetAnnotations (Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd)
		{
			if (file == FilePath.Null)
				throw new ArgumentNullException ();
				
			LibSvnClient.Rev revisionStart = (LibSvnClient.Rev) revStart;
			LibSvnClient.Rev revisionEnd = (LibSvnClient.Rev) revEnd;
			
			int numAnnotations = File.ReadAllLines (repo.GetPathToBaseText(file)).Length;
			List<string> annotations = new List<string> (numAnnotations);
			for (int i=0; i<numAnnotations; ++i) {
				annotations.Insert (0, string.Empty);
			}
			
			AnnotationCollector collector = new AnnotationCollector (annotations);
			
			IntPtr localpool = newpool (pool);
			
			try {
				CheckError (svn.client_blame (file.FullPath, ref revisionStart, ref revisionEnd, new LibSvnClient.svn_client_blame_receiver_t (collector.Func), IntPtr.Zero, ctx, localpool));
			} finally {
				apr.pool_destroy (localpool);
			}
			
			return annotations;
		}