Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14040346
D8453.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D8453.diff
View Options
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -896,6 +896,22 @@
return $phids;
}
+ protected function getMailAction(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+ $action = parent::getMailAction($object, $xactions);
+
+ $strongest = $this->getStrongestAction($object, $xactions);
+ switch ($strongest->getTransactionType()) {
+ case DifferentialTransaction::TYPE_UPDATE:
+ $count = new PhutilNumber($object->getLineCount());
+ $action = pht('%s, %s line(s)', $action, $count);
+ break;
+ }
+
+ return $action;
+ }
+
protected function getMailSubjectPrefix() {
return PhabricatorEnv::getEnvConfig('metamta.differential.subject-prefix');
}
diff --git a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php
--- a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php
+++ b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php
@@ -6,24 +6,34 @@
public function generate() {
$author = $this->loadPhabrictorUser();
$authorPHID = $author->getPHID();
+
$revision = DifferentialRevision::initializeNewRevision($author);
+ $revision->attachReviewerStatus(array());
+ $revision->attachActiveDiff(null);
+
+ // This could be a bit richer and more formal than it is.
$revision->setTitle($this->generateTitle());
$revision->setSummary($this->generateDescription());
$revision->setTestPlan($this->generateDescription());
- $revision->loadRelationships();
- $aux_fields = $this->loadAuxiliaryFields($author, $revision);
+
$diff = $this->generateDiff($author);
- // Add Diff
- $editor = new DifferentialRevisionEditor($revision);
- $editor->setActor($author);
- $editor->addDiff($diff, $this->generateDescription());
- $editor->setAuxiliaryFields($aux_fields);
- $editor->save();
- // TODO: After T2222, it would be nice to revisit this and expand the
- // functionality.
+ $xactions = array();
+
+ $xactions[] = id(new DifferentialTransaction())
+ ->setTransactionType(DifferentialTransaction::TYPE_UPDATE)
+ ->setNewValue($diff->getPHID());
+
+ $content_source = PhabricatorContentSource::newForSource(
+ PhabricatorContentSource::SOURCE_LIPSUM,
+ array());
- return $revision->save();
+ id(new DifferentialTransactionEditor())
+ ->setActor($author)
+ ->setContentSource($content_source)
+ ->applyTransactions($revision, $xactions);
+
+ return $revision;
}
public function getCCPHIDs() {
@@ -92,20 +102,4 @@
return implode($newcode2, "\n");
}
- private function loadAuxiliaryFields($user, DifferentialRevision $revision) {
- $aux_fields = DifferentialFieldSelector::newSelector()
- ->getFieldSpecifications();
- foreach ($aux_fields as $key => $aux_field) {
- $aux_field->setRevision($revision);
- if (!$aux_field->shouldAppearOnEdit()) {
- unset($aux_fields[$key]);
- } else {
- $aux_field->setUser($user);
- }
- }
- return DifferentialAuxiliaryField::loadFromStorage(
- $revision,
- $aux_fields);
- }
-
}
diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php
--- a/src/applications/differential/storage/DifferentialTransaction.php
+++ b/src/applications/differential/storage/DifferentialTransaction.php
@@ -105,7 +105,12 @@
case self::TYPE_INLINE:
return pht('Commented On');
case self::TYPE_UPDATE:
- return pht('Updated');
+ $old = $this->getOldValue();
+ if ($old === null) {
+ return pht('Request');
+ } else {
+ return pht('Updated');
+ }
case self::TYPE_ACTION:
$map = array(
DifferentialAction::ACTION_ACCEPT => pht('Accepted'),
diff --git a/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php b/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php
--- a/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php
+++ b/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php
@@ -6,7 +6,7 @@
protected function didConstruct() {
$this
->setName('generate')
- ->setExamples('**generate** __key__')
+ ->setExamples('**generate**')
->setSynopsis('Generate some lipsum.')
->setArguments(
array(
@@ -62,20 +62,16 @@
while (true) {
$type = $supported_types[array_rand($supported_types)];
$admin = $this->getViewer();
- try {
- $taskgen = newv($type, array());
- $object = $taskgen->generate();
- $handle = id(new PhabricatorHandleQuery())
- ->setViewer($admin)
- ->withPHIDs(array($object->getPHID()))
- ->executeOne();
- echo "Generated ".$handle->getTypeName().": ".
- $handle->getFullName()."\n";
- } catch (PhutilMissingSymbolException $ex) {
- throw new PhutilArgumentUsageException(
- "Cannot generate content of type ".$type.
- " because the class does not exist.");
- }
+
+ $taskgen = newv($type, array());
+ $object = $taskgen->generate();
+ $handle = id(new PhabricatorHandleQuery())
+ ->setViewer($admin)
+ ->withPHIDs(array($object->getPHID()))
+ ->executeOne();
+ echo "Generated ".$handle->getTypeName().": ".
+ $handle->getFullName()."\n";
+
usleep(200000);
}
}
diff --git a/src/applications/metamta/contentsource/PhabricatorContentSource.php b/src/applications/metamta/contentsource/PhabricatorContentSource.php
--- a/src/applications/metamta/contentsource/PhabricatorContentSource.php
+++ b/src/applications/metamta/contentsource/PhabricatorContentSource.php
@@ -13,6 +13,7 @@
const SOURCE_HERALD = 'herald';
const SOURCE_LEGACY = 'legacy';
const SOURCE_DAEMON = 'daemon';
+ const SOURCE_LIPSUM = 'lipsum';
private $source;
private $params = array();
@@ -74,6 +75,7 @@
self::SOURCE_LEGACY => pht('Legacy'),
self::SOURCE_HERALD => pht('Herald'),
self::SOURCE_DAEMON => pht('Daemons'),
+ self::SOURCE_LIPSUM => pht('Lipsum'),
self::SOURCE_UNKNOWN => pht('Old World'),
);
}
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -1649,8 +1649,7 @@
$body = $this->buildMailBody($object, $xactions);
$mail_tags = $this->getMailTags($object, $xactions);
-
- $action = $this->getStrongestAction($object, $xactions)->getActionName();
+ $action = $this->getMailAction($object, $xactions);
$template
->setFrom($this->requireActor()->getPHID())
@@ -1745,6 +1744,15 @@
return array_mergev($tags);
}
+ /**
+ * @task mail
+ */
+ protected function getMailAction(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+ return $this->getStrongestAction($object, $xactions)->getActionName();
+ }
+
/**
* @task mail
diff --git a/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php
--- a/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php
+++ b/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php
@@ -851,6 +851,11 @@
'%d older changes are hidden.',
),
+ '%s, %d line(s)' => array(
+ '%s, %d line',
+ '%s, %d lines',
+ ),
+
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 12, 9:23 AM (1 w, 8 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6727094
Default Alt Text
D8453.diff (8 KB)
Attached To
Mode
D8453: Use DifferentialRevisionEditor in lipsum
Attached
Detach File
Event Timeline
Log In to Comment