当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorRepository::getVersionControlSystem方法代码示例

本文整理汇总了PHP中PhabricatorRepository::getVersionControlSystem方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorRepository::getVersionControlSystem方法的具体用法?PHP PhabricatorRepository::getVersionControlSystem怎么用?PHP PhabricatorRepository::getVersionControlSystem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorRepository的用法示例。


在下文中一共展示了PhabricatorRepository::getVersionControlSystem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $e_name = true;
     $e_callsign = true;
     $repository = new PhabricatorRepository();
     $type_map = PhabricatorRepositoryType::getAllRepositoryTypes();
     $errors = array();
     if ($request->isFormPost()) {
         $repository->setName($request->getStr('name'));
         $repository->setCallsign($request->getStr('callsign'));
         $repository->setVersionControlSystem($request->getStr('type'));
         if (!strlen($repository->getName())) {
             $e_name = 'Required';
             $errors[] = 'Repository name is required.';
         } else {
             $e_name = null;
         }
         if (!strlen($repository->getCallsign())) {
             $e_callsign = 'Required';
             $errors[] = 'Callsign is required.';
         } else {
             if (!preg_match('/^[A-Z]+$/', $repository->getCallsign())) {
                 $e_callsign = 'Invalid';
                 $errors[] = 'Callsign must be ALL UPPERCASE LETTERS.';
             } else {
                 $e_callsign = null;
             }
         }
         if (empty($type_map[$repository->getVersionControlSystem()])) {
             $errors[] = 'Invalid version control system.';
         }
         if (!$errors) {
             try {
                 $repository->save();
                 return id(new AphrontRedirectResponse())->setURI('/repository/edit/' . $repository->getID() . '/');
             } catch (AphrontQueryDuplicateKeyException $ex) {
                 $e_callsign = 'Duplicate';
                 $errors[] = 'Callsign must be unique. Another repository already ' . 'uses that callsign.';
             }
         }
     }
     $error_view = null;
     if ($errors) {
         $error_view = new AphrontErrorView();
         $error_view->setErrors($errors);
         $error_view->setTitle('Form Errors');
     }
     $form = new AphrontFormView();
     $form->setUser($user)->setAction('/repository/create/')->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($repository->getName())->setError($e_name)->setCaption('Human-readable repository name.'))->appendChild('<p class="aphront-form-instructions">Select a "Callsign" &mdash; a ' . 'short, uppercase string to identify revisions in this repository. If ' . 'you choose "EX", revisions in this repository will be identified ' . 'with the prefix "rEX".</p>')->appendChild(id(new AphrontFormTextControl())->setLabel('Callsign')->setName('callsign')->setValue($repository->getCallsign())->setError($e_callsign)->setCaption('Short, UPPERCASE identifier. Once set, it can not be changed.'))->appendChild(id(new AphrontFormSelectControl())->setLabel('Type')->setName('type')->setOptions($type_map)->setValue($repository->getVersionControlSystem()))->appendChild(id(new AphrontFormSubmitControl())->setValue('Create Repository')->addCancelButton('/repository/'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Create Repository');
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Create Repository'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:57,代码来源:PhabricatorRepositoryCreateController.php

示例2: createMenuItem

 public function createMenuItem(PhabricatorUser $viewer, DifferentialRevision $revision, PhabricatorRepository $repository)
 {
     $vcs = $repository->getVersionControlSystem();
     if ($vcs !== PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL) {
         return;
     }
     if (!$repository->isHosted()) {
         return;
     }
     return $this->createActionView($revision, pht('Land to Hosted Repository'));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:11,代码来源:DifferentialLandingToHostedMercurial.php

示例3: initQueryObject

 protected static final function initQueryObject($base_class, PhabricatorRepository $repository)
 {
     $map = array(PhabricatorRepositoryType::REPOSITORY_TYPE_GIT => 'Git', PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL => 'Mercurial', PhabricatorRepositoryType::REPOSITORY_TYPE_SVN => 'Svn');
     $name = idx($map, $repository->getVersionControlSystem());
     if (!$name) {
         throw new Exception(pht('Unsupported VCS!'));
     }
     $class = str_replace('Diffusion', 'Diffusion' . $name, $base_class);
     $obj = new $class();
     return $obj;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:11,代码来源:DiffusionQuery.php

示例4: nameCommit

 public static final function nameCommit(PhabricatorRepository $repository, $commit)
 {
     switch ($repository->getVersionControlSystem()) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
         case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
             $commit_name = substr($commit, 0, 12);
             break;
         default:
             $commit_name = $commit;
             break;
     }
     $callsign = $repository->getCallsign();
     return "r{$callsign}{$commit_name}";
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:14,代码来源:DiffusionView.php

示例5: createMenuItem

 /**
  * returns PhabricatorActionView or an array of PhabricatorActionView or null.
  */
 public function createMenuItem(PhabricatorUser $viewer, DifferentialRevision $revision, PhabricatorRepository $repository)
 {
     $vcs = $repository->getVersionControlSystem();
     if ($vcs !== PhabricatorRepositoryType::REPOSITORY_TYPE_GIT) {
         return;
     }
     if ($repository->isHosted()) {
         return;
     }
     try {
         // These throw when failing.
         $this->init($viewer, $repository);
         $this->findGitHubRepo($repository);
     } catch (Exception $e) {
         return;
     }
     return $this->createActionView($revision, pht('Land to GitHub'))->setIcon('fa-cloud-upload');
 }
开发者ID:denghp,项目名称:phabricator,代码行数:21,代码来源:DifferentialLandingToGitHub.php

示例6: parseCommit

 private function parseCommit(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
 {
     switch ($repository->getVersionControlSystem()) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
             $parser = 'PhabricatorRepositoryGitCommitChangeParserWorker';
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
             $parser = 'PhabricatorRepositoryMercurialCommitChangeParserWorker';
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
             $parser = 'PhabricatorRepositorySvnCommitChangeParserWorker';
             break;
         default:
             throw new Exception(pht('No support yet.'));
     }
     $parser_object = newv($parser, array(array()));
     return $parser_object->parseChangesForUnitTest($repository, $commit);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:18,代码来源:PhabricatorChangeParserTestCase.php

示例7: createMenuItem

 public function createMenuItem(PhabricatorUser $viewer, DifferentialRevision $revision, PhabricatorRepository $repository)
 {
     $vcs = $repository->getVersionControlSystem();
     if ($vcs !== PhabricatorRepositoryType::REPOSITORY_TYPE_GIT) {
         return;
     }
     if (!$repository->isHosted()) {
         return;
     }
     if (!$repository->isWorkingCopyBare()) {
         return;
     }
     // TODO: This temporarily disables this action, because it doesn't work
     // and is confusing to users. If you want to use it, comment out this line
     // for now and we'll provide real support eventually.
     return;
     return $this->createActionView($revision, pht('Land to Hosted Repository'));
 }
开发者ID:pugong,项目名称:phabricator,代码行数:18,代码来源:DifferentialHostedGitLandingStrategy.php

示例8: handleProtocols

 public function handleProtocols(PhabricatorRepository $repository)
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $type = $repository->getVersionControlSystem();
     $is_svn = $type == PhabricatorRepositoryType::REPOSITORY_TYPE_SVN;
     $v_http_mode = $repository->getDetail('serve-over-http', PhabricatorRepository::SERVE_OFF);
     $v_ssh_mode = $repository->getDetail('serve-over-ssh', PhabricatorRepository::SERVE_OFF);
     $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
     $prev_uri = $this->getRepositoryControllerURI($repository, 'edit/hosting/');
     if ($request->isFormPost()) {
         $v_http_mode = $request->getStr('http');
         $v_ssh_mode = $request->getStr('ssh');
         $xactions = array();
         $template = id(new PhabricatorRepositoryTransaction());
         $type_http = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_HTTP;
         $type_ssh = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_SSH;
         if (!$is_svn) {
             $xactions[] = id(clone $template)->setTransactionType($type_http)->setNewValue($v_http_mode);
         }
         $xactions[] = id(clone $template)->setTransactionType($type_ssh)->setNewValue($v_ssh_mode);
         id(new PhabricatorRepositoryEditor())->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->setActor($user)->applyTransactions($repository, $xactions);
         return id(new AphrontRedirectResponse())->setURI($edit_uri);
     }
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Edit Protocols'));
     $title = pht('Edit Protocols (%s)', $repository->getName());
     $rw_message = pht('Phabricator will serve a read-write copy of this repository.');
     if (!$repository->isHosted()) {
         $rw_message = array($rw_message, phutil_tag('br'), phutil_tag('br'), pht('%s: This repository is hosted elsewhere, so Phabricator can not ' . 'perform writes. This mode will act like "Read Only" for ' . 'repositories hosted elsewhere.', phutil_tag('strong', array(), 'WARNING')));
     }
     $ssh_control = id(new AphrontFormRadioButtonControl())->setName('ssh')->setLabel(pht('SSH'))->setValue($v_ssh_mode)->addButton(PhabricatorRepository::SERVE_OFF, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_OFF), pht('Phabricator will not serve this repository over SSH.'))->addButton(PhabricatorRepository::SERVE_READONLY, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_READONLY), pht('Phabricator will serve a read-only copy of this repository ' . 'over SSH.'))->addButton(PhabricatorRepository::SERVE_READWRITE, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_READWRITE), $rw_message);
     $http_control = id(new AphrontFormRadioButtonControl())->setName('http')->setLabel(pht('HTTP'))->setValue($v_http_mode)->addButton(PhabricatorRepository::SERVE_OFF, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_OFF), pht('Phabricator will not serve this repository over HTTP.'))->addButton(PhabricatorRepository::SERVE_READONLY, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_READONLY), pht('Phabricator will serve a read-only copy of this repository ' . 'over HTTP.'))->addButton(PhabricatorRepository::SERVE_READWRITE, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_READWRITE), $rw_message);
     if ($is_svn) {
         $http_control = id(new AphrontFormMarkupControl())->setLabel(pht('HTTP'))->setValue(phutil_tag('em', array(), pht('Phabricator does not currently support HTTP access to ' . 'Subversion repositories.')));
     }
     $form = id(new AphrontFormView())->setUser($user)->appendRemarkupInstructions(pht('Phabricator can serve repositories over various protocols. You can ' . 'configure server protocols here.'))->appendChild($ssh_control);
     if (!PhabricatorEnv::getEnvConfig('diffusion.allow-http-auth')) {
         $form->appendRemarkupInstructions(pht('NOTE: The configuration setting [[ %s | %s ]] is currently ' . 'disabled. You must enable it to activate authenticated access ' . 'to repositories over HTTP.', '/config/edit/diffusion.allow-http-auth/', 'diffusion.allow-http-auth'));
     }
     $form->appendChild($http_control)->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save Changes'))->addCancelButton($prev_uri, pht('Back')));
     $object_box = id(new PHUIObjectBoxView())->setHeaderText($title)->setForm($form);
     return $this->buildApplicationPage(array($crumbs, $object_box), array('title' => $title));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:44,代码来源:DiffusionRepositoryEditHostingController.php

