public void LoadFrom(ChangeLogPolicy policy) { switch (policy.UpdateMode) { case ChangeLogUpdateMode.None: noneRadioButton.Active = true; break; case ChangeLogUpdateMode.Nearest: nearestRadioButton.Active = true; break; case ChangeLogUpdateMode.ProjectRoot: oneChangeLogInProjectRootDirectoryRadioButton.Active = true; break; case ChangeLogUpdateMode.Directory: oneChangeLogInEachDirectoryRadioButton.Active = true; break; } checkVersionControl.Active = policy.VcsIntegration != VcsIntegration.None; checkRequireOnCommit.Active = policy.VcsIntegration == VcsIntegration.RequireEntry; style = new CommitMessageStyle(); style.CopyFrom(policy.MessageStyle); var format = new CommitMessageFormat(); format.MaxColumns = 70; format.Style = style; SolutionFolderItem item = null; if (parent.ConfiguredSolutionItem != null) { item = parent.ConfiguredSolutionItem; } else if (parent.ConfiguredSolution != null) { item = parent.ConfiguredSolution.RootFolder; } messageWidget.Load(format, item != null ? item.AuthorInformation : AuthorInformation.Default); }
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); } }
public CommitDialog(ChangeSet changeSet) { Build(); store = new ListStore(typeof(Xwt.Drawing.Image), typeof(string), typeof(string), typeof(bool), typeof(object)); fileList.Model = store; fileList.SearchColumn = -1; // disable the interactive search this.changeSet = changeSet; oldMessage = changeSet.GlobalComment; CellRendererText crt = new CellRendererText(); var crp = new CellRendererImage(); TreeViewColumn colStatus = new TreeViewColumn(); colStatus.Title = GettextCatalog.GetString("Status"); colStatus.PackStart(crp, false); colStatus.PackStart(crt, true); colStatus.Spacing = 2; colStatus.AddAttribute(crp, "image", 0); colStatus.AddAttribute(crt, "text", 1); CellRendererToggle cellToggle = new CellRendererToggle(); cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler); TreeViewColumn colCommit = new TreeViewColumn("", cellToggle, "active", 3); TreeViewColumn colFile = new TreeViewColumn(GettextCatalog.GetString("File"), new CellRendererText(), "text", 2); fileList.AppendColumn(colCommit); fileList.AppendColumn(colStatus); fileList.AppendColumn(colFile); colCommit.Visible = false; object[] exts = AddinManager.GetExtensionObjects("/MonoDevelop/VersionControl/CommitDialogExtensions", false); bool separatorRequired = false; foreach (object ob in exts) { CommitDialogExtension ext = ob as CommitDialogExtension; if (ext == null) { LoggingService.LogError("Commit extension type " + ob.GetType() + " must be a subclass of CommitDialogExtension"); continue; } if (ext.Initialize(changeSet)) { var newTitle = ext.FormatDialogTitle(changeSet, Title); if (newTitle != null) { Title = newTitle; } ext.CommitMessageTextViewHook(textview); if (separatorRequired) { HSeparator sep = new HSeparator(); sep.Show(); vboxExtensions.PackEnd(sep, false, false, 0); } vboxExtensions.PackEnd(ext, false, false, 0); extensions.Add(ext); ext.AllowCommitChanged += HandleAllowCommitChanged; separatorRequired = true; } else { ext.Destroy(); } } HandleAllowCommitChanged(null, null); LoadChangeset(changeSet.Items); if (string.IsNullOrEmpty(changeSet.GlobalComment)) { AuthorInformation aInfo; CommitMessageFormat fmt = VersionControlService.GetCommitMessageFormat(changeSet, out aInfo); Message = changeSet.GenerateGlobalComment(fmt, aInfo); } else { Message = changeSet.GlobalComment; } textview.Buffer.Changed += OnTextChanged; responseSensitive = !string.IsNullOrEmpty(Message); // Focus the text view and move the insert point to the beginning. Makes it easier to insert // a comment header. textview.Buffer.MoveMark(textview.Buffer.InsertMark, textview.Buffer.StartIter); textview.Buffer.MoveMark(textview.Buffer.SelectionBound, textview.Buffer.StartIter); textview.GrabFocus(); textview.Buffer.MarkSet += OnMarkSet; SetResponseSensitive(ResponseType.Ok, responseSensitive); VersionControlService.FileStatusChanged += OnFileStatusChanged; }
public CommitDialog(ChangeSet changeSet) { Build(); store = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(bool), typeof(object)); fileList.Model = store; this.changeSet = changeSet; oldMessage = changeSet.GlobalComment; CellRendererText crt = new CellRendererText(); var crp = new CellRendererPixbuf(); TreeViewColumn colStatus = new TreeViewColumn(); colStatus.Title = GettextCatalog.GetString("Status"); colStatus.PackStart(crp, false); colStatus.PackStart(crt, true); colStatus.Spacing = 2; colStatus.AddAttribute(crp, "pixbuf", 0); colStatus.AddAttribute(crt, "text", 1); CellRendererToggle cellToggle = new CellRendererToggle(); cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler); TreeViewColumn colCommit = new TreeViewColumn("", cellToggle, "active", 3); TreeViewColumn colFile = new TreeViewColumn(GettextCatalog.GetString("File"), new CellRendererText(), "text", 2); fileList.AppendColumn(colCommit); fileList.AppendColumn(colStatus); fileList.AppendColumn(colFile); colCommit.Visible = false; object[] exts = AddinManager.GetExtensionObjects("/MonoDevelop/VersionControl/CommitDialogExtensions", false); bool separatorRequired = false; foreach (object ob in exts) { CommitDialogExtension ext = ob as CommitDialogExtension; if (ext == null) { MessageService.ShowError("Commit extension type " + ob.GetType() + " must be a subclass of CommitDialogExtension"); continue; } if (ext.Initialize(changeSet)) { if (separatorRequired) { HSeparator sep = new HSeparator(); sep.Show(); vboxExtensions.PackEnd(sep, false, false, 0); } vboxExtensions.PackEnd(ext, false, false, 0); extensions.Add(ext); ext.AllowCommitChanged += HandleAllowCommitChanged; separatorRequired = true; } else { ext.Destroy(); } } HandleAllowCommitChanged(null, null); foreach (ChangeSetItem info in changeSet.Items) { Gdk.Pixbuf statusicon = VersionControlService.LoadIconForStatus(info.Status); string lstatus = VersionControlService.GetStatusLabel(info.Status); string localpath = (!info.LocalPath.IsChildPathOf(changeSet.BaseLocalPath)? ".": (string)info.LocalPath.ToRelative(changeSet.BaseLocalPath)); if (localpath.Length > 0 && localpath[0] == System.IO.Path.DirectorySeparatorChar) { localpath = localpath.Substring(1); } if (localpath == "") { localpath = "."; } // not sure if this happens store.AppendValues(statusicon, lstatus, localpath, true, info); selected.Add(info.LocalPath); } if (string.IsNullOrEmpty(changeSet.GlobalComment)) { AuthorInformation aInfo; CommitMessageFormat fmt = VersionControlService.GetCommitMessageFormat(changeSet, out aInfo); Message = changeSet.GenerateGlobalComment(fmt, aInfo); } else { Message = changeSet.GlobalComment; } textview.Buffer.Changed += OnTextChanged; // Focus the text view and move the insert point to the begining. Makes it easier to insert // a comment header. textview.Buffer.MoveMark(textview.Buffer.InsertMark, textview.Buffer.StartIter); textview.Buffer.MoveMark(textview.Buffer.SelectionBound, textview.Buffer.StartIter); textview.GrabFocus(); }