Google Code is shutting down so I want to move my 2500 issues to Phabricator (hosted at Phoreplay).
While there are moving procedure for Github and others, I did not manage to find similar tools for Phabricator.
How to move issues from Google Code to Phabricator?
Only issues, not wiki/code/downloads/etc.
Note: I use Phabricator instead of Github because it fits my requirements better.
Preliminary note if you wish to keep tasks IDs
Migrations project could be facilitated if we can temporarily edit the Maniphest application code, so as you aren't in control of your installation, this is difficult to offer a clean solution to get consistent ID. So, first, you should be in control of your installation.
Such migration code has been written by the Blender project: here their repository at import moment.
The steps
Export
Google provides some tools to perform the migration. These tools include a issues.py script to parse issues on Google code.
With that, you can dump your issues in a workable format, for example JSON to store an array of comments.
Import through API (best for smallest tasks, without comments)
You could use the API and call through conduit maniphest.createtask. But this is not really convenient, as it's not the easiest way to add comments, closes the issue, etc.
Import through a script
This is probably the most interesting way to import the tasks, and this is the solution offering the maximal flexibility.
Here the skeleton of such script I drafting from the Blender code and some of my internal codes:
#!/usr/bin/env php
<?php
$root = dirname(dirname(__FILE__));
require_once $root . '/scripts/__init_script__.php';
/**
* Represents a task importable into Phabricator
*/
class LegacyTask {
private $id;
private $title;
//... other tasks properties, depending the Google Code fields
public function importIntoPhabricator () {
$projects = ......... // we need an array with one or more PHIDs, according what you created
$task = ManiphestTask::initializeNewTask($reporter);
$task->setTitle($title);
$task->attachProjectPHIDs($projects);
$task->setDescription($this->description);
$task->setPriority($this->priority);
$task->setOverrideID($this->id); //This is the method you want to borrow to the Blender migration code
$task->save();
//Initial transaction
$changes = [
ManiphestTransaction::TYPE_STATUS => ManiphestTaskStatus::STATUS_OPEN,
PhabricatorTransactions::TYPE_VIEW_POLICY => 'public'
];
self::applyTransactionsForChanges($task, $changes);
//Closes task
if ($this->closed) {
$status = ... //ManiphestTaskStatus::STATUS_CLOSED_RESOLVED
self::closeTask($task, $status);
}
//Project transaction
self::associateTaskToProject($task, $projects);
//Adds comments
//...
}
static public function getTransactions ($changes) {
$transactions = [];
$template = new ManiphestTransaction();
foreach ($changes as $type => $value) {
$transaction = clone $template;
$transaction->setTransactionType($type);
if ($type == PhabricatorTransactions::TYPE_EDGE) {
$transaction->setMetadataValue('edge:type', PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
}
$transaction->setNewValue($value);
$transactions[] = $transaction;
}
return $transactions;
}
static public function applyTransactionsForChanges ($task, $changes) {
$transactions = self::getTransactions($changes);
self::applyTransactions($task, $transactions);
}
static public function applyTransactions ($task, $transactions) {
$editor = id(new ManiphestTransactionEditor())
->setActor(self::getReporterUser())
->setContentSource(self::getContentSource())
->setContinueOnNoEffect(true)
->applyTransactions($task, $transactions);
}
static function associateTaskToProject($task, $projects) {
$project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
$transactions = [
id(new ManiphestTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue('edge:type', $project_type)
->setNewValue([
'=' => array_fuse($projects)
])
];
self::applyTransactions($task, $transactions);
}
/**
* Closes the task
*/
static public function closeTask ($task, $status) {
$changes = [
ManiphestTransaction::TYPE_STATUS => $status
];
self::applyTransactionsForChanges($task, $changes);
}
}
Close status are documented here.
It works best.
Ask your core developers and top reporters if any to create an account, try to map their users, and for everyone else, attribute issues and comments to a bot account created for the migration.