canFork()) { throw new Exception("cannot fork this repo"); } $P = new MTrackRepo; $P->shortname = $name; if (isset($_POST['repo:parent'])) { // FIXME: ACL check to see if we're allowed to create under the specified // parent $P->parent = $_POST['repo:parent']; } else { $P->parent = "user:$owner"; } $P->scmtype = $S->scmtype; $P->description = $S->description; $P->clonedfrom = $S->repoid; $CS = MTrackChangeset::begin("repo:X", "Clone repo $S->shortname as $P->shortname"); $P->save($CS); $CS->setObject("repo:$P->repoid"); $CS->commit(); $name = $P->getBrowseRootName(); header("Location: ${ABSWEB}browse.php/$name"); exit; } header("Location: ${ABSWEB}browse.php"); exit;