Beispiel #1
0
        public override Annotation[] GetAnnotations(FilePath repositoryPath)
        {
            List <Annotation> annotations = new List <Annotation> (Svn.GetAnnotations(this, repositoryPath, SvnRevision.First, SvnRevision.Base));
            Annotation        nextRev     = new Annotation(GettextCatalog.GetString("working copy"), "<uncommitted>", DateTime.MinValue);
            var baseDocument    = new Mono.TextEditor.TextDocument(GetBaseText(repositoryPath));
            var workingDocument = new Mono.TextEditor.TextDocument(File.ReadAllText(repositoryPath));

            // "SubversionException: blame of the WORKING revision is not supported"
            foreach (var hunk in baseDocument.Diff(workingDocument))
            {
                annotations.RemoveRange(hunk.RemoveStart - 1, hunk.Removed);
                for (int i = 0; i < hunk.Inserted; ++i)
                {
                    if (hunk.InsertStart + i >= annotations.Count)
                    {
                        annotations.Add(nextRev);
                    }
                    else
                    {
                        annotations.Insert(hunk.InsertStart - 1, nextRev);
                    }
                }
            }

            return(annotations.ToArray());
        }
		public override Annotation[] GetAnnotations (FilePath repositoryPath)
		{
			List<Annotation> annotations = new List<Annotation> (Svn.GetAnnotations (this, repositoryPath, SvnRevision.First, SvnRevision.Base));
			Annotation nextRev = new Annotation (GettextCatalog.GetString ("working copy"), "<uncommitted>", DateTime.MinValue);
			var baseDocument = new Mono.TextEditor.TextDocument (GetBaseText (repositoryPath));
			var workingDocument = new Mono.TextEditor.TextDocument (File.ReadAllText (repositoryPath));
			
			// "SubversionException: blame of the WORKING revision is not supported"
			foreach (var hunk in baseDocument.Diff (workingDocument)) {
				annotations.RemoveRange (hunk.RemoveStart - 1, hunk.Removed);
				for (int i = 0; i < hunk.Inserted; ++i) {
					if (hunk.InsertStart + i >= annotations.Count)
						annotations.Add (nextRev);
					else
						annotations.Insert (hunk.InsertStart - 1, nextRev);
				}
			}
			
			return annotations.ToArray ();
		}