[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 echo "Stripping remotes from repository default branches...\n"; 4 5 $table = new PhabricatorRepository(); 6 $table->openTransaction(); 7 $conn_w = $table->establishConnection('w'); 8 9 $repos = queryfx_all( 10 $conn_w, 11 'SELECT id, name, details FROM %T WHERE versionControlSystem = %s FOR UPDATE', 12 $table->getTableName(), 13 'git'); 14 15 foreach ($repos as $repo) { 16 $details = json_decode($repo['details'], true); 17 18 $old = idx($details, 'default-branch', ''); 19 if (strpos($old, '/') === false) { 20 continue; 21 } 22 23 $parts = explode('/', $old); 24 $parts = array_filter($parts); 25 $new = end($parts); 26 27 $details['default-branch'] = $new; 28 $new_details = json_encode($details); 29 30 $id = $repo['id']; 31 $name = $repo['name']; 32 33 echo "Updating default branch for repository #{$id} '{$name}' from ". 34 "'{$old}' to '{$new}' to remove the explicit remote.\n"; 35 queryfx( 36 $conn_w, 37 'UPDATE %T SET details = %s WHERE id = %d', 38 $table->getTableName(), 39 $new_details, 40 $id); 41 } 42 43 $table->saveTransaction(); 44 echo "Done.\n";
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |