Hi,

I noticed that commit messages aren't nicely formatted any more after
recent changes.  Newlines are converted to space.

Attached patch fixes it.

--
Regards,
Georg.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MercurialEclipse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mercurialeclipse?hl=en
-~----------~----~----~----~------~----~------~--~---

# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1222721180 -7200
# Node ID 40d75cdea5cdf622ba29256210f9e2909c7bb50c
# Parent  a9d1f3546ec19d1f95b90cdf74947020aaa03a4d
restore formatting of commit messages

Line breaks in commit messages were being converted to spaces, leading to a loss
of visual formatting.  This change fixes it.

diff --git a/src/com/vectrace/MercurialEclipse/commands/AbstractParseChangesetClient.java b/src/com/vectrace/MercurialEclipse/commands/AbstractParseChangesetClient.java
--- a/src/com/vectrace/MercurialEclipse/commands/AbstractParseChangesetClient.java
+++ b/src/com/vectrace/MercurialEclipse/commands/AbstractParseChangesetClient.java
@@ -70,6 +70,7 @@
         private String au;
         private String pr;
         private String de;
+        private StringBuilder chars;
         private static IResource res;
         private Direction direction;
         private HgRepositoryLocation repository;
@@ -124,6 +125,7 @@
 
         public void characters(char[] ch, int start, int length)
                 throws SAXException {
+            for (int i = start; i < start+length; i++) chars.append(ch[i]);
         }
 
         public void endDocument() throws SAXException {
@@ -131,7 +133,9 @@
 
         public void endElement(String uri, String localName, String name)
                 throws SAXException {
-            if (name.equals("cs")) {
+            if (name.equals("de")) {
+                de = chars.toString();
+            } else if (name.equals("cs")) {
 
                 ChangeSet.Builder csb = new ChangeSet.Builder(rv, nl, br, di,
                         unescape(au));
@@ -201,8 +205,9 @@
              * <br v="{branches}"/> <tg v="{tags}"/> <rv v="{rev}"/> <ns
              * v="{node|short}"/> <nl v="{node}"/> <di v="{date|isodate}"/> <da
              * v="{date|age}"/> <au v="{author|person}"/> <pr v="{parents}"/>
-             * <de v="{desc|escape|tabindent}"/>
+             * <de>{desc|escape|tabindent}</de>
              */
+            this.chars = new StringBuilder();
             if (name.equals("br")) {
                 this.br = atts.getValue(0);
             } else if (name.equals("tg")) {
@@ -221,8 +226,6 @@
                 this.au = atts.getValue(0);
             } else if (name.equals("pr")) {
                 this.pr = atts.getValue(0);
-            } else if (name.equals("de")) {
-                this.de = untab(unescape(atts.getValue(0)));
             } else if (name.equals("fl")) {
                 this.action = FileStatus.Action.MODIFIED;
             } else if (name.equals("fa")) {
diff --git a/styles/log_style.tmpl b/styles/log_style.tmpl
--- a/styles/log_style.tmpl
+++ b/styles/log_style.tmpl
@@ -8,5 +8,5 @@
 <da v="{date|age}"/>
 <au v="{author|person|escape}"/>
 <pr v="{parents}"/>
-<de v="{desc|escape|tabindent}"/>
+<de>{desc|escape|tabindent}</de>
 </cs>
\ No newline at end of file
diff --git a/styles/log_style_with_files.tmpl b/styles/log_style_with_files.tmpl
--- a/styles/log_style_with_files.tmpl
+++ b/styles/log_style_with_files.tmpl
@@ -8,7 +8,7 @@
 <da v="{date|age}"/>
 <au v="{author|person|escape}"/>
 <pr v="{parents}"/>
-<de v="{desc|escape|tabindent}"/>
+<de>{desc|escape|tabindent}</de>
 <fl>{files}</fl>
 <fa>{file_adds}</fa>
 <fd>{file_dels}</fd>

Reply via email to