@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a RefPosition table to hold branch/tag positions once the RefCursor table is split

Summary:
Ref T11823. Currently, we have a "RefCursor" table which stores rows like `<branch or tag name, commit it is pointing at>` with some more data.

Because Mercurial can have a single branch pointing at several different places, this table must allow multiple rows with the same branch or tag name.

Among other things, this means there isn't a single PHID which can be used to identify a branch name in a stable way. However, we have several UIs where we want to be able to do this.

Some specific examples where we run into trouble: in Mercurial, if there are 5 heads for "default", that means there are 5 phids. And currently, if someone deletes a branch, we lose the PHID for it. Instead, we'd rather retain it so the whole world doesn't break if you accidentally delete a branch and then fix it a little later.

(I'll likely hold this until the rest of the logic is fleshed out a little more in followup changes.)

Test Plan: Ran `bin/storage upgrade`, saw the table get created without warnings.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T11823

Differential Revision: https://secure.phabricator.com/D18602

+34
+6
resources/sql/autopatches/20170914.ref.01.position.sql
··· 1 + CREATE TABLE {$NAMESPACE}_repository.repository_refposition ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + cursorID INT UNSIGNED NOT NULL, 4 + commitIdentifier VARCHAR(40) NOT NULL COLLATE {$COLLATE_TEXT}, 5 + isClosed BOOL NOT NULL 6 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+2
src/__phutil_library_map__.php
··· 3863 3863 'PhabricatorRepositoryRefCursorPHIDType' => 'applications/repository/phid/PhabricatorRepositoryRefCursorPHIDType.php', 3864 3864 'PhabricatorRepositoryRefCursorQuery' => 'applications/repository/query/PhabricatorRepositoryRefCursorQuery.php', 3865 3865 'PhabricatorRepositoryRefEngine' => 'applications/repository/engine/PhabricatorRepositoryRefEngine.php', 3866 + 'PhabricatorRepositoryRefPosition' => 'applications/repository/storage/PhabricatorRepositoryRefPosition.php', 3866 3867 'PhabricatorRepositoryRepositoryPHIDType' => 'applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php', 3867 3868 'PhabricatorRepositorySchemaSpec' => 'applications/repository/storage/PhabricatorRepositorySchemaSpec.php', 3868 3869 'PhabricatorRepositorySearchEngine' => 'applications/repository/query/PhabricatorRepositorySearchEngine.php', ··· 9434 9435 'PhabricatorRepositoryRefCursorPHIDType' => 'PhabricatorPHIDType', 9435 9436 'PhabricatorRepositoryRefCursorQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 9436 9437 'PhabricatorRepositoryRefEngine' => 'PhabricatorRepositoryEngine', 9438 + 'PhabricatorRepositoryRefPosition' => 'PhabricatorRepositoryDAO', 9437 9439 'PhabricatorRepositoryRepositoryPHIDType' => 'PhabricatorPHIDType', 9438 9440 'PhabricatorRepositorySchemaSpec' => 'PhabricatorConfigSchemaSpec', 9439 9441 'PhabricatorRepositorySearchEngine' => 'PhabricatorApplicationSearchEngine',
+26
src/applications/repository/storage/PhabricatorRepositoryRefPosition.php
··· 1 + <?php 2 + 3 + final class PhabricatorRepositoryRefPosition 4 + extends PhabricatorRepositoryDAO { 5 + 6 + protected $cursorID; 7 + protected $commitIdentifier; 8 + protected $isClosed = 0; 9 + 10 + protected function getConfiguration() { 11 + return array( 12 + self::CONFIG_TIMESTAMPS => false, 13 + self::CONFIG_COLUMN_SCHEMA => array( 14 + 'commitIdentifier' => 'text40', 15 + 'isClosed' => 'bool', 16 + ), 17 + self::CONFIG_KEY_SCHEMA => array( 18 + 'key_position' => array( 19 + 'columns' => array('cursorID', 'commitIdentifier'), 20 + 'unique' => true, 21 + ), 22 + ), 23 + ) + parent::getConfiguration(); 24 + } 25 + 26 + }