 1fb39a20d3
			
		
	
	1fb39a20d3
	
	
	
		
			
			Summary: Ref T2715. Test Plan: Used `phid.lookup` and `phid.query` to load handles. Grepped for `PHID_TYPE_DREV`. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2715 Differential Revision: https://secure.phabricator.com/D6509
		
			
				
	
	
		
			31 lines
		
	
	
		
			666 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			666 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| echo "Migrating differential dependencies to edges...\n";
 | |
| $table = new DifferentialRevision();
 | |
| $table->openTransaction();
 | |
| 
 | |
| foreach (new LiskMigrationIterator($table) as $rev) {
 | |
|   $id = $rev->getID();
 | |
|   echo "Revision {$id}: ";
 | |
| 
 | |
|   $deps = $rev->getAttachedPHIDs(DifferentialPHIDTypeRevision::TYPECONST);
 | |
|   if (!$deps) {
 | |
|     echo "-\n";
 | |
|     continue;
 | |
|   }
 | |
| 
 | |
|   $editor = new PhabricatorEdgeEditor();
 | |
|   $editor->setSuppressEvents(true);
 | |
|   foreach ($deps as $dep) {
 | |
|     $editor->addEdge(
 | |
|       $rev->getPHID(),
 | |
|       PhabricatorEdgeConfig::TYPE_DREV_DEPENDS_ON_DREV,
 | |
|       $dep);
 | |
|   }
 | |
|   $editor->save();
 | |
|   echo "OKAY\n";
 | |
| }
 | |
| 
 | |
| $table->saveTransaction();
 | |
| echo "Done.\n";
 |