? MISC-FIELD-CHANGES-REAPPLY.patch
? Makefile
? d6-50-nodes.sql.gz
? d7-50-nodes-new.sql.gz
? d7-50-nodes.sql.gz
? head.kpf
? patches
? modules/field/modules/options/options.test
? scripts/OLD-generate-autoload.pl
? scripts/generate-autoload.pl
? sites/all/cck
? sites/all/modules/color
? sites/all/modules/combofield
? sites/all/modules/devel
? sites/all/modules/pbs
? sites/all/modules/taint
? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: modules/field/field.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.api.php,v
retrieving revision 1.36
diff -u -F^[fc] -r1.36 field.api.php
--- modules/field/field.api.php	27 Sep 2009 12:52:55 -0000	1.36
+++ modules/field/field.api.php	28 Sep 2009 14:57:46 -0000
@@ -1315,7 +1315,7 @@ function hook_field_create_instance($ins
  * @param $has_data
  *   Whether any data already exists for this field.
  * @return
- *   Throws a FieldException to prevent the update from occuring.
+ *   Throws a FieldUpdateForbiddenException to prevent the update from occuring.
  */
 function hook_field_update_field_forbid($field, $prior_field, $has_data) {
   // A 'list' field stores integer keys mapped to display values. If
@@ -1328,7 +1328,7 @@ function hook_field_update_field_forbid(
     // If any data exist for those keys, forbid the update.
     $count = field_attach_query($prior_field['id'], array('value', $lost_keys, 'IN'), 1);
     if ($count > 0) {
-      throw new FieldException("Cannot update a list field not to include keys with existing data");
+      throw new FieldUpdateForbiddenException("Cannot update a list field not to include keys with existing data");
     }
   }
 }
Index: modules/field/field.attach.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.attach.inc,v
retrieving revision 1.48
diff -u -F^[fc] -r1.48 field.attach.inc
--- modules/field/field.attach.inc	27 Sep 2009 12:52:55 -0000	1.48
+++ modules/field/field.attach.inc	28 Sep 2009 14:57:46 -0000
@@ -1110,19 +1110,6 @@ function field_attach_query_revisions($f
 }
 
 /**
- * Determine whether a field has any data.
- *
- * @param $field
- *   A field structure.
- * @return
- *   TRUE if the field has data for any object; FALSE otherwise.
- */
-function field_attach_field_has_data($field) {
-  $results = field_attach_query($field['id'], array(), 1);
-  return !empty($results);
-}
-
-/**
  * Generate and return a structured content array tree suitable for
  * drupal_render() for all of the fields on an object. The format of
  * each field's rendered content depends on the display formatter and
Index: modules/field/field.crud.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.crud.inc,v
retrieving revision 1.34
diff -u -F^[fc] -r1.34 field.crud.inc
--- modules/field/field.crud.inc	27 Sep 2009 12:52:55 -0000	1.34
+++ modules/field/field.crud.inc	28 Sep 2009 14:57:46 -0000
@@ -409,7 +409,7 @@ function field_update_field($field) {
   );
   $field['indexes'] += $schema['indexes'];
 
-  $has_data = field_attach_field_has_data($field);
+  $has_data = field_has_data($field);
 
   // See if any module forbids the update by throwing an exception.
   foreach (module_implements('field_update_forbid') as $module) {
Index: modules/field/field.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.module,v
retrieving revision 1.35
diff -u -F^[fc] -r1.35 field.module
--- modules/field/field.module	27 Sep 2009 12:52:55 -0000	1.35
+++ modules/field/field.module	28 Sep 2009 14:57:46 -0000
@@ -131,6 +131,11 @@
 class FieldException extends Exception {}
 
 /**
+ * Exception class thrown by hook_field_update_forbid().
+ */
+class FieldUpdateForbiddenException extends FieldException {}
+
+/**
  * Implement hook_flush_caches.
  */
 function field_flush_caches() {
@@ -611,6 +616,19 @@ function field_view_field($obj_type, $ob
 }
 
 /**
+ * Determine whether a field has any data.
+ *
+ * @param $field
+ *   A field structure.
+ * @return
+ *   TRUE if the field has data for any object; FALSE otherwise.
+ */
+function field_has_data($field) {
+  $results = field_attach_query($field['id'], array(), 1);
+  return !empty($results);
+}
+
+/**
  * Determine whether the user has access to a given field.
  *
  * @param $op
Index: modules/field/field.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.test,v
retrieving revision 1.54
diff -u -F^[fc] -r1.54 field.test
--- modules/field/field.test	27 Sep 2009 12:52:55 -0000	1.54
+++ modules/field/field.test	28 Sep 2009 14:57:46 -0000
@@ -1874,30 +1874,6 @@ class FieldCrudTestCase extends FieldTes
   }
 
   /**
-   * Test updating a field with data.
-   */
-  function testUpdateFieldSchemaWithData() {
-    // Create a decimal 5.2 field and add some data.
-    $field = array('field_name' => 'decimal52', 'type' => 'number_decimal', 'settings' => array('precision' => 5, 'scale' => 2));
-    $field = field_create_field($field);
-    $instance = array('field_name' => 'decimal52', 'bundle' => FIELD_TEST_BUNDLE);
-    $instance = field_create_instance($instance);
-    $entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
-    $entity->decimal52[FIELD_LANGUAGE_NONE][0]['value'] = '1.235';
-    field_attach_insert('test_entity', $entity);
-
-    // Attempt to update the field in a way that would work without data.
-    $field['settings']['scale'] = 3;
-    try {
-      field_update_field($field);
-      $this->fail(t('Cannot update field schema with data.'));
-    }
-    catch (FieldException $e) {
-      $this->pass(t('Cannot update field schema with data.'));
-    }
-  }
-
-  /**
    * Test field type modules forbidding an update.
    */
   function testUpdateFieldForbid() {
Index: modules/field/modules/field_sql_storage/field_sql_storage.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/field_sql_storage/field_sql_storage.module,v
retrieving revision 1.24
diff -u -F^[fc] -r1.24 field_sql_storage.module
--- modules/field/modules/field_sql_storage/field_sql_storage.module	27 Sep 2009 12:52:55 -0000	1.24
+++ modules/field/modules/field_sql_storage/field_sql_storage.module	28 Sep 2009 14:57:46 -0000
@@ -223,7 +223,7 @@ function field_sql_storage_field_storage
  */
 function field_sql_storage_field_update_forbid($field, $prior_field, $has_data) {
   if ($has_data && $field['columns'] != $prior_field['columns']) {
-    throw new FieldException("field_sql_storage cannot change the schema for an existing field with data.");
+    throw new FieldUpdateForbiddenException("field_sql_storage cannot change the schema for an existing field with data.");
   }
 }
 
Index: modules/field/modules/field_sql_storage/field_sql_storage.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/field_sql_storage/field_sql_storage.test,v
retrieving revision 1.9
diff -u -F^[fc] -r1.9 field_sql_storage.test
--- modules/field/modules/field_sql_storage/field_sql_storage.test	27 Sep 2009 12:52:55 -0000	1.9
+++ modules/field/modules/field_sql_storage/field_sql_storage.test	28 Sep 2009 14:57:46 -0000
@@ -295,6 +295,29 @@ class FieldSqlStorageTestCase extends Dr
     $this->assertEqual($count, 1, 'NULL field translation is wiped.');
   }
 
+  /**
+   * Test trying to update a field with data.
+   */
+  function testUpdateFieldSchemaWithData() {
+    // Create a decimal 5.2 field and add some data.
+    $field = array('field_name' => 'decimal52', 'type' => 'number_decimal', 'settings' => array('precision' => 5, 'scale' => 2));
+    $field = field_create_field($field);
+    $instance = array('field_name' => 'decimal52', 'bundle' => FIELD_TEST_BUNDLE);
+    $instance = field_create_instance($instance);
+    $entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
+    $entity->decimal52[FIELD_LANGUAGE_NONE][0]['value'] = '1.235';
+    field_attach_insert('test_entity', $entity);
+
+    // Attempt to update the field in a way that would work without data.
+    $field['settings']['scale'] = 3;
+    try {
+      field_update_field($field);
+      $this->fail(t('Cannot update field schema with data.'));
+    }
+    catch (FieldException $e) {
+      $this->pass(t('Cannot update field schema with data.'));
+    }
+  }
 
   /**
    * Test adding and removing indexes while data is present.
Index: modules/field_ui/field_ui.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field_ui/field_ui.admin.inc,v
retrieving revision 1.17
diff -u -F^[fc] -r1.17 field_ui.admin.inc
--- modules/field_ui/field_ui.admin.inc	26 Sep 2009 15:57:38 -0000	1.17
+++ modules/field_ui/field_ui.admin.inc	28 Sep 2009 14:57:46 -0000
@@ -1114,7 +1114,7 @@ function field_ui_field_edit_form($form,
   $description .= $info['description'] . '</p>';
   $form['#prefix'] = '<div class="description">' . $description . '</div>';
 
-  $has_data = field_attach_field_has_data($field);
+  $has_data = field_has_data($field);
   if ($has_data) {
     $description = '<p>' . t('These settings apply to the %field field everywhere it is used. Because the field already has data, some settings can no longer be changed.', array('%field' => $instance['label'])) . '</p>';
   }
@@ -1143,7 +1143,7 @@ function field_ui_field_edit_form($form,
     '#description' => $description,
   );
 
-  // Add additional field settings from the field module. The field module is
+  // Add additional field type settings. The field type module is
   // responsible for not returning settings that cannot be changed if
   // the field already has data.
   $additions = module_invoke($field['module'], 'field_settings_form', $field, $instance, $has_data);
