示例#1
0
        static async Task <Document> GetActiveChangeLogDocument()
        {
            string file = GetSelectedFile();

            if (file == null)
            {
                return(null);
            }

            string clog = ChangeLogService.GetChangeLogForFile(null, file);

            if (string.IsNullOrEmpty(clog))
            {
                return(null);
            }

            Project project = IdeApp.ProjectOperations.CurrentSelectedProject;

            if (project == null)
            {
                return(null);
            }

            if (File.Exists(clog))
            {
                return(await IdeApp.Workbench.OpenDocument(clog, (Project)null, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer));
            }

            Document document = IdeApp.Workbench.NewDocument(clog, "text/plain", "");

            document.Save();
            return(document);
        }
示例#2
0
        private Document GetActiveChangeLogDocument()
        {
            string file = GetSelectedFile();

            if (file == null)
            {
                return(null);
            }

            string clog = ChangeLogService.GetChangeLogForFile(null, file);

            if (string.IsNullOrEmpty(clog))
            {
                return(null);
            }

            Project project = IdeApp.ProjectOperations.CurrentSelectedProject;

            if (project == null)
            {
                return(null);
            }

            if (File.Exists(clog))
            {
                return(IdeApp.Workbench.OpenDocument(clog, false));
            }

            Document document = IdeApp.Workbench.NewDocument(clog, "text/plain", "");

            document.Save();
            return(document);
        }
示例#3
0
        protected override void Update(CommandInfo info)
        {
            string file = GetSelectedFile();

            if (file != null)
            {
                string clog = ChangeLogService.GetChangeLogForFile(null, file);
                info.Enabled = !string.IsNullOrEmpty(clog);
            }
            else
            {
                info.Enabled = false;
            }
        }
        void GenerateLogEntries()
        {
            entries          = new Dictionary <string, ChangeLogEntry> ();
            unknownFileCount = 0;
            enabled          = false;
            requireComment   = false;

            foreach (ChangeSetItem item in cset.Items)
            {
                SolutionFolderItem parentItem;
                ChangeLogPolicy    policy;
                string             logf = ChangeLogService.GetChangeLogForFile(cset.BaseLocalPath, item.LocalPath,
                                                                               out parentItem, out policy);

                if (logf == string.Empty)
                {
                    continue;
                }

                enabled = true;
                bool cantGenerate = false;

                if (logf == null)
                {
                    cantGenerate = true;
                    logf         = System.IO.Path.GetDirectoryName(item.LocalPath);
                    logf         = System.IO.Path.Combine(logf, "ChangeLog");
                }

                if (string.IsNullOrEmpty(item.Comment) && !item.IsDirectory)
                {
                    uncommentedCount++;
                    requireComment |= policy != null && policy.VcsIntegration == VcsIntegration.RequireEntry;
                }

                ChangeLogEntry entry;
                if (!entries.TryGetValue(logf, out entry))
                {
                    entry = new ChangeLogEntry();
                    entry.AuthorInformation = parentItem != null ? parentItem.AuthorInformation : AuthorInformation.Default;
                    entry.MessageStyle      = ChangeLogService.GetMessageStyle(parentItem);
                    entry.CantGenerate      = cantGenerate;
                    entry.File = logf;
                    if (cantGenerate)
                    {
                        unknownFileCount++;
                    }

                    entry.IsNew |= !File.Exists(logf);

                    entries [logf] = entry;
                }
                entry.Items.Add(item);
            }

            var format = new CommitMessageFormat();

            format.TabsAsSpaces   = false;
            format.TabWidth       = 8;
            format.MaxColumns     = 70;
            format.AppendNewlines = 2;
            foreach (ChangeLogEntry entry in entries.Values)
            {
                format.Style  = entry.MessageStyle;
                entry.Message = cset.GeneratePathComment(entry.File, entry.Items,
                                                         format, entry.AuthorInformation);
            }
        }