Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14063677
D11212.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D11212.diff
View Options
diff --git a/src/applications/diffusion/edge/DiffusionCommitRevertedByCommitEdgeType.php b/src/applications/diffusion/edge/DiffusionCommitRevertedByCommitEdgeType.php
--- a/src/applications/diffusion/edge/DiffusionCommitRevertedByCommitEdgeType.php
+++ b/src/applications/diffusion/edge/DiffusionCommitRevertedByCommitEdgeType.php
@@ -13,4 +13,92 @@
return true;
}
+ public function getTransactionAddString(
+ $actor,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s reverted commit(s): %s.',
+ $actor,
+ $add_count,
+ $add_edges);
+ }
+
+ public function getTransactionRemoveString(
+ $actor,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s reverted commit(s): %s.',
+ $actor,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getTransactionEditString(
+ $actor,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited reverted commit(s), added %s: %s; removed %s: %s.',
+ $actor,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getFeedAddString(
+ $actor,
+ $object,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s reverted commit(s) for %s: %s.',
+ $actor,
+ $add_count,
+ $object,
+ $add_edges);
+ }
+
+ public function getFeedRemoveString(
+ $actor,
+ $object,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s reverted commit(s) for %s: %s.',
+ $actor,
+ $rem_count,
+ $object,
+ $rem_edges);
+ }
+
+ public function getFeedEditString(
+ $actor,
+ $object,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited reverted commit(s) for %s, added %s: %s; removed %s: %s.',
+ $actor,
+ $object,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
}
diff --git a/src/applications/diffusion/edge/DiffusionCommitRevertsCommitEdgeType.php b/src/applications/diffusion/edge/DiffusionCommitRevertsCommitEdgeType.php
--- a/src/applications/diffusion/edge/DiffusionCommitRevertsCommitEdgeType.php
+++ b/src/applications/diffusion/edge/DiffusionCommitRevertsCommitEdgeType.php
@@ -16,4 +16,92 @@
return true;
}
+ public function getTransactionAddString(
+ $actor,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s reverting commit(s): %s.',
+ $actor,
+ $add_count,
+ $add_edges);
+ }
+
+ public function getTransactionRemoveString(
+ $actor,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s reverting commit(s): %s.',
+ $actor,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getTransactionEditString(
+ $actor,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited reverting commit(s), added %s: %s; removed %s: %s.',
+ $actor,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getFeedAddString(
+ $actor,
+ $object,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s reverting commit(s) for %s: %s.',
+ $actor,
+ $add_count,
+ $object,
+ $add_edges);
+ }
+
+ public function getFeedRemoveString(
+ $actor,
+ $object,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s reverting commit(s) for %s: %s.',
+ $actor,
+ $rem_count,
+ $object,
+ $rem_edges);
+ }
+
+ public function getFeedEditString(
+ $actor,
+ $object,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited reverting commit(s) for %s, added %s: %s; removed %s: %s.',
+ $actor,
+ $object,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
}
diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
--- a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
+++ b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
@@ -59,12 +59,36 @@
'committerName' => $data->getCommitDetail('committer'),
'committerPHID' => $data->getCommitDetail('committerPHID'),
));
+
+ $reverts_refs = id(new DifferentialCustomFieldRevertsParser())
+ ->parseCorpus($data->getCommitMessage());
+ $reverts = array_mergev(ipull($reverts_refs, 'monograms'));
+
+ if ($reverts) {
+ $reverted_commits = id(new DiffusionCommitQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->withIdentifiers($reverts)
+ ->execute();
+ $reverted_commit_phids = mpull($reverted_commits, 'getPHID', 'getPHID');
+
+ // NOTE: Skip any write attempts if a user cleverly implies a commit
+ // reverts itself.
+ unset($reverted_commit_phids[$commit->getPHID()]);
+
+ $reverts_edge = DiffusionCommitRevertsCommitEdgeType::EDGECONST;
+ $xactions[] = id(new PhabricatorAuditTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $reverts_edge)
+ ->setNewValue(array('+' => array_fuse($reverted_commit_phids)));
+ }
+
try {
$raw_patch = $this->loadRawPatchText($repository, $commit);
} catch (Exception $ex) {
$raw_patch = pht('Unable to generate patch: %s', $ex->getMessage());
}
$editor->setRawPatch($raw_patch);
+
return $editor->applyTransactions($commit, $xactions);
}
diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
--- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
+++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
@@ -102,35 +102,6 @@
$conn_w = id(new DifferentialRevision())->establishConnection('w');
- $reverts_refs = id(new DifferentialCustomFieldRevertsParser())
- ->parseCorpus($message);
- $reverts = array_mergev(ipull($reverts_refs, 'monograms'));
-
- if ($reverts) {
- $reverted_commits = id(new DiffusionCommitQuery())
- ->setViewer($actor)
- ->withIdentifiers($reverts)
- ->execute();
- $reverted_commit_phids = mpull($reverted_commits, 'getPHID', 'getPHID');
-
- // NOTE: Skip any write attempts if a user cleverly implies a commit
- // reverts itself.
- unset($reverted_commit_phids[$commit->getPHID()]);
-
- $editor = new PhabricatorEdgeEditor();
- foreach ($reverted_commit_phids as $commit_phid) {
- try {
- $editor->addEdge(
- $commit->getPHID(),
- DiffusionCommitRevertsCommitEdgeType::EDGECONST,
- $commit_phid);
- } catch (PhabricatorEdgeCycleException $ex) {
- continue;
- }
- }
- $editor->save();
- }
-
// NOTE: The `differential_commit` table has a unique ID on `commitPHID`,
// preventing more than one revision from being associated with a commit.
// Generally this is good and desirable, but with the advent of hash
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
@@ -600,6 +600,40 @@
'%s edited commit(s), added %s: %s; removed %s: %s.' =>
'%s edited commits, added %3$s; removed %5$s.',
+ '%s added %s reverted commit(s): %s.' => array(
+ array(
+ '%s added a reverted commit: %3$s.',
+ '%s added reverted commits: %3$s.',
+ ),
+ ),
+
+ '%s removed %s reverted commit(s): %s.' => array(
+ array(
+ '%s removed a reverted commit: %3$s.',
+ '%s removed reverted commits: %3$s.',
+ ),
+ ),
+
+ '%s edited reverted commit(s), added %s: %s; removed %s: %s.' =>
+ '%s edited reverted commits, added %3$s; removed %5$s.',
+
+ '%s added %s reverting commit(s): %s.' => array(
+ array(
+ '%s added a reverting commit: %3$s.',
+ '%s added reverting commits: %3$s.',
+ ),
+ ),
+
+ '%s removed %s reverting commit(s): %s.' => array(
+ array(
+ '%s removed a reverting commit: %3$s.',
+ '%s removed reverting commits: %3$s.',
+ ),
+ ),
+
+ '%s edited reverting commit(s), added %s: %s; removed %s: %s.' =>
+ '%s edited reverting commits, added %3$s; removed %5$s.',
+
'%s changed project member(s), added %d: %s; removed %d: %s.' =>
'%s changed project members, added %3$s; removed %5$s.',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 7:44 PM (19 h, 13 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6729412
Default Alt Text
D11212.diff (9 KB)
Attached To
Mode
D11212: Use `PhabricatorAuditEditor` to write revert edges
Attached
Detach File
Event Timeline
Log In to Comment