public function doHook(ArcanistWorkflow $workflow) { $diffObj = $this->getDiffObj($workflow); $revisionID = HookUtils::getStringValueFromObj(self::PH_REVISIONID, $diffObj); $topicBranch = HookUtils::getStringValueFromObj(self::PH_BRANCH, $diffObj); if (!$topicBranch) { $topicBranch = "HEAD:refs/heads/"; } else { $topicBranch = "{$topicBranch}:"; } $revisionDict = $this->getRevisionObj($workflow, $revisionID); if ($revisionDict) { if ($revisionID && $topicBranch) { $remoteBranchName = HookUtils::createRemoteBranchName($revisionID, $topicBranch); if (HookUtils::shouldSkipCi($revisionDict)) { $this->writeOut(pht("Saw skip ci message in commit, skipping push of remote branch %s\n", $remoteBranchName)); } else { // this is where the magic happens $this->pushBranchToRemote($topicBranch, $remoteBranchName); } } else { $this->writeErr("Could not determine branch name to push to GitHub"); } } }
public function doHook(ArcanistWorkflow $workflow) { $dict = $workflow->getRevisionDict(); if ($dict) { // Here we actually have a differential object, aka a revision. $revisionId = HookUtils::getStringValueFromObj(self::PH_ID, $dict); $topicBranch = HookUtils::getStringValueFromObj(self::PH_BRANCH, $dict); if ($revisionId && $topicBranch) { $remoteBranchName = HookUtils::createRemoteBranchName($revisionId, $topicBranch); if (HookUtils::shouldSkipCi($dict)) { $this->writeOut(pht("Saw skip ci message in commit, skipping delete of remote branch %s\n", $remoteBranchName)); } else { // Here is the majicks: $this->deleteRemoteBranch($remoteBranchName); } } } }
public function doHook(ArcanistWorkflow $workflow) { $diffObj = $this->getDiffObj($workflow); $revisionID = HookUtils::getStringValueFromObj(self::PH_REVISIONID, $diffObj); $topicBranch = HookUtils::getStringValueFromObj(self::PH_BRANCH, $diffObj); if (!$topicBranch) { $topicBranch = "HEAD:refs/heads/"; } else { $topicBranch = "{$topicBranch}:"; } $revisionDict = $this->getRevisionObj($workflow, $revisionID); if ($revisionDict) { if ($revisionID && $topicBranch) { $remoteBranchName = HookUtils::createRemoteBranchName($revisionID, $topicBranch); $this->pushBranchToRemote($topicBranch, $remoteBranchName); } else { $this->writeErr("Could not determine branch name to push to GitHub"); } } }