Beispiel #1
0
 public void ShowLogMessage(ISvnApi svn)
 {
     try
     {
         MessageBox.Show(svn.GetLogMessage(Revision), "Log Message");
     }
     catch (Exception x)
     {
         MessageBox.Show(Dump.ExceptionMessage(x), "Could not get log message", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HitViewModel hitViewModel = ApplicationIndex.GetHitById(Context.Request.QueryString["id"]);
            string       path         = hitViewModel.Path;
            int          revision     = hitViewModel.Revision;

            // getting _properties from the index
            Title               = path.Substring(path.LastIndexOf('/') + 1);
            _header.InnerText   = path;
            _author.InnerText   = hitViewModel.Author;
            _modified.InnerText = hitViewModel.LastModification;
            if (hitViewModel.MaxSize > 0)
            {
                _size.InnerText = hitViewModel.Size;
            }
            else
            {
                _sizeRow.Visible = false;
            }
            _revisions.InnerText = hitViewModel.RevFirst + " - " + hitViewModel.RevLast;

            // getting _properties from subversion
            _message.InnerText = Svn.GetLogMessage(revision);

            if (path[0] == '$')
            {
                return;                 // Revision Log
            }
            bool binary = InitProperties(Svn.GetPathProperties(path, revision));

            if (hitViewModel.MaxSize > 512 * 1024)
            {
                _contentWarning.InnerText = "Content size is too big to display";
            }
            else if (binary)
            {
                _contentWarning.InnerText = "Content type is binary";
            }
            else if (hitViewModel.MaxSize > 0)
            {
                _content.InnerText = Svn.GetPathContent(path, revision, hitViewModel.MaxSize);

                var syntaxHighlighter = new SyntaxHighlightBrushMapper(path);
                if (syntaxHighlighter.IsAvailable)
                {
                    AddScriptInclude(syntaxHighlighter.GetScript());
                    AddStartupScript();
                    _content.Attributes.Add("class", syntaxHighlighter.GetClass());
                }
            }
        }
Beispiel #3
0
        void IndexDocument(IndexJobData data)
        {
            if (_args.Verbosity == 0 && data.Path[0] == '$')
            {
                Console.WriteLine("Revision " + data.RevisionFirst);
            }
            else
            {
                Console.WriteLine("Index {0}   {1}:{2}", data.Path, data.RevisionFirst, data.RevisionLast);
            }

            string idText = data.Path[0] == '$' ? data.Path : data.Path + "@" + data.RevisionFirst;
            Term   id     = _idTerm.CreateTerm(idText);

            _indexWriter.DeleteDocuments(id);

            if (_args.SingleRevision && data.RevisionLast != Revision.Head)
            {
                return;
            }

            Document doc = MakeDocument();

            _idField.SetValue(idText);
            _pathTokenStream.SetText(data.Path);
            _revFirstField.SetValue(data.RevisionFirst.ToString(RevisionFilter.RevFormat));
            _revLastField.SetValue(data.RevisionLast.ToString(RevisionFilter.RevFormat));
            _authorField.SetValue(data.Info.Author.ToLowerInvariant());
            SetTimestampField(data.Info.Timestamp);
            _messageTokenStream.SetText(_svn.GetLogMessage(data.RevisionFirst));

            if (!data.Info.IsDirectory)
            {
                _sizeField.SetValue(PackedSizeConverter.ToSortableString(data.Info.Size));
                doc.Add(_sizeField);
            }

            _contentTokenStream.SetText(data.Content);
            if (!_contentTokenStream.IsEmpty)
            {
                doc.Add(_contentField);
            }

            IndexProperties(doc, data.Properties);

            _indexWriter.AddDocument(doc);
        }