Summary:
When rendering commit messages, drive all the logic through field specification
classes instead of the hard-coded DifferentialCommitMessageData class. This
removes DifferentialCommitMessageData and support classes.
Note that this effectively reverts D546, and will cause a minor break for
Facebook (Task IDs will no longer render in commit messages generated by "arc
amend", and will not be editable via "arc diff --edit"). This can be resolved by
implementing the feature as a custom field. While I've been able to preserve the
task ID functionality elsewhere, I felt this implementation was too complex to
reasonably leave hooks for, and the break is pretty minor.
Test Plan:
- Made numerous calls to differential.getcommitmessage across many diffs in
various states, with and without 'edit' and with and without various field
overrides.
- General behavior seems correct (messages look accurate, and have the
expected information). Special fields like "Reviewed By" and "git-svn-id" seem
to work correctly.
- Edit behavior seems correct (edit mode shows all editable fields, hides
fields like "Reviewed By").
- Field overwrite behavior seems correct (overwritable fields show the correct
values when overwritten, ignore provided values otherwise).
Reviewed By: jungejason
Reviewers: jungejason, tuomaspelkonen, aran
CC: aran, jungejason
Differential Revision: 814
Summary: see title
Test Plan: ran "arc amend" to ensure that task ids where being included in the commit message
Reviewers: epriestley
CC: dpepper
Differential Revision: 637
Summary:
My earlier diff refactored some code without completely
respecting the semantics, sometimes resulting in duplicate field names
returned from differential.getcommitmessage. This fixes that.
Test Plan:
ran "arc diff" with diff causing the bug (commit message
had an empty Revert Plan: field) and verified no duplicate fields
Reviewed By: epriestley
Reviewers: epriestley
CC: aran, dpepper, epriestley
Differential Revision: 610
Summary:
when "arc diff" generates a revision, it attaches a task id
if one is included. However, "arc amend" did not return a task id,
effectively stripping it from the commit message. This diff fixes
that.
NOTE: This is dependent on revision 549 https://secure.phabricator.com/D549
Test Plan:
0. created a custom class to append Facebook task IDs to commit messages and
attached it to the differential.append-commit-message-class config variable
1. created a new diff in the www repot
2. included Task ID: 609350 in the git commit message
3. "arc diff" to generate the revision
4. "arc amend"
5. ensure that the "Task ID:" field remained in the git commit message
Reviewed By: epriestley
Reviewers: dpepper, jungejason, epriestley
CC: aran, epriestley, mgummelt
Differential Revision: 546
Summary:
commit message fields were previously stored as name/value
pairs in an associative array. this resulted in ad hoc code to modify
the structure/rendering of these fields in commit messages. this diff
introduces a new DifferentialCommitMessageField class.
Test Plan:
ran "arc amend" to ensure the commit message still looked good
Reviewed By: epriestley
Reviewers: epriestley
CC: aran, dpepper, epriestley
Differential Revision: 554
Summary:
The old query was effectively
SELECT DISTINCT revision.* FROM `differential_revision` revision
JOIN `differential_relationship` relationship ON
(relationship.revisionID = revision.id
AND relationship.objectPHID in
('PHID-USER-a113b9ae4ee9524d0a20'))
OR revision.authorPHID = 'PHID-USER-a113b9ae4ee9524d0a20'
LEFT JOIN `differential_viewtime` viewtime ON
viewtime.viewerPHID in ('PHID-USER-a113b9ae4ee9524d0a20')
AND viewtime.objectPHID = revision.phid
AND GREATEST(1304022277, IFNULL(viewtime.viewTime, 0)) <
revision.dateModified
ORDER BY dateModified DESC;
I'm not a db performance expert but it looks like the problem is that we
have to scan all revisions
mysql> EXPLAIN SELECT DISTINCT revision.* FROM `differential_revision`
revision JOIN `differential_relationship` relationship ON
(relationship.revisionID = revision.id AND relationship.objectPHID
in ('PHID-USER-a113b9ae4ee9524d0a20')) OR revision.authorPHID =
'PHID-USER-a113b9ae4ee9524d0a20' LEFT JOIN `differential_viewtime`
viewtime ON viewtime.viewerPHID in ('PHID-USER-a113b9ae4ee9524d0a20')
AND viewtime.objectPHID = revision.phid AND GREATEST(1304022277,
IFNULL(viewtime.viewTime, 0)) < revision.dateModified ORDER BY
dateModified DESC;
+----+-------------+--------------+-------+--------------------+------------+---------+-------+--------+------------------------------------+
| id | select_type | table | type | possible_keys | key |
key_len | ref | rows | Extra |
+----+-------------+--------------+-------+--------------------+------------+---------+-------+--------+------------------------------------+
| 1 | SIMPLE | revision | ALL | PRIMARY,authorPHID | NULL |
NULL | NULL | 254127 | Using temporary; Using filesort |
| 1 | SIMPLE | viewtime | ref | PRIMARY | PRIMARY |
66 | const | 17 | Distinct |
| 1 | SIMPLE | relationship | index | PRIMARY,objectPHID | objectPHID |
72 | NULL | 966900 | Using where; Using index; Distinct |
+----+-------------+--------------+-------+--------------------+------------+---------+-------+--------+------------------------------------+
The new query is a lot faster
mysql> EXPLAIN SELECT revs.* FROM ( (SELECT revision.* FROM
`differential_revision` revision WHERE revision.authorPHID in
('PHID-USER-a113b9ae4ee9524d0a20')) UNION (SELECT revision.* FROM
`differential_revision` revision JOIN differential_relationship rel WHERE
rel.revisionId = revision.Id AND rel.objectPHID =
'PHID-USER-a113b9ae4ee9524d0a20')) as revs LEFT JOIN `differential_viewtime`
viewtime ON viewtime.viewerPHID = 'PHID-USER-a113b9ae4ee9524d0a20' AND
viewtime.objectPHID = revs.phid WHERE GREATEST(1304022277,
IFNULL(viewtime.viewTime, 0)) < revs.dateModified ORDER BY revs.dateModified;
+----+--------------+------------+--------+--------------------+------------+---------+-----------------------------------------+------+--------------------------+
| id | select_type | table | type | possible_keys | key |
key_len | ref | rows | Extra
|
+----+--------------+------------+--------+--------------------+------------+---------+-----------------------------------------+------+--------------------------+
| 1 | PRIMARY | <derived2> | ALL | NULL | NULL |
NULL | NULL | 3021 | Using filesort
|
| 1 | PRIMARY | viewtime | ref | PRIMARY | PRIMARY |
66 | const | 17 | Using where
|
| 2 | DERIVED | revision | ref | authorPHID | authorPHID |
67 | | 1040 | Using where
|
| 3 | UNION | rel | ref | PRIMARY,objectPHID | objectPHID |
66 | | 3822 | Using where; Using
index |
| 3 | UNION | revision | eq_ref | PRIMARY | PRIMARY |
4 | phabricator_differential.rel.revisionID | 1 |
|
| NULL | UNION RESULT | <union2,3> | ALL | NULL | NULL
| NULL | NULL | NULL |
|
+----+--------------+------------+--------+--------------------+------------+---------+-----------------------------------------+------+--------------------------+
Test Plan:
Loaded differential updates with new query, made sure page loaded quickly. Ran
the query from the command-line, it took about .4 seconds.
Reviewed By: Girish
Reviewers: tuomaspelkonen, jungejason, Girish
Commenters: btrahan
CC: aran, btrahan, elynde, Girish
Differential Revision: 181
Summary:
The 'All Revisions and Reviews' Query takes about 2 seconds when I run
it from the mysql command-line:
SELECT revision.*
FROM `differential_revision` revision LEFT JOIN
`differential_relationship` relationship
ON revision.id = relationship.revisionID
AND relationship.relation = 'revw'
WHERE revision.authorPHID in ('PHID-USER-a113b9ae4ee9524d0a20') OR
relationship.objectPHID in ('PHID-USER-a113b9ae4ee9524d0a20')
GROUP BY revision.id ORDER BY dateModified DESC
2419 rows in set (2.05 sec)
This takes about 0.1-0.2 seconds. Just dug into this because I guess
phabricator is haven't a bunch of mysql timeouts.
I don't know what the hell I'm doing; this is just faster
Test Plan:
Loaded 'All Revisions and Reviews' in sandbox
http://phabricator.dev1577.snc6.facebook.com/differential/filter/related/
Made sure it had same results as the version in prod
https://phabricator.fb.com/differential/filter/related/
Still slow to generate all that html
Reviewed By: epriestley
Reviewers: epriestley, aran, tuomaspelkonen, jungejason
CC: aran, epriestley
Differential Revision: 182
Summary:
This adds a new view to differential called Updates.
The high-level goal of Updates is to enabled differential to be
effectively used without email notifications. I've tried doing things
like automatically deleting differential emails where I'm in the 'to'
line since they show up on the main diffential page but then there's
always the chance an important diff flies by without me seeing it. Also,
sometimes someone comments on a diff post-commit but differential
doesn't surface those diffs.
I re-created a test db on my devserver using mysqldump to get data on
revs > 230000 so I would have some test data. We need to add a simple
viewtime table but I didn't want to do that in production. Here's the
table:
CREATE TABLE differential_viewtime (
viewerPHID varchar(64) not null,
objectPHID varchar(64) not null,
viewTime int unsigned not null,
PRIMARY KEY (viewerPHID, objectPHID)
);
Issues:
-Once we turn this on, all diffs will be 'unviewed'. What do you think
about a 'Clear All' button or something?
-Maybe we should add a pager
This feature would be insanely useful, let me know what you think.
Test Plan:
Loaded Updates in my sandbox
http://phabricator.dev1577.snc6.facebook.com/differential/filter/updates/
Clicked a diff, then went back, made sure diff disappeared from Updates
list
Reviewed By: tuomaspelkonen
Reviewers: epriestley, jungejason, tuomaspelkonen
Commenters: epriestley
CC: epriestley, elynde, tuomaspelkonen
Differential Revision: 169