Index: /Users/aaron/Sites/trunk/wp-admin/import/wordpress.php
===================================================================
--- /Users/aaron/Sites/trunk/wp-admin/import/wordpress.php	(revision 5129)
+++ /Users/aaron/Sites/trunk/wp-admin/import/wordpress.php	(working copy)
@@ -212,6 +212,7 @@
 	function process_posts() {
 		global $wpdb;
 		$i = -1;
+		$id_lookup = array();
 		echo '<ol>';
 		foreach ($this->posts as $post) {
 
@@ -258,7 +259,9 @@
 					wp_create_categories($categories, $post_id);
 				}
 			}
-
+				// Old Post IDs -> New Post IDs
+				$id_lookup[$this->get_tag($post, 'wp:post_id')] = $post_id;
+				
 				// Now for comments
 				preg_match_all('|<wp:comment>(.*?)</wp:comment>|is', $post, $comments);
 				$comments = $comments[1];
@@ -297,6 +300,22 @@
 		}
 
 		echo '</ol>';
+		
+		// Run through and massage post_parents
+		foreach($this->posts as $old_post) //foreach($parent_lookup as $post_parent => $post_id)
+		{
+			$old_post_parent = $this->get_tag( $old_post, 'wp:post_parent' );
+			$old_post_id = $this->get_tag( $old_post, 'wp:post_id' );
+			
+			if( 0 < $old_post_parent )
+			{
+				// If we can find the original parent id and match it up, let's do it. Otherwise set to 0 so we don't lose the page on the manage screen
+				if ( in_array($old_post_parent, $id_lookup ) )
+					wp_update_post( array('ID' => $id_lookup[$old_post_id], 'post_parent' => $id_lookup[$old_post_parent]) );	
+				else 
+					wp_update_post( array('ID' => $id_lookup[$old_post_id], '0') );
+			}
+		}
 
 		wp_import_cleanup($this->id);
 
@@ -343,4 +362,4 @@
 
 register_importer('wordpress', 'WordPress', __('Import <strong>posts, comments, custom fields, pages, and categories</strong> from a WordPress export file'), array ($wp_import, 'dispatch'));
 
-?>
+?>
\ No newline at end of file

