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;
			
			SolutionItem 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);
		}
        public static CommitMessageFormat GetCommitMessageFormat(SolutionItem item)
        {
            CommitMessageFormat format = new CommitMessageFormat();

            format.Style = item.Policies.Get <VersionControlPolicy> ().CommitMessageStyle;
            return(format);
        }
        public static CommitMessageFormat GetCommitMessageFormat(SolutionFolderItem item)
        {
            CommitMessageFormat format = new CommitMessageFormat();

            format.Style = item.Policies.Get <VersionControlPolicy> ().CommitMessageStyle;
            format.ShowFilesForSingleComment = false;
            return(format);
        }
 public override Widget CreatePanelWidget()
 {
     format          = new CommitMessageFormat();
     widget          = new CommitMessageStylePanelWidget();
     widget.Changed += delegate {
         UpdateSelectedNamedPolicy();
     };
     widget.Show();
     return(widget);
 }
Пример #5
0
		public string GeneratePathComment (string path, IEnumerable<ChangeSetItem> items, 
			CommitMessageFormat messageFormat, MonoDevelop.Projects.AuthorInformation userInfo)
		{
			var writer = new ChangeLogWriter (path, userInfo);
			writer.MessageFormat = messageFormat;
			
			foreach (ChangeSetItem item in items) {
				writer.AddFile (item.Comment, item.LocalPath);
			}
			
			return writer.ToString ();
		}
        public static CommitMessageFormat GetCommitMessageFormat(ChangeSet cset, out AuthorInformation authorInfo)
        {
            // If all files belong to a project, use that project's policy. If not, use the solution policy
            Project project     = null;
            bool    sameProject = true;

            foreach (ChangeSetItem item in cset.Items)
            {
                if (project != null)
                {
                    if (project.Files.GetFile(item.LocalPath) == null)
                    {
                        // Not all files belong to the same project
                        sameProject = false;
                        break;
                    }
                }
                else
                {
                    project = IdeApp.Workspace.GetProjectsContainingFile(item.LocalPath).FirstOrDefault();
                }
            }
            CommitMessageStyle style;

            if (project != null)
            {
                VersionControlPolicy policy;
                if (sameProject)
                {
                    policy = project.Policies.Get <VersionControlPolicy> ();
                }
                else
                {
                    policy = project.ParentSolution.Policies.Get <VersionControlPolicy> ();
                }
                style = policy.CommitMessageStyle;
            }
            else
            {
                style = PolicyService.GetDefaultPolicy <CommitMessageStyle> ();
            }

            authorInfo = project != null ? project.AuthorInformation : AuthorInformation.Default;

            CommitMessageFormat format = new CommitMessageFormat();

            format.Style = style;
            format.ShowFilesForSingleComment = false;

            return(format);
        }
Пример #7
0
        public string GeneratePathComment(string path, IEnumerable <ChangeSetItem> items,
                                          CommitMessageFormat messageFormat, MonoDevelop.Projects.AuthorInformation userInfo)
        {
            ChangeLogWriter writer = new ChangeLogWriter(path, userInfo);

            writer.MessageFormat = messageFormat;

            foreach (ChangeSetItem item in items)
            {
                writer.AddFile(item.Comment, item.LocalPath);
            }

            return(writer.ToString());
        }
