コード例 #1
0
 private function buildDependencyGraph(ArcanistBundle $bundle)
 {
     $graph = null;
     if ($this->getRepositoryAPI() instanceof ArcanistSubversionAPI) {
         return $graph;
     }
     $revision_id = $bundle->getRevisionID();
     if ($revision_id) {
         $revisions = $this->getConduit()->callMethodSynchronous('differential.query', array('ids' => array($revision_id)));
         if ($revisions) {
             $revision = head($revisions);
             $rev_auxiliary = idx($revision, 'auxiliary', array());
             $phids = idx($rev_auxiliary, 'phabricator:depends-on', array());
             if ($phids) {
                 $revision_phid = $revision['phid'];
                 $graph = id(new ArcanistDifferentialDependencyGraph())->setConduit($this->getConduit())->setRepositoryAPI($this->getRepositoryAPI())->setStartPHID($revision_phid)->addNodes(array($revision_phid => $phids))->loadGraph();
             }
         }
     }
     return $graph;
 }
コード例 #2
0
 private function getCommitMessage(ArcanistBundle $bundle)
 {
     $revision_id = $bundle->getRevisionID();
     $commit_message = null;
     $prompt_message = null;
     // if we have a revision id the commit message is in differential
     // TODO: See T848 for the authenticated stuff.
     if ($revision_id && $this->isConduitAuthenticated()) {
         $conduit = $this->getConduit();
         $commit_message = $conduit->callMethodSynchronous('differential.getcommitmessage', array('revision_id' => $revision_id));
         $prompt_message = "  Note arcanist failed to load the commit message " . "from differential for revision D{$revision_id}.";
     }
     // no revision id or failed to fetch commit message so get it from the
     // user on the command line
     if (!$commit_message) {
         $template = "\n\n" . "# Enter a commit message for this patch.  If you just want to apply " . "the patch to the working copy without committing, re-run arc patch " . "with the --nocommit flag." . $prompt_message . "\n";
         $commit_message = $this->newInteractiveEditor($template)->setName('arcanist-patch-commit-message')->editInteractively();
         $commit_message = ArcanistCommentRemover::removeComments($commit_message);
         if (!strlen(trim($commit_message))) {
             throw new ArcanistUserAbortException();
         }
     }
     return $commit_message;
 }