Index: rules/rules.export.inc
===================================================================
--- rules/rules.export.inc      (revision 1818)
+++ rules/rules.export.inc      (working copy)
@@ -15,8 +15,11 @@ function rules_export_items($export, $mo
     // Allow item specific adaption before exporting
     foreach ($export[$item_type] as $item_name => $item) {
       rules_item_type_invoke($item_type, 'export', array($item_name, &$export[$item_type][$item_name], &$export, $module));
+      ksort($export[$item_type]);
     }
   }
+  // Sort the elements to avoid problems DIFFing the output between exports.
+  ksort($export);
   return $export;
 }
 
@@ -37,6 +40,10 @@ function rules_item_rule_set_export($set
     $rule_set['categories'][$module] = $module;
     $rule_set['status'] = 'default';
   }
+  // Sort the elements to avoid problems DIFFing the output between exports.
+  if (!empty($rule_set)) {
+    ksort($rule_set);
+  }
 }
 
 
@@ -58,6 +65,18 @@ function rules_item_rule_export($rule_na
       $rule['#categories'][$module] = $module;
     }
   }
+  // Sort the elements to avoid problems DIFFing the output between exports.
+  ksort($rule);
+  foreach($rule['#actions'] as $action_index => $action) {
+    ksort($rule['#actions'][$action_index]);
+    ksort($rule['#actions'][$action_index]['#info']);
+    ksort($rule['#actions'][$action_index]['#settings']);
+  }
+  foreach($rule['#conditions'] as $condition_index => $condition) {
+    ksort($rule['#conditions'][$condition_index]);
+    ksort($rule['#conditions'][$condition_index]['#info']);
+    ksort($rule['#conditions'][$condition_index]['#settings']);
+  }
 }
 
 /**

