Commits

Anonymous committed 63b2ad1

Optimization: Removed whitespace from the XML styles, so that the XML parser does not need to strip it. (Shark showed the whitespace-stripping as a minor hot-spot.)

If you want to examine the output that Mercurial produces with these styles, pipe it through xmllint --format.

Comments (0)

Files changed (3)

Resources/xmlstyle/xml.style

-header = '<?xml version="1.0" encoding="UTF-8" ?>\n<repository name="{repo}">\n\n'
-footer = '</repository>\n'
+header = '<?xml version="1.0" encoding="UTF-8" ?><repository name="{repo}">'
+footer = '</repository>'
 changeset = changeset.tmpl
-#start_files = '    <files>\n'
-file     = '\t<file path="{file|escape}" />\n'
-file_add = '\t<file path="{file_add|escape}" mode="add" />\n'
-file_del = '\t<file path="{file_del|escape}" mode="del" />\n'
-file_copy= '\t<file path="{file_copy|escape}" mode="copy" src="{source}" />\n'
-#end_files = '    </files>\n'
-parent = '    <parent rev="{rev}" />\n'
-branch = '    <branch name="{branch|escape}" />\n'
-tag    = '    <tag name="{tag|escape}" />\n'
-extra  = '    <extra key="{key|escape}" value="{value|escape}" />\n'
+#start_files = '    <files>'
+file     = '<file path="{file|escape}" />'
+file_add = '<file path="{file_add|escape}" mode="add" />'
+file_del = '<file path="{file_del|escape}" mode="del" />'
+file_copy= '<file path="{file_copy|escape}" mode="copy" src="{source}" />'
+#end_files = '    </files>'
+parent = '    <parent rev="{rev}" />'
+branch = '    <branch name="{branch|escape}" />'
+tag    = '    <tag name="{tag|escape}" />'
+extra  = '    <extra key="{key|escape}" value="{value|escape}" />'

Resources/xmlstyle/xmlminimal.style

-header = '<?xml version="1.0" encoding="UTF-8" ?>\n<repository name="{repo}">\n\n'
-footer = '</repository>\n'
-changeset = '<changeset rev="{rev}" node="{node|escape}">{parents}</changeset>\n'
+header = '<?xml version="1.0" encoding="UTF-8" ?><repository name="{repo}">'
+footer = '</repository>'
+changeset = '<changeset rev="{rev}" node="{node|escape}">{parents}</changeset>'
 parent = '<parent rev="{rev}" />'

Source/HgLogOperation.m

     NSMutableString *str = [NSMutableString string];
     for( NSXMLNode *node in nodes )
         [str appendString: node.stringValue];
-    return [str stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
+    return str;
 }
 
 /* Follow an XPath, returning the result as an array of strings */
     NSMutableArray *strings = [NSMutableArray array];
     for( NSXMLNode *node in nodes ) {
         NSString *str = node.stringValue;
-        str = [str stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
         [strings addObject: str];
     }
     return strings;