Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14008601
D9049.id21574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D9049.id21574.diff
View Options
diff --git a/src/applications/diffusion/conduit/ConduitAPI_diffusion_readmequery_Method.php b/src/applications/diffusion/conduit/ConduitAPI_diffusion_readmequery_Method.php
--- a/src/applications/diffusion/conduit/ConduitAPI_diffusion_readmequery_Method.php
+++ b/src/applications/diffusion/conduit/ConduitAPI_diffusion_readmequery_Method.php
@@ -85,19 +85,30 @@
require_celerity_resource('syntax-highlighting-css');
$class = 'remarkup-code';
} else {
- // Markup extensionless files as remarkup so we get links and such.
- $engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
- $engine->setConfig('viewer', $request->getUser());
- $readme_content = $engine->markupText($readme_content);
+ // TODO: This is sketchy, but make sure we hit the markup cache.
+ $markup_object = id(new PhabricatorMarkupOneOff())
+ ->setEngineRuleset('diffusion-readme')
+ ->setContent($readme_content);
+ $markup_field = 'default';
+
+ $readme_content = id(new PhabricatorMarkupEngine())
+ ->setViewer($request->getUser())
+ ->addObject($markup_object, $markup_field)
+ ->process()
+ ->getOutput($markup_object, $markup_field);
+
+ $engine = $markup_object->newMarkupEngine($markup_field);
$toc = PhutilRemarkupEngineRemarkupHeaderBlockRule::renderTableOfContents(
$engine);
if ($toc) {
- $toc = phutil_tag_div('phabricator-remarkup-toc', array(
- phutil_tag_div(
- 'phabricator-remarkup-toc-header',
- pht('Table of Contents')),
- $toc,
- ));
+ $toc = phutil_tag_div(
+ 'phabricator-remarkup-toc',
+ array(
+ phutil_tag_div(
+ 'phabricator-remarkup-toc-header',
+ pht('Table of Contents')),
+ $toc,
+ ));
$readme_content = array($toc, $readme_content);
}
diff --git a/src/applications/repository/graphcache/PhabricatorRepositoryGraphCache.php b/src/applications/repository/graphcache/PhabricatorRepositoryGraphCache.php
--- a/src/applications/repository/graphcache/PhabricatorRepositoryGraphCache.php
+++ b/src/applications/repository/graphcache/PhabricatorRepositoryGraphCache.php
@@ -355,10 +355,17 @@
// Build the actual data for the cache.
foreach ($commit_ids as $commit_id) {
$parent_ids = array();
- if (isset($parents[$commit_id])) {
+ if (!empty($parents[$commit_id])) {
foreach ($parents[$commit_id] as $row) {
$parent_ids[] = (int)$row['parentCommitID'];
}
+ } else {
+ // We expect all rows to have parents (commits with no parents get
+ // an explicit "0" placeholder). If we're in an older repository, the
+ // parent information might not have been populated yet. Decline to fill
+ // the cache if we don't have the parent information, since the fill
+ // will be incorrect.
+ continue;
}
if (isset($path_changes[$commit_id])) {
diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php
--- a/src/infrastructure/markup/PhabricatorMarkupEngine.php
+++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php
@@ -374,6 +374,11 @@
$engine = self::newMarkupEngine(array());
$engine->setConfig('preserve-linebreaks', false);
break;
+ case 'diffusion-readme':
+ $engine = self::newMarkupEngine(array());
+ $engine->setConfig('preserve-linebreaks', false);
+ $engine->setConfig('header.generate-toc', true);
+ break;
case 'diviner':
$engine = self::newMarkupEngine(array());
$engine->setConfig('preserve-linebreaks', false);
diff --git a/src/infrastructure/markup/PhabricatorMarkupOneOff.php b/src/infrastructure/markup/PhabricatorMarkupOneOff.php
--- a/src/infrastructure/markup/PhabricatorMarkupOneOff.php
+++ b/src/infrastructure/markup/PhabricatorMarkupOneOff.php
@@ -16,6 +16,16 @@
private $content;
private $preserveLinebreaks;
+ private $engineRuleset;
+
+ public function setEngineRuleset($engine_ruleset) {
+ $this->engineRuleset = $engine_ruleset;
+ return $this;
+ }
+
+ public function getEngineRuleset() {
+ return $this->engineRuleset;
+ }
public function setPreserveLinebreaks($preserve_linebreaks) {
$this->preserveLinebreaks = $preserve_linebreaks;
@@ -36,7 +46,9 @@
}
public function newMarkupEngine($field) {
- if ($this->preserveLinebreaks) {
+ if ($this->engineRuleset) {
+ return PhabricatorMarkupEngine::getEngine($this->engineRuleset);
+ } else if ($this->preserveLinebreaks) {
return PhabricatorMarkupEngine::getEngine();
} else {
return PhabricatorMarkupEngine::getEngine('nolinebreaks');
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 31, 2:03 AM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6723257
Default Alt Text
D9049.id21574.diff (4 KB)
Attached To
Mode
D9049: Make sure READMEs can hit the markup cache in Diffusion
Attached
Detach File
Event Timeline
Log In to Comment