Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistDiffWorkflow.php
Show First 20 Lines • Show All 503 Lines • ▼ Show 20 Lines | if ($this->shouldOnlyCreateDiff()) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Expected a revision ID to be returned by '. | 'Expected a revision ID to be returned by '. | ||||
'"differential.revision.edit".')); | '"differential.revision.edit".')); | ||||
} | } | ||||
// TODO: This is hacky, but we don't currently receive a URI back | // TODO: This is hacky, but we don't currently receive a URI back | ||||
// from "differential.revision.edit". | // from "differential.revision.edit". | ||||
$result_uri = id(new PhutilURI($this->getConduitURI())) | $result_uri = (new PhutilURI($this->getConduitURI())) | ||||
->setPath('/D'.$result_id); | ->setPath('/D'.$result_id); | ||||
} else { | } else { | ||||
if ($is_draft) { | if ($is_draft) { | ||||
throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
pht( | pht( | ||||
'You have specified "--draft", but the software version '. | 'You have specified "--draft", but the software version '. | ||||
'on the server is too old to support draft revisions. Omit '. | 'on the server is too old to support draft revisions. Omit '. | ||||
'the flag or upgrade the server software.')); | 'the flag or upgrade the server software.')); | ||||
▲ Show 20 Lines • Show All 557 Lines • ▼ Show 20 Lines | protected function primeSubversionWorkingCopyData($paths) { | ||||
$targets = array(); | $targets = array(); | ||||
foreach ($paths as $path => $mask) { | foreach ($paths as $path => $mask) { | ||||
$futures[] = $repository_api->buildDiffFuture($path); | $futures[] = $repository_api->buildDiffFuture($path); | ||||
$targets[] = array('command' => 'diff', 'path' => $path); | $targets[] = array('command' => 'diff', 'path' => $path); | ||||
$futures[] = $repository_api->buildInfoFuture($path); | $futures[] = $repository_api->buildInfoFuture($path); | ||||
$targets[] = array('command' => 'info', 'path' => $path); | $targets[] = array('command' => 'info', 'path' => $path); | ||||
} | } | ||||
$futures = id(new FutureIterator($futures)) | $futures = (new FutureIterator($futures)) | ||||
->limit(8); | ->limit(8); | ||||
foreach ($futures as $key => $future) { | foreach ($futures as $key => $future) { | ||||
$target = $targets[$key]; | $target = $targets[$key]; | ||||
if ($target['command'] == 'diff') { | if ($target['command'] == 'diff') { | ||||
$repository_api->primeSVNDiffResult( | $repository_api->primeSVNDiffResult( | ||||
$target['path'], | $target['path'], | ||||
$future->resolve()); | $future->resolve()); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 269 Lines • ▼ Show 20 Lines | private function getCommitMessageFromUser() { | ||||
if (!$this->getArgument('verbatim')) { | if (!$this->getArgument('verbatim')) { | ||||
$saved = $this->readScratchFile('create-message'); | $saved = $this->readScratchFile('create-message'); | ||||
if ($saved) { | if ($saved) { | ||||
$where = $this->getReadableScratchFilePath('create-message'); | $where = $this->getReadableScratchFilePath('create-message'); | ||||
$preview = explode("\n", $saved); | $preview = explode("\n", $saved); | ||||
$preview = array_shift($preview); | $preview = array_shift($preview); | ||||
$preview = trim($preview); | $preview = trim($preview); | ||||
$preview = id(new PhutilUTF8StringTruncator()) | $preview = (new PhutilUTF8StringTruncator()) | ||||
->setMaximumGlyphs(64) | ->setMaximumGlyphs(64) | ||||
->truncateString($preview); | ->truncateString($preview); | ||||
if ($preview) { | if ($preview) { | ||||
$preview = pht('Message begins:')."\n\n {$preview}\n\n"; | $preview = pht('Message begins:')."\n\n {$preview}\n\n"; | ||||
} else { | } else { | ||||
$preview = null; | $preview = null; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 302 Lines • ▼ Show 20 Lines | foreach (new FutureIterator($futures) as $key => $future) { | ||||
} else { | } else { | ||||
$message = pht('Some reviewers are currently away:'); | $message = pht('Some reviewers are currently away:'); | ||||
} | } | ||||
echo tsprintf( | echo tsprintf( | ||||
"%s\n\n", | "%s\n\n", | ||||
$message); | $message); | ||||
$list = id(new PhutilConsoleList()); | $list = (new PhutilConsoleList()); | ||||
foreach ($away as $spec) { | foreach ($away as $spec) { | ||||
$list->addItem( | $list->addItem( | ||||
pht( | pht( | ||||
'%s (until %s)', | '%s (until %s)', | ||||
$spec['name'], | $spec['name'], | ||||
date('l, M j Y', $spec['until']))); | date('l, M j Y', $spec['until']))); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 713 Lines • ▼ Show 20 Lines | /* -( Diff Properties )---------------------------------------------------- */ | ||||
/** | /** | ||||
* Wait for finishing all diff property updates. | * Wait for finishing all diff property updates. | ||||
* | * | ||||
* @return void | * @return void | ||||
* | * | ||||
* @task diffprop | * @task diffprop | ||||
*/ | */ | ||||
private function resolveDiffPropertyUpdates() { | private function resolveDiffPropertyUpdates() { | ||||
id(new FutureIterator($this->diffPropertyFutures)) | (new FutureIterator($this->diffPropertyFutures)) | ||||
->resolveAll(); | ->resolveAll(); | ||||
$this->diffPropertyFutures = array(); | $this->diffPropertyFutures = array(); | ||||
} | } | ||||
private function dispatchWillCreateRevisionEvent(array $fields) { | private function dispatchWillCreateRevisionEvent(array $fields) { | ||||
$event = $this->dispatchEvent( | $event = $this->dispatchEvent( | ||||
ArcanistEventType::TYPE_REVISION_WILLCREATEREVISION, | ArcanistEventType::TYPE_REVISION_WILLCREATEREVISION, | ||||
array( | array( | ||||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | foreach ($need_upload as $key => $spec) { | ||||
$mime = $this->getFileMimeType($spec['data']); | $mime = $this->getFileMimeType($spec['data']); | ||||
if (preg_match('@^image/@', $mime)) { | if (preg_match('@^image/@', $mime)) { | ||||
$change->setFileType($type_image); | $change->setFileType($type_image); | ||||
} | } | ||||
$change->setMetadata("{$type}:file:mime-type", $mime); | $change->setMetadata("{$type}:file:mime-type", $mime); | ||||
} | } | ||||
$uploader = id(new ArcanistFileUploader()) | $uploader = (new ArcanistFileUploader()) | ||||
->setConduitEngine($this->getConduitEngine()); | ->setConduitEngine($this->getConduitEngine()); | ||||
foreach ($need_upload as $key => $spec) { | foreach ($need_upload as $key => $spec) { | ||||
$ref = id(new ArcanistFileDataRef()) | $ref = (new ArcanistFileDataRef()) | ||||
->setName($spec['name']) | ->setName($spec['name']) | ||||
->setData($spec['data']); | ->setData($spec['data']); | ||||
$uploader->addFile($ref, $key); | $uploader->addFile($ref, $key); | ||||
} | } | ||||
$files = $uploader->uploadFiles(); | $files = $uploader->uploadFiles(); | ||||
▲ Show 20 Lines • Show All 306 Lines • ▼ Show 20 Lines | /* -( File Uploads )------------------------------------------------------- */ | ||||
private function getDependsOnRevisionRef() { | private function getDependsOnRevisionRef() { | ||||
// TODO: Restore this behavior after updating for toolsets. Loading the | // TODO: Restore this behavior after updating for toolsets. Loading the | ||||
// required hardpoints currently depends on a "WorkingCopy" existing. | // required hardpoints currently depends on a "WorkingCopy" existing. | ||||
return null; | return null; | ||||
$api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
$base_ref = $api->getBaseCommitRef(); | $base_ref = $api->getBaseCommitRef(); | ||||
$state_ref = id(new ArcanistWorkingCopyStateRef()) | $state_ref = (new ArcanistWorkingCopyStateRef()) | ||||
->setCommitRef($base_ref); | ->setCommitRef($base_ref); | ||||
$this->loadHardpoints( | $this->loadHardpoints( | ||||
$state_ref, | $state_ref, | ||||
ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS); | ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS); | ||||
$revision_refs = $state_ref->getRevisionRefs(); | $revision_refs = $state_ref->getRevisionRefs(); | ||||
$viewer_phid = $this->getUserPHID(); | $viewer_phid = $this->getUserPHID(); | ||||
Show All 27 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0