mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 21:02:41 +01:00
f4b9efe256
Summary: Ref T4327. I want to make change parsing testable; one thing which is blocking this is that the Git discovery process is still part of `PullLocal` daemon instead of being part of `DiscoveryEngine`. The unit test stuff which I want to use for change parsing relies on `DiscoveryEngine` to discover repositories during unit tests. The major reason git discovery isn't part of `DiscoveryEngine` is that it relies on the messy "autoclose" logic, which we never implemented for Mercurial. Generally, I don't like how autoclose was implemented: it's complicated and gross and too hard to figure out and extend. Instead, I want to do something more similar to what we do for pushes, which is cleaner overall. Basically this means remembering the old branch heads from the last time we parsed a repository, and figuring out what's new by comparing the old and new branch heads. This should give us several advantages: - It should be simpler to understand than the autoclose stuff, which is pretty mind-numbing, at least for me. - It will let us satisfy branch and tag queries cheaply (from the database) instead of having to go to the repository. We could also satisfy some ref-resolve queries from the database. - It should be easier to extend to Mercurial. This implements the basics -- pretty much a table to store the cursors, which we update only for Git for now. Test Plan: - Ran migration. - Ran `bin/repository discover X --trace --verbose` on various repositories with branches and tags, before and after modifying pushes. - Pushed commits to a git repo. - Looked at database tables. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4327 Differential Revision: https://secure.phabricator.com/D7982
11 lines
533 B
SQL
11 lines
533 B
SQL
CREATE TABLE {$NAMESPACE}_repository.repository_refcursor (
|
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
repositoryPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
|
|
refType VARCHAR(32) NOT NULL COLLATE utf8_bin,
|
|
refNameHash VARCHAR(12) NOT NULL COLLATE latin1_bin,
|
|
refNameRaw LONGTEXT NOT NULL COLLATE latin1_bin,
|
|
refNameEncoding VARCHAR(16) COLLATE utf8_bin,
|
|
commitIdentifier VARCHAR(40) NOT NULL COLLATE utf8_bin,
|
|
|
|
KEY `key_cursor` (repositoryPHID, refType, refNameHash)
|
|
) ENGINE=InnoDB, COLLATE=utf8_general_ci;
|