示例9: createMenuItem

 /**
  * Returns PhabricatorActionView or an array of PhabricatorActionView or null.
  */
 public function createMenuItem(PhabricatorUser $viewer, DifferentialRevision $revision, PhabricatorRepository $repository)
 {
     // TODO: This temporarily disables this action, because it doesn't work
     // and is confusing to users. If you want to use it, comment out this line
     // for now and we'll provide real support eventually.
     return;
     $vcs = $repository->getVersionControlSystem();
     if ($vcs !== PhabricatorRepositoryType::REPOSITORY_TYPE_GIT) {
         return;
     }
     if ($repository->isHosted()) {
         return;
     }
     try {
         // These throw when failing.
         $this->init($viewer, $repository);
         $this->findGitHubRepo($repository);
     } catch (Exception $e) {
         return;
     }
     return $this->createActionView($revision, pht('Land to GitHub'))->setIcon('fa-cloud-upload');
 }
开发者ID:pugong,项目名称:phabricator,代码行数:25,代码来源:DifferentialGitHubLandingStrategy.php

示例10: buildRepositoryStatus

 private function buildRepositoryStatus(PhabricatorRepository $repository)
 {
     $viewer = $this->getRequest()->getUser();
     $is_cluster = $repository->getAlmanacServicePHID();
     $view = new PHUIStatusListView();
     $messages = id(new PhabricatorRepositoryStatusMessage())->loadAllWhere('repositoryID = %d', $repository->getID());
     $messages = mpull($messages, null, 'getStatusType');
     if ($repository->isTracked()) {
         $view->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green')->setTarget(pht('Repository Active')));
     } else {
         $view->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_WARNING, 'bluegrey')->setTarget(pht('Repository Inactive'))->setNote(pht('Activate this repository to begin or resume import.')));
         return $view;
     }
     $binaries = array();
     $svnlook_check = false;
     switch ($repository->getVersionControlSystem()) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
             $binaries[] = 'git';
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
             $binaries[] = 'svn';
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
             $binaries[] = 'hg';
             break;
     }
     if ($repository->isHosted()) {
         if ($repository->getServeOverHTTP() != PhabricatorRepository::SERVE_OFF) {
             switch ($repository->getVersionControlSystem()) {
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
                     $binaries[] = 'git-http-backend';
                     break;
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
                     $binaries[] = 'svnserve';
                     $binaries[] = 'svnadmin';
                     $binaries[] = 'svnlook';
                     $svnlook_check = true;
                     break;
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
                     $binaries[] = 'hg';
                     break;
             }
         }
         if ($repository->getServeOverSSH() != PhabricatorRepository::SERVE_OFF) {
             switch ($repository->getVersionControlSystem()) {
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
                     $binaries[] = 'git-receive-pack';
                     $binaries[] = 'git-upload-pack';
                     break;
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
                     $binaries[] = 'svnserve';
                     $binaries[] = 'svnadmin';
                     $binaries[] = 'svnlook';
                     $svnlook_check = true;
                     break;
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
                     $binaries[] = 'hg';
                     break;
             }
         }
     }
     $binaries = array_unique($binaries);
     if (!$is_cluster) {
         // We're only checking for binaries if we aren't running with a cluster
         // configuration. In theory, we could check for binaries on the
         // repository host machine, but we'd need to make this more complicated
         // to do that.
         foreach ($binaries as $binary) {
             $where = Filesystem::resolveBinary($binary);
             if (!$where) {
                 $view->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_WARNING, 'red')->setTarget(pht('Missing Binary %s', phutil_tag('tt', array(), $binary)))->setNote(pht("Unable to find this binary in the webserver's PATH. You may " . "need to configure %s.", $this->getEnvConfigLink())));
             } else {
                 $view->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green')->setTarget(pht('Found Binary %s', phutil_tag('tt', array(), $binary)))->setNote(phutil_tag('tt', array(), $where)));
             }
         }
         // This gets checked generically above. However, for svn commit hooks, we
         // need this to be in environment.append-paths because subversion strips
         // PATH.
         if ($svnlook_check) {
             $where = Filesystem::resolveBinary('svnlook');
             if ($where) {
                 $path = substr($where, 0, strlen($where) - strlen('svnlook'));
                 $dirs = PhabricatorEnv::getEnvConfig('environment.append-paths');
                 $in_path = false;
                 foreach ($dirs as $dir) {
                     if (Filesystem::isDescendant($path, $dir)) {
                         $in_path = true;
                         break;
                     }
                 }
                 if (!$in_path) {
                     $view->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_WARNING, 'red')->setTarget(pht('Missing Binary %s', phutil_tag('tt', array(), $binary)))->setNote(pht('Unable to find this binary in `%s`. ' . 'You need to configure %s and include %s.', 'environment.append-paths', $this->getEnvConfigLink(), $path)));
                 }
             }
         }
     }
     $doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd');
     $daemon_instructions = pht('Use %s to start daemons. See %s.', phutil_tag('tt', array(), 'bin/phd start'), phutil_tag('a', array('href' => $doc_href), pht('Managing Daemons with phd')));
     $pull_daemon = id(new PhabricatorDaemonLogQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE)->withDaemonClasses(array('PhabricatorRepositoryPullLocalDaemon'))->setLimit(1)->execute();
     if ($pull_daemon) {
//.........这里部分代码省略.........
开发者ID:patelhardik,项目名称:phabricator,代码行数:101,代码来源:DiffusionRepositoryEditMainController.php

示例11: buildPropertiesTable

 private function buildPropertiesTable(PhabricatorRepository $repository)
 {
     $properties = array();
     $properties['Name'] = $repository->getName();
     $properties['Callsign'] = $repository->getCallsign();
     $properties['Description'] = $repository->getDetail('description');
     switch ($repository->getVersionControlSystem()) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
         case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
             $properties['Clone URI'] = $repository->getPublicRemoteURI();
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
             $properties['Repository Root'] = $repository->getPublicRemoteURI();
             break;
     }
     $rows = array();
     foreach ($properties as $key => $value) {
         $rows[] = array(phutil_escape_html($key), phutil_escape_html($value));
     }
     $table = new AphrontTableView($rows);
     $table->setColumnClasses(array('header', 'wide'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Repository Properties');
     $panel->appendChild($table);
     return $panel;
 }
开发者ID:relrod,项目名称:phabricator,代码行数:26,代码来源:DiffusionRepositoryController.php

示例12: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $shortcuts = id(new PhabricatorRepositoryShortcut())->loadAll();
     if ($shortcuts) {
         $shortcuts = msort($shortcuts, 'getSequence');
         $rows = array();
         foreach ($shortcuts as $shortcut) {
             $rows[] = array(phutil_render_tag('a', array('href' => $shortcut->getHref()), phutil_escape_html($shortcut->getName())), phutil_escape_html($shortcut->getDescription()));
         }
         $shortcut_table = new AphrontTableView($rows);
         $shortcut_table->setHeaders(array('Link', ''));
         $shortcut_table->setColumnClasses(array('pri', 'wide'));
         $shortcut_panel = new AphrontPanelView();
         $shortcut_panel->setHeader('Shortcuts');
         $shortcut_panel->appendChild($shortcut_table);
     } else {
         $shortcut_panel = null;
     }
     $repository = new PhabricatorRepository();
     $repositories = $repository->loadAll();
     foreach ($repositories as $key => $repo) {
         if (!$repo->isTracked()) {
             unset($repositories[$key]);
         }
     }
     $repository_ids = mpull($repositories, 'getID');
     $summaries = array();
     $commits = array();
     if ($repository_ids) {
         $summaries = queryfx_all($repository->establishConnection('r'), 'SELECT * FROM %T WHERE repositoryID IN (%Ld)', PhabricatorRepository::TABLE_SUMMARY, $repository_ids);
         $summaries = ipull($summaries, null, 'repositoryID');
         $commit_ids = array_filter(ipull($summaries, 'lastCommitID'));
         if ($commit_ids) {
             $commit = new PhabricatorRepositoryCommit();
             $commits = $commit->loadAllWhere('id IN (%Ld)', $commit_ids);
             $commits = mpull($commits, null, 'getRepositoryID');
         }
     }
     $rows = array();
     foreach ($repositories as $repository) {
         $id = $repository->getID();
         $commit = idx($commits, $id);
         $size = idx(idx($summaries, $id, array()), 'size', 0);
         $date = '-';
         $time = '-';
         if ($commit) {
             $date = phabricator_date($commit->getEpoch(), $user);
             $time = phabricator_time($commit->getEpoch(), $user);
         }
         $rows[] = array(phutil_render_tag('a', array('href' => '/diffusion/' . $repository->getCallsign() . '/'), phutil_escape_html($repository->getName())), phutil_escape_html($repository->getDetail('description')), PhabricatorRepositoryType::getNameForRepositoryType($repository->getVersionControlSystem()), $size ? number_format($size) : '-', $commit ? DiffusionView::linkCommit($repository, $commit->getCommitIdentifier()) : '-', $date, $time);
     }
     $repository_tool_uri = PhabricatorEnv::getProductionURI('/repository/');
     $repository_tool = phutil_render_tag('a', array('href' => $repository_tool_uri), 'repository tool');
     $no_repositories_txt = 'This instance of Phabricator does not have any ' . 'configured repositories. ';
     if ($user->getIsAdmin()) {
         $no_repositories_txt .= 'To setup one or more repositories, visit the ' . $repository_tool . '.';
     } else {
         $no_repositories_txt .= 'Ask an administrator to setup one or more ' . 'repositories via the ' . $repository_tool . '.';
     }
     $table = new AphrontTableView($rows);
     $table->setNoDataString($no_repositories_txt);
     $table->setHeaders(array('Repository', 'Description', 'VCS', 'Commits', 'Last', 'Date', 'Time'));
     $table->setColumnClasses(array('pri', 'wide', '', 'n', 'n', '', 'right'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Browse Repositories');
     $panel->appendChild($table);
     $crumbs = $this->buildCrumbs();
     return $this->buildStandardPageResponse(array($crumbs, $shortcut_panel, $panel), array('title' => 'Diffusion'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:71,代码来源:DiffusionHomeController.php

示例13: isCommitOnBranch

 private function isCommitOnBranch(PhabricatorRepository $repo, PhabricatorRepositoryCommit $commit, ReleephBranch $releeph_branch)
 {
     switch ($repo->getVersionControlSystem()) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
             list($output) = $repo->execxLocalCommand('branch --all --no-color --contains %s', $commit->getCommitIdentifier());
             $remote_prefix = 'remotes/origin/';
             $branches = array();
             foreach (array_filter(explode("\n", $output)) as $line) {
                 $tokens = explode(' ', $line);
                 $ref = last($tokens);
                 if (strncmp($ref, $remote_prefix, strlen($remote_prefix)) === 0) {
                     $branch = substr($ref, strlen($remote_prefix));
                     $branches[$branch] = $branch;
                 }
             }
             return idx($branches, $releeph_branch->getName());
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
             $change_query = DiffusionPathChangeQuery::newFromDiffusionRequest(DiffusionRequest::newFromDictionary(array('user' => $this->getUser(), 'repository' => $repo, 'commit' => $commit->getCommitIdentifier())));
             $path_changes = $change_query->loadChanges();
             $commit_paths = mpull($path_changes, 'getPath');
             $branch_path = $releeph_branch->getName();
             $in_branch = array();
             $ex_branch = array();
             foreach ($commit_paths as $path) {
                 if (strncmp($path, $branch_path, strlen($branch_path)) === 0) {
                     $in_branch[] = $path;
                 } else {
                     $ex_branch[] = $path;
                 }
             }
             if ($in_branch && $ex_branch) {
                 $error = pht('CONFUSION: commit %s in %s contains %d path change(s) that were ' . 'part of a Releeph branch, but also has %d path change(s) not ' . 'part of a Releeph branch!', $commit->getCommitIdentifier(), $repo->getCallsign(), count($in_branch), count($ex_branch));
                 phlog($error);
             }
             return !empty($in_branch);
             break;
     }
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:39,代码来源:DifferentialReleephRequestFieldSpecification.php

示例14: insertTask

 private function insertTask(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit, $data = array())
 {
     $vcs = $repository->getVersionControlSystem();
     switch ($vcs) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
             $class = 'PhabricatorRepositoryGitCommitMessageParserWorker';
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
             $class = 'PhabricatorRepositorySvnCommitMessageParserWorker';
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
             $class = 'PhabricatorRepositoryMercurialCommitMessageParserWorker';
             break;
         default:
             throw new Exception("Unknown repository type '{$vcs}'!");
     }
     $task = new PhabricatorWorkerTask();
     $task->setTaskClass($class);
     $data['commitID'] = $commit->getID();
     $task->setData($data);
     $task->save();
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:22,代码来源:PhabricatorRepositoryPullLocalDaemon.php

示例15: getAbsoluteRepositoryPath

 public function getAbsoluteRepositoryPath(PhabricatorRepository $repository, DifferentialDiff $diff = null)
 {
     $base = '/';
     if ($diff && $diff->getSourceControlPath()) {
         $base = id(new PhutilURI($diff->getSourceControlPath()))->getPath();
     }
     $path = $this->getFilename();
     $path = rtrim($base, '/') . '/' . ltrim($path, '/');
     $vcs = $repository->getVersionControlSystem();
     if ($vcs == PhabricatorRepositoryType::REPOSITORY_TYPE_SVN) {
         $prefix = $repository->getDetail('remote-uri');
         $prefix = id(new PhutilURI($prefix))->getPath();
         if (!strncmp($path, $prefix, strlen($prefix))) {
             $path = substr($path, strlen($prefix));
         }
         $path = '/' . ltrim($path, '/');
     }
     return $path;
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:19,代码来源:DifferentialChangeset.php


注:本文中的PhabricatorRepository::getVersionControlSystem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。