Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistDiffWorkflow.php
Show First 20 Lines • Show All 386 Lines • ▼ Show 20 Lines | $arguments = array( | ||||
), | ), | ||||
), | ), | ||||
'no-coverage' => array( | 'no-coverage' => array( | ||||
'help' => 'Always disable coverage information.', | 'help' => 'Always disable coverage information.', | ||||
'passthru' => array( | 'passthru' => array( | ||||
'unit' => true, | 'unit' => true, | ||||
), | ), | ||||
), | ), | ||||
'browse' => array( | |||||
'help' => pht( | |||||
'After creating a diff or revision, open it in a web browser.'), | |||||
), | |||||
'*' => 'paths', | '*' => 'paths', | ||||
'head' => array( | 'head' => array( | ||||
'param' => 'commit', | 'param' => 'commit', | ||||
'help' => pht( | 'help' => pht( | ||||
'Specify the end of the commit range. This disables many '. | 'Specify the end of the commit range. This disables many '. | ||||
'Arcanist/Phabricator features which depend on having access to '. | 'Arcanist/Phabricator features which depend on having access to '. | ||||
'the working copy.'), | 'the working copy.'), | ||||
'supports' => array('git'), | 'supports' => array('git'), | ||||
▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | if ($this->shouldOnlyCreateDiff()) { | ||||
$human = ob_get_clean(); | $human = ob_get_clean(); | ||||
echo json_encode(array( | echo json_encode(array( | ||||
'diffURI' => $diff_info['uri'], | 'diffURI' => $diff_info['uri'], | ||||
'diffID' => $this->getDiffID(), | 'diffID' => $this->getDiffID(), | ||||
'human' => $human, | 'human' => $human, | ||||
))."\n"; | ))."\n"; | ||||
ob_start(); | ob_start(); | ||||
} | } | ||||
if ($this->shouldOpenCreatedObjectsInBrowser()) { | |||||
$this->openURIsInBrowser(array($diff_info['uri'])); | |||||
} | |||||
} else { | } else { | ||||
$revision['diffid'] = $this->getDiffID(); | $revision['diffid'] = $this->getDiffID(); | ||||
if ($commit_message->getRevisionID()) { | if ($commit_message->getRevisionID()) { | ||||
$result = $conduit->callMethodSynchronous( | $result = $conduit->callMethodSynchronous( | ||||
'differential.updaterevision', | 'differential.updaterevision', | ||||
$revision); | $revision); | ||||
Show All 40 Lines | if ($this->shouldOnlyCreateDiff()) { | ||||
$conduit->callMethodSynchronous( | $conduit->callMethodSynchronous( | ||||
'differential.createcomment', | 'differential.createcomment', | ||||
array( | array( | ||||
'revision_id' => $result['revisionid'], | 'revision_id' => $result['revisionid'], | ||||
'action' => 'rethink', | 'action' => 'rethink', | ||||
)); | )); | ||||
echo "Planned changes to the revision.\n"; | echo "Planned changes to the revision.\n"; | ||||
} | } | ||||
if ($this->shouldOpenCreatedObjectsInBrowser()) { | |||||
$this->openURIsInBrowser(array($uri)); | |||||
} | |||||
} | } | ||||
echo "Included changes:\n"; | echo "Included changes:\n"; | ||||
foreach ($changes as $change) { | foreach ($changes as $change) { | ||||
echo ' '.$change->renderTextSummary()."\n"; | echo ' '.$change->renderTextSummary()."\n"; | ||||
} | } | ||||
if ($output_json) { | if ($output_json) { | ||||
▲ Show 20 Lines • Show All 1,981 Lines • ▼ Show 20 Lines | /* -( File Uploads )------------------------------------------------------- */ | ||||
} | } | ||||
private function getFileMimeType($data) { | private function getFileMimeType($data) { | ||||
$tmp = new TempFile(); | $tmp = new TempFile(); | ||||
Filesystem::writeFile($tmp, $data); | Filesystem::writeFile($tmp, $data); | ||||
return Filesystem::getMimeType($tmp); | return Filesystem::getMimeType($tmp); | ||||
} | } | ||||
private function shouldOpenCreatedObjectsInBrowser() { | |||||
return $this->getArgument('browse'); | |||||
} | |||||
} | } |