| 
									
										
										
										
											2012-04-10 12:51:34 -07:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $table = new DifferentialRevision(); | 
					
						
							| 
									
										
										
										
											2013-01-16 17:55:39 -08:00
										 |  |  | $table->openTransaction(); | 
					
						
							|  |  |  | $table->beginReadLocking(); | 
					
						
							| 
									
										
										
										
											2012-04-10 12:51:34 -07:00
										 |  |  | $conn_w = $table->establishConnection('w'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-09 11:36:49 -07:00
										 |  |  | echo 'Migrating revisions'; | 
					
						
							| 
									
										
										
										
											2012-04-16 12:35:48 -07:00
										 |  |  | do { | 
					
						
							| 
									
										
										
										
											2013-01-16 17:55:39 -08:00
										 |  |  |   $revisions = $table->loadAllWhere('branchName IS NULL LIMIT 1000'); | 
					
						
							| 
									
										
										
										
											2012-04-10 12:51:34 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-16 12:35:48 -07:00
										 |  |  |   foreach ($revisions as $revision) { | 
					
						
							| 
									
										
										
										
											2014-06-09 11:36:49 -07:00
										 |  |  |     echo '.'; | 
					
						
							| 
									
										
										
										
											2012-04-10 12:51:34 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-16 12:35:48 -07:00
										 |  |  |     $diff = $revision->loadActiveDiff(); | 
					
						
							|  |  |  |     if (!$diff) { | 
					
						
							|  |  |  |       continue; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-04-10 12:51:34 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-16 12:35:48 -07:00
										 |  |  |     $branch_name = $diff->getBranch(); | 
					
						
							|  |  |  |     $arc_project_phid = $diff->getArcanistProjectPHID(); | 
					
						
							| 
									
										
										
										
											2012-04-10 12:51:34 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-16 12:35:48 -07:00
										 |  |  |     queryfx( | 
					
						
							|  |  |  |       $conn_w, | 
					
						
							|  |  |  |       'UPDATE %T SET branchName = %s, arcanistProjectPHID = %s WHERE id = %d', | 
					
						
							|  |  |  |       $table->getTableName(), | 
					
						
							|  |  |  |       $branch_name, | 
					
						
							|  |  |  |       $arc_project_phid, | 
					
						
							|  |  |  |       $revision->getID()); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } while (count($revisions) == 1000); | 
					
						
							| 
									
										
										
										
											2013-01-16 17:55:39 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | $table->endReadLocking(); | 
					
						
							|  |  |  | $table->saveTransaction(); | 
					
						
							| 
									
										
										
										
											2012-04-10 12:51:34 -07:00
										 |  |  | echo "\nDone.\n"; |