Page MenuHomePhabricator

D9290.id22055.diff
No OneTemporary

D9290.id22055.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -11,7 +11,7 @@
'core.pkg.js' => '7db41c19',
'darkconsole.pkg.js' => 'ca8671ce',
'differential.pkg.css' => 'fbf57382',
- 'differential.pkg.js' => '5b17219f',
+ 'differential.pkg.js' => 'eca39a2c',
'diffusion.pkg.css' => '3783278d',
'diffusion.pkg.js' => '077e3ad0',
'maniphest.pkg.css' => 'f88a8402',
@@ -354,13 +354,13 @@
'rsrc/js/application/countdown/timer.js' => '889c96f3',
'rsrc/js/application/dashboard/behavior-dashboard-async-panel.js' => '469c0d9e',
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => 'fa187a68',
- 'rsrc/js/application/differential/ChangesetViewManager.js' => 'f28fc318',
+ 'rsrc/js/application/differential/ChangesetViewManager.js' => 'db09a523',
'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => 'f2441746',
'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => '533a187b',
'rsrc/js/application/differential/behavior-comment-jump.js' => '71755c79',
'rsrc/js/application/differential/behavior-comment-preview.js' => '127f2018',
'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1',
- 'rsrc/js/application/differential/behavior-dropdown-menus.js' => 'bce64685',
+ 'rsrc/js/application/differential/behavior-dropdown-menus.js' => '64a79839',
'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '00861799',
'rsrc/js/application/differential/behavior-keyboard-nav.js' => '173ce7e7',
'rsrc/js/application/differential/behavior-populate.js' => 'bdb3e4d0',
@@ -504,7 +504,7 @@
'aphront-two-column-view-css' => '16ab3ad2',
'aphront-typeahead-control-css' => '1f4c9e23',
'auth-css' => '1e655982',
- 'changeset-view-manager' => 'f28fc318',
+ 'changeset-view-manager' => 'db09a523',
'config-options-css' => '7fedf08b',
'conpherence-menu-css' => '561348ac',
'conpherence-message-pane-css' => 'e57041c8',
@@ -557,7 +557,7 @@
'javelin-behavior-differential-add-reviewers-and-ccs' => '533a187b',
'javelin-behavior-differential-comment-jump' => '71755c79',
'javelin-behavior-differential-diff-radios' => 'e1ff79b1',
- 'javelin-behavior-differential-dropdown-menus' => 'bce64685',
+ 'javelin-behavior-differential-dropdown-menus' => '64a79839',
'javelin-behavior-differential-edit-inline-comments' => '00861799',
'javelin-behavior-differential-feedback-preview' => '127f2018',
'javelin-behavior-differential-keyboard-navigation' => '173ce7e7',
@@ -1288,6 +1288,18 @@
1 => 'javelin-dom',
2 => 'javelin-fx',
),
+ '64a79839' =>
+ array(
+ 0 => 'javelin-behavior',
+ 1 => 'javelin-dom',
+ 2 => 'javelin-util',
+ 3 => 'javelin-stratcom',
+ 4 => 'phuix-dropdown-menu',
+ 5 => 'phuix-action-list-view',
+ 6 => 'phuix-action-view',
+ 7 => 'phabricator-phtize',
+ 8 => 'changeset-view-manager',
+ ),
'64ef2fd2' =>
array(
0 => 'javelin-behavior',
@@ -1704,18 +1716,6 @@
0 => 'javelin-install',
1 => 'javelin-dom',
),
- 'bce64685' =>
- array(
- 0 => 'javelin-behavior',
- 1 => 'javelin-dom',
- 2 => 'javelin-util',
- 3 => 'javelin-stratcom',
- 4 => 'phuix-dropdown-menu',
- 5 => 'phuix-action-list-view',
- 6 => 'phuix-action-view',
- 7 => 'phabricator-phtize',
- 8 => 'changeset-view-manager',
- ),
'bd0aedcd' =>
array(
0 => 'javelin-install',
@@ -1902,6 +1902,17 @@
1 => 'javelin-util',
2 => 'javelin-stratcom',
),
+ 'db09a523' =>
+ array(
+ 0 => 'javelin-dom',
+ 1 => 'javelin-util',
+ 2 => 'javelin-stratcom',
+ 3 => 'javelin-install',
+ 4 => 'javelin-workflow',
+ 5 => 'javelin-router',
+ 6 => 'javelin-behavior-device',
+ 7 => 'javelin-vector',
+ ),
'dd7e8ef5' =>
array(
0 => 'javelin-behavior',
@@ -1981,17 +1992,6 @@
4 => 'javelin-request',
5 => 'javelin-workflow',
),
- 'f28fc318' =>
- array(
- 0 => 'javelin-dom',
- 1 => 'javelin-util',
- 2 => 'javelin-stratcom',
- 3 => 'javelin-install',
- 4 => 'javelin-workflow',
- 5 => 'javelin-router',
- 6 => 'javelin-behavior-device',
- 7 => 'javelin-vector',
- ),
'f42bb8c6' =>
array(
0 => 'javelin-stratcom',
diff --git a/resources/sql/autopatches/20140525.hunkmodern.sql b/resources/sql/autopatches/20140525.hunkmodern.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140525.hunkmodern.sql
@@ -0,0 +1,15 @@
+CREATE TABLE {$NAMESPACE}_differential.differential_hunk_modern (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ changesetID INT UNSIGNED NOT NULL,
+ oldOffset INT UNSIGNED NOT NULL,
+ oldLen INT UNSIGNED NOT NULL,
+ newOffset INT UNSIGNED NOT NULL,
+ newLen INT UNSIGNED NOT NULL,
+
+ dataType CHAR(4) NOT NULL COLLATE latin1_bin,
+ dataEncoding VARCHAR(16) NOT NULL COLLATE latin1_bin,
+ dataFormat CHAR(4) NOT NULL COLLATE latin1_bin,
+ data LONGBLOB NOT NULL,
+
+ KEY `key_changeset` (changesetID)
+) ENGINE=InnoDB, COLLATE utf8_general_ci;
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -385,6 +385,8 @@
'DifferentialHostField' => 'applications/differential/customfield/DifferentialHostField.php',
'DifferentialHovercardEventListener' => 'applications/differential/event/DifferentialHovercardEventListener.php',
'DifferentialHunk' => 'applications/differential/storage/DifferentialHunk.php',
+ 'DifferentialHunkLegacy' => 'applications/differential/storage/DifferentialHunkLegacy.php',
+ 'DifferentialHunkModern' => 'applications/differential/storage/DifferentialHunkModern.php',
'DifferentialHunkParser' => 'applications/differential/parser/DifferentialHunkParser.php',
'DifferentialHunkParserTestCase' => 'applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php',
'DifferentialHunkQuery' => 'applications/differential/query/DifferentialHunkQuery.php',
@@ -3067,6 +3069,8 @@
0 => 'DifferentialDAO',
1 => 'PhabricatorPolicyInterface',
),
+ 'DifferentialHunkLegacy' => 'DifferentialHunk',
+ 'DifferentialHunkModern' => 'DifferentialHunk',
'DifferentialHunkParserTestCase' => 'PhabricatorTestCase',
'DifferentialHunkQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DifferentialHunkTestCase' => 'ArcanistPhutilTestCase',
diff --git a/src/applications/differential/parser/__tests__/DifferentialChangesetParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialChangesetParserTestCase.php
--- a/src/applications/differential/parser/__tests__/DifferentialChangesetParserTestCase.php
+++ b/src/applications/differential/parser/__tests__/DifferentialChangesetParserTestCase.php
@@ -3,7 +3,7 @@
final class DifferentialChangesetParserTestCase extends PhabricatorTestCase {
public function testDiffChangesets() {
- $hunk = new DifferentialHunk();
+ $hunk = new DifferentialHunkLegacy();
$hunk->setChanges("+a\n b\n-c");
$hunk->setNewOffset(1);
$hunk->setNewLen(2);
@@ -20,7 +20,7 @@
);
foreach ($tests as $changes => $expected) {
- $hunk = new DifferentialHunk();
+ $hunk = new DifferentialHunkLegacy();
$hunk->setChanges($changes);
$hunk->setNewOffset(11);
$hunk->setNewLen(3);
diff --git a/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php
--- a/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php
+++ b/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php
@@ -14,7 +14,7 @@
$new_len,
$changes) {
- $hunk = id(new DifferentialHunk())
+ $hunk = id(new DifferentialHunkLegacy())
->setOldOffset($old_offset)
->setOldLen($old_len)
->setNewOffset($new_offset)
diff --git a/src/applications/differential/query/DifferentialHunkQuery.php b/src/applications/differential/query/DifferentialHunkQuery.php
--- a/src/applications/differential/query/DifferentialHunkQuery.php
+++ b/src/applications/differential/query/DifferentialHunkQuery.php
@@ -31,18 +31,38 @@
}
public function loadPage() {
- $table = new DifferentialHunk();
+ $all_results = array();
+
+ // Load modern hunks.
+ $table = new DifferentialHunkModern();
+ $conn_r = $table->establishConnection('r');
+
+ $modern_data = queryfx_all(
+ $conn_r,
+ 'SELECT * FROM %T %Q %Q %Q',
+ $table->getTableName(),
+ $this->buildWhereClause($conn_r),
+ $this->buildOrderClause($conn_r),
+ $this->buildLimitClause($conn_r));
+ $modern_results = $table->loadAllFromArray($modern_data);
+
+
+ // Now, load legacy hunks.
+ $table = new DifferentialHunkLegacy();
$conn_r = $table->establishConnection('r');
- $data = queryfx_all(
+ $legacy_data = queryfx_all(
$conn_r,
'SELECT * FROM %T %Q %Q %Q',
$table->getTableName(),
$this->buildWhereClause($conn_r),
$this->buildOrderClause($conn_r),
$this->buildLimitClause($conn_r));
+ $legacy_results = $table->loadAllFromArray($legacy_data);
- return $table->loadAllFromArray($data);
+ // Strip all the IDs off since they're not unique and nothing should be
+ // using them.
+ return array_values(array_merge($legacy_results, $modern_results));
}
public function willFilterPage(array $hunks) {
diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php
--- a/src/applications/differential/storage/DifferentialChangeset.php
+++ b/src/applications/differential/storage/DifferentialChangeset.php
@@ -76,7 +76,7 @@
public function delete() {
$this->openTransaction();
- $hunks = id(new DifferentialHunk())->loadAllWhere(
+ $hunks = id(new DifferentialHunkLegacy())->loadAllWhere(
'changesetID = %d',
$this->getID());
foreach ($hunks as $hunk) {
diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php
--- a/src/applications/differential/storage/DifferentialDiff.php
+++ b/src/applications/differential/storage/DifferentialDiff.php
@@ -132,7 +132,7 @@
$hunks = $change->getHunks();
if ($hunks) {
foreach ($hunks as $hunk) {
- $dhunk = new DifferentialHunk();
+ $dhunk = new DifferentialHunkLegacy();
$dhunk->setOldOffset($hunk->getOldOffset());
$dhunk->setOldLen($hunk->getOldLength());
$dhunk->setNewOffset($hunk->getNewOffset());
diff --git a/src/applications/differential/storage/DifferentialHunk.php b/src/applications/differential/storage/DifferentialHunk.php
--- a/src/applications/differential/storage/DifferentialHunk.php
+++ b/src/applications/differential/storage/DifferentialHunk.php
@@ -1,10 +1,9 @@
<?php
-final class DifferentialHunk extends DifferentialDAO
+abstract class DifferentialHunk extends DifferentialDAO
implements PhabricatorPolicyInterface {
protected $changesetID;
- protected $changes;
protected $oldOffset;
protected $oldLen;
protected $newOffset;
diff --git a/src/applications/differential/storage/DifferentialHunkLegacy.php b/src/applications/differential/storage/DifferentialHunkLegacy.php
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/storage/DifferentialHunkLegacy.php
@@ -0,0 +1,11 @@
+<?php
+
+final class DifferentialHunkLegacy extends DifferentialHunk {
+
+ protected $changes;
+
+ public function getTableName() {
+ return 'differential_hunk';
+ }
+
+}
diff --git a/src/applications/differential/storage/DifferentialHunkModern.php b/src/applications/differential/storage/DifferentialHunkModern.php
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/storage/DifferentialHunkModern.php
@@ -0,0 +1,73 @@
+<?php
+
+final class DifferentialHunkModern extends DifferentialHunk {
+
+ const DATATYPE_TEXT = 'text';
+ const DATATYPE_FILE = 'file';
+
+ const DATAFORMAT_RAW = 'byte';
+ const DATAFORMAT_DEFLATE = 'gzde';
+
+ protected $dataType;
+ protected $dataEncoding;
+ protected $dataFormat;
+ protected $data;
+
+ public function getTableName() {
+ return 'differential_hunk_modern';
+ }
+
+ public function getConfiguration() {
+ return array(
+ self::CONFIG_BINARY => array(
+ 'data' => true,
+ ),
+ ) + parent::getConfiguration();
+ }
+
+ public function setChanges($text) {
+ $this->dataEncoding = $this->detectEncodingForStorage($text);
+ $this->dataType = self::DATATYPE_TEXT;
+ $this->dataFormat = self::DATAFORMAT_RAW;
+ $this->data = $text;
+
+ return $this;
+ }
+
+ public function getChanges() {
+ return $this->getUTF8StringFromStorage(
+ $this->getRawData(),
+ $this->getDataEncoding());
+ }
+
+ private function getRawData() {
+ $type = $this->getDataType();
+ $data = $this->getData();
+
+ switch ($type) {
+ case self::DATATYPE_TEXT:
+ // In this storage type, the changes are stored on the object.
+ $data = $data;
+ break;
+ case self::DATATYPE_FILE:
+ default:
+ throw new Exception(
+ pht('Hunk has unsupported data type "%s"!', $type));
+ }
+
+ $format = $this->getDataFormat();
+ switch ($format) {
+ case self::DATAFORMAT_RAW:
+ // In this format, the changes are stored as-is.
+ $data = $data;
+ break;
+ case self::DATAFORMAT_DEFLATE:
+ default:
+ throw new Exception(
+ pht('Hunk has unsupported data encoding "%s"!', $type));
+ }
+
+ return $data;
+ }
+
+}
diff --git a/src/applications/differential/storage/__tests__/DifferentialHunkTestCase.php b/src/applications/differential/storage/__tests__/DifferentialHunkTestCase.php
--- a/src/applications/differential/storage/__tests__/DifferentialHunkTestCase.php
+++ b/src/applications/differential/storage/__tests__/DifferentialHunkTestCase.php
@@ -5,7 +5,7 @@
public function testMakeChanges() {
$root = dirname(__FILE__).'/hunk/';
- $hunk = new DifferentialHunk();
+ $hunk = new DifferentialHunkLegacy();
$hunk->setChanges(Filesystem::readFile($root.'basic.diff'));
$hunk->setOldOffset(1);
$hunk->setNewOffset(11);
@@ -23,7 +23,7 @@
);
$this->assertEqual($added, $hunk->getAddedLines());
- $hunk = new DifferentialHunk();
+ $hunk = new DifferentialHunkLegacy();
$hunk->setChanges(Filesystem::readFile($root.'newline.diff'));
$hunk->setOldOffset(1);
$hunk->setNewOffset(11);
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
@@ -382,8 +382,8 @@
// -echo "test";
// -(empty line)
- $hunk = id(new DifferentialHunk())->setChanges($context);
- $vs_hunk = id(new DifferentialHunk())->setChanges($vs_context);
+ $hunk = id(new DifferentialHunkLegacy())->setChanges($context);
+ $vs_hunk = id(new DifferentialHunkLegacy())->setChanges($vs_context);
if ($hunk->makeOldFile() != $vs_hunk->makeOldFile() ||
$hunk->makeNewFile() != $vs_hunk->makeNewFile()) {
return $vs_diff;

File Metadata

Mime Type
text/plain
Expires
Fri, May 10, 12:14 PM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6282418
Default Alt Text
D9290.id22055.diff (15 KB)

Event Timeline