Index: modules/translation/translation.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v
retrieving revision 1.79
diff -u -r1.79 translation.module
--- modules/translation/translation.module	16 Apr 2010 13:52:23 -0000	1.79
+++ modules/translation/translation.module	19 Apr 2010 23:53:42 -0000
@@ -279,6 +279,8 @@
         ))
         ->condition('nid', $node->nid)
         ->execute();
+      // Save tnid to avoid loss in case of resave.
+      $node->tnid = $tnid;
     }
   }
 }
Index: modules/translation/translation.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.test,v
retrieving revision 1.25
diff -u -r1.25 translation.test
--- modules/translation/translation.test	31 Mar 2010 20:05:06 -0000	1.25
+++ modules/translation/translation.test	19 Apr 2010 23:53:42 -0000
@@ -13,7 +13,7 @@
   }
 
   function setUp() {
-    parent::setUp('locale', 'translation');
+    parent::setUp('locale', 'translation', 'translation_test');
   }
 
   /**
@@ -166,6 +166,7 @@
     // Check to make sure that translation was successful.
     $node = $this->drupalGetNodeByTitle($title);
     $this->assertTrue($node, t('Node found in database.'));
+    $this->assertTrue($node->tnid == $nid, t('Translation set id correctly stored.'));
 
     return $node;
   }
Index: modules/translation/tests/translation_test.module
===================================================================
RCS file: modules/translation/tests/translation_test.module
diff -N modules/translation/tests/translation_test.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/translation/tests/translation_test.module	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,14 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Mock module for content translation tests.
+ */
+
+/**
+ * Implements hook_node_insert().
+ */
+function translation_test_node_insert($node) {
+  drupal_write_record('node', $node, 'nid');
+}
Index: modules/translation/tests/translation_test.info
===================================================================
RCS file: modules/translation/tests/translation_test.info
diff -N modules/translation/tests/translation_test.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/translation/tests/translation_test.info	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,8 @@
+; $Id$
+name = "Content Translation Test"
+description = "Support module for the content translation tests."
+core = 7.x
+package = Testing
+files[] = translation_test.module
+version = VERSION
+hidden = TRUE
