[Erp5-report] r40067 jm - in /erp5/trunk/products: ERP5/bootstrap/erp5_core/SkinTemplateIte...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 8 18:19:10 CET 2010


Author: jm
Date: Mon Nov  8 18:19:08 2010
New Revision: 40067

URL: http://svn.erp5.org?rev=40067&view=rev
Log:
Make TemplateTool_filterTemplateUnicodeDiff filter the added 'output_encoding' property

- DiffUtils is changed so that filters are also called on deleted/added hunks.
- Fix TemplateTool_filterPortalTypeClassDiff not to fail on deleted/added hunks.

Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterPortalTypeClassDiff.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterTemplateUnicodeDiff.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
    erp5/trunk/products/ERP5Type/DiffUtils.py

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterPortalTypeClassDiff.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterPortalTypeClassDiff.xml?rev=40067&r1=40066&r2=40067&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterPortalTypeClassDiff.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterPortalTypeClassDiff.xml [utf8] Mon Nov  8 18:19:08 2010
@@ -52,7 +52,7 @@
             <key> <string>_body</string> </key>
             <value> <string encoding="cdata"><![CDATA[
 
-if len(old_line_list) !=1 and len(new_line_list) != 1:\n
+if len(old_line_list) !=1 or len(new_line_list) != 1:\n
   return False\n
 new_line = new_line_list[0]\n
 \n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterTemplateUnicodeDiff.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterTemplateUnicodeDiff.xml?rev=40067&r1=40066&r2=40067&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterTemplateUnicodeDiff.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterTemplateUnicodeDiff.xml [utf8] Mon Nov  8 18:19:08 2010
@@ -50,11 +50,7 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>from Products.ERP5Type.Log import log\n
-log(\'old_line_list\', old_line_list)\n
-log(\'new_line_list\', new_line_list)\n
-log(\'replace\', new_line_list[0] == old_line_list[0].replace("string encoding","unicode encoding"))\n
-if len(old_line_list) == 1 and len(new_line_list) == 1:\n
+            <value> <string>if len(old_line_list) == 1 and len(new_line_list) == 1:\n
   if new_line_list[0] == old_line_list[0].replace("string encoding","unicode encoding") and \\\n
          old_line_list[0] == \'\074value\076 \074string encoding="cdata"\076\074![CDATA[\':\n
     return True\n
@@ -62,7 +58,14 @@ if len(old_line_list) == 1 and len(new_l
   if new_line_list[0] == old_line_list[0].replace("string","unicode") and \\\n
      old_line_list[0] == "]]\076\074/string\076 \074/value\076":\n
     return True\n
-log("return False")\n
+\n
+elif not old_line_list and \'\\n\'.join(new_line_list) == """\\\n
+\074key\076 \074string\076output_encoding\074/string\076 \074/key\076\n
+\074value\076 \074string\076utf-8\074/string\076 \074/value\076\n
+\074/item\076\n
+\074item\076""":\n
+  return True\n
+\n
 return False\n
 </string> </value>
         </item>
@@ -86,13 +89,19 @@ return False\n
         </item>
         <item>
             <key> <string>description</string> </key>
-            <value> <string>This script filter this kind of xml changes :\n
--  \074value\076 \074string encoding="cdata"\076\074![CDATA[\n
-+ \074value\076 \074unicode encoding="cdata"\076\074![CDATA[\n
-\n
-AND also\n
--  ]]\076\074/string\076 \074/value\076\n
-+ ]]\076\074/unicode\076 \074/value\076</string> </value>
+            <value> <string>This script filter the following xml changes :\n
+@@\n
+-            \074value\076 \074string encoding="cdata"\076\074![CDATA[\n
++            \074value\076 \074unicode encoding="cdata"\076\074![CDATA[\n
+@@\n
+-]]\076\074/string\076 \074/value\076\n
++]]\076\074/unicode\076 \074/value\076\n
+@@\n
++            \074key\076 \074string\076output_encoding\074/string\076 \074/key\076\n
++            \074value\076 \074string\076utf-8\074/string\076 \074/value\076\n
++        \074/item\076\n
++        \074item\076\n
+</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -120,11 +129,9 @@ AND also\n
                           <tuple>
                             <string>old_line_list</string>
                             <string>new_line_list</string>
-                            <string>Products.ERP5Type.Log</string>
-                            <string>log</string>
+                            <string>len</string>
                             <string>_getitem_</string>
                             <string>_getattr_</string>
-                            <string>len</string>
                             <string>True</string>
                             <string>False</string>
                           </tuple>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=40067&r1=40066&r2=40067&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] Mon Nov  8 18:19:08 2010
@@ -1 +1 @@
-1779
\ No newline at end of file
+1780
\ No newline at end of file

Modified: erp5/trunk/products/ERP5Type/DiffUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/DiffUtils.py?rev=40067&r1=40066&r2=40067&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/DiffUtils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/DiffUtils.py [utf8] Mon Nov  8 18:19:08 2010
@@ -158,11 +158,13 @@ class DiffFile:
       return []
     block_list = []
     for child in self.children:
-      old_line_list = [x[0].strip() for x in child.getOldCodeList()
-                       if x[0] is not None and x[1] == MODIFIED_DIFF_COLOR]
-      new_line_list = [x[0].strip() for x in child.getNewCodeList()
-                       if x[0] is not None and x[1] == MODIFIED_DIFF_COLOR]
-      if old_line_list and new_line_list:
+      old_line_list = [line.strip() for line, color in child.getOldCodeList()
+                       if line is not None and color in (MODIFIED_DIFF_COLOR,
+                                                         DELETED_DIFF_COLOR)]
+      new_line_list = [line.strip() for line, color in child.getNewCodeList()
+                       if line is not None and color in (MODIFIED_DIFF_COLOR,
+                                                         ADDITION_DIFF_COLOR)]
+      if old_line_list or new_line_list:
         block_list.append((child,(old_line_list, new_line_list)))
     return block_list
 




More information about the Erp5-report mailing list