Пример #8
0
 public void Load(CommitMessageFormat format, AuthorInformation uinfo)
 {
     updating                   = true;
     this.format                = format;
     this.uinfo                 = uinfo;
     checkIndent.Active         = format.Style.LineAlign != 0;
     checkLineSep.Active        = format.Style.InterMessageLines != 0;
     checkMsgInNewLine.Active   = format.Style.LastFilePostfix == ":\n";
     checkOneLinePerFile.Active = format.Style.FileSeparator == ":\n* ";
     checkUseBullets.Active     = format.Style.FirstFilePrefix.Trim().Length > 0;
     checkIndentEntries.Active  = format.Style.Indent.Length > 0;
     entryHeader.Text           = ToCString(format.Style.Header.TrimEnd('\n'));
     UpdatePreview();
     updating = false;
 }
		public void Load (CommitMessageFormat format, AuthorInformation uinfo)
		{
			updating = true;
			this.format = format;
			this.uinfo = uinfo;
			checkIndent.Active = format.Style.LineAlign != 0;
			checkLineSep.Active = format.Style.InterMessageLines != 0;
			checkMsgInNewLine.Active = format.Style.LastFilePostfix == ":\n";
			checkOneLinePerFile.Active = format.Style.FileSeparator == ":\n* ";
			checkUseBullets.Active = format.Style.FirstFilePrefix.Trim ().Length > 0;
			checkIndentEntries.Active = format.Style.Indent.Length > 0;
			entryHeader.Text = ToCString (format.Style.Header.TrimEnd ('\n'));
			UpdatePreview ();
			updating = false;
		}
		void GenerateLogEntries ()
		{
			entries = new Dictionary<string,ChangeLogEntry> ();
			unknownFileCount = 0;
			enabled = false;
			requireComment = false;
			
			foreach (ChangeSetItem item in cset.Items) {
				MonoDevelop.Projects.SolutionItem 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++;
					if (policy != null && policy.VcsIntegration == VcsIntegration.RequireEntry)
						requireComment = true;
				}
				
				ChangeLogEntry entry;
				if (!entries.TryGetValue (logf, out entry)) {
					entry = new ChangeLogEntry ();
					entry.AuthorInformation = IdeApp.Workspace.GetAuthorInformation (parentItem);
					entry.MessageStyle = ChangeLogService.GetMessageStyle (parentItem);
					entry.CantGenerate = cantGenerate;
					entry.File = logf;
					if (cantGenerate)
						unknownFileCount++;
				
					if (!File.Exists (logf))
						entry.IsNew = true;
				
					entries [logf] = entry;
				}
				entry.Items.Add (item);
			}
			
			CommitMessageFormat 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);
			}
		}
Пример #11
0
		public static CommitMessageFormat GetCommitMessageFormat (ChangeSet cset, out AuthorInformation authorInfo)
		{
			// If all files belong to a project, use that project's policy. If not, use the solution policy
			Project project = null;
			bool sameProject = true;
			foreach (ChangeSetItem item in cset.Items) {
				if (project != null) {
					if (project.Files.GetFile (item.LocalPath) == null) {
						// Not all files belong to the same project
						sameProject = false;
						break;
					}
				} else {
					project = IdeApp.Workspace.GetProjectContainingFile (item.LocalPath);
				}
			}
			CommitMessageStyle style;
			
			if (project != null) {
				VersionControlPolicy policy;
				if (sameProject)
					policy = project.Policies.Get<VersionControlPolicy> ();
				else
					policy = project.ParentSolution.Policies.Get<VersionControlPolicy> ();
				style = policy.CommitMessageStyle;
			}
			else {
				style = PolicyService.GetDefaultPolicy<CommitMessageStyle> ();
			}
			
			authorInfo = project != null ? project.AuthorInformation : AuthorInformation.Default;
			
			CommitMessageFormat format = new CommitMessageFormat ();
			format.Style = style;
			format.ShowFilesForSingleComment = false;
			
			return format;
		}
Пример #12
0
		public static CommitMessageFormat GetCommitMessageFormat (SolutionItem item)
		{
			CommitMessageFormat format = new CommitMessageFormat ();
			format.Style = item.Policies.Get<VersionControlPolicy> ().CommitMessageStyle;
			format.ShowFilesForSingleComment = false;
			return format;
		}
Пример #13
0
 public string GenerateGlobalComment(CommitMessageFormat format, MonoDevelop.Projects.AuthorInformation userInfo)
 {
     return(GeneratePathComment(basePath, items, format, userInfo));
 }
Пример #14
0
		public string GenerateGlobalComment (CommitMessageFormat format, MonoDevelop.Projects.AuthorInformation userInfo)
		{
			return GeneratePathComment (basePath.FullPath, items, format, userInfo);
		}