2011-01-25 00:52:35 +01:00
|
|
|
<?php
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class DifferentialChangesetViewController extends DifferentialController {
|
2011-01-25 00:52:35 +01:00
|
|
|
|
2013-09-27 03:45:04 +02:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
2011-10-24 21:27:16 +02:00
|
|
|
}
|
|
|
|
|
2015-04-10 01:15:13 +02:00
|
|
|
public function handleRequest(AphrontRequest $request) {
|
Track a "Done" state on inline comments
Summary:
Ref T1460. This just barely works, but throwing it up in case any of it sounds mechanically crazy before we build integrations/UI/etc.
Specifically, these are the behaviors:
- You can mark your own draft comments as "done" before you submit them. The intent is to let reviewers mark their stuff advisory/minor/not-important before they submit it, to hint to authors that they don't expect the feedback to necessarily be addressed (maybe it's a joke, maybe it's just discussion, maybe it's "consider..").
- You can mark others' published comments as "done" if you're the revision/commit author. The intent is to keep this lightweight by not requiring an audit trail of who marked what done when. If anyone could mark anything done, we'd have to have some way to show who marked stuff.
- When you mark stuff done (or unmark it), it goes into a "draft" state, where you see the change but others don't see it yet. The intent is twofold:
- Be consistent with how inlines work.
- Allow us to publish a "epriestley updated this revision + epriestley marked 15 inlines as done" story later if we want. This seems more useful than publishing 15 "epriestley marked one thing as done" stories.
- The actual bit where done-ness publishes isn't implemented.
- UI is bare bones.
- No integration with the rest of the UI yet.
Test Plan: Clicked some checkboxes.
Reviewers: chad, btrahan
Reviewed By: btrahan
Subscribers: paulshen, chasemp, epriestley
Maniphest Tasks: T1460
Differential Revision: https://secure.phabricator.com/D12033
2015-03-10 02:41:47 +01:00
|
|
|
$viewer = $this->getViewer();
|
2011-02-01 05:38:13 +01:00
|
|
|
|
Move "Rendering References" to the DifferentialChangesetParser level
Summary:
Separates changeset IDs from rendering. Now each changeset has a "rendering
reference" which is basically a description of what the ajax endpoint should
render. For Differential, it's in the form "id/vs". For Diffusion,
"branch/path;commit".
I believe this fixes pretty much all of the bugs related to "show more" breaking
in various obscure ways, although I never got a great repro for T153.
Test Plan:
Clicked "show more" in diffusion change and commit views and differential diff,
diff-of-diff, standalone-diff, standalone-diff-of-diff views. Verified refs and
'whitespace' were always sent correctly.
Made inline comments on diffs and diffs-of-diffs. Used "Reply".
Reviewed By: tuomaspelkonen
Reviewers: tuomaspelkonen, jungejason, aran
CC: aran, tuomaspelkonen, epriestley
Differential Revision: 274
2011-05-12 06:46:29 +02:00
|
|
|
$rendering_reference = $request->getStr('ref');
|
|
|
|
$parts = explode('/', $rendering_reference);
|
|
|
|
if (count($parts) == 2) {
|
|
|
|
list($id, $vs) = $parts;
|
|
|
|
} else {
|
|
|
|
$id = $parts[0];
|
|
|
|
$vs = 0;
|
|
|
|
}
|
2011-02-04 00:41:58 +01:00
|
|
|
|
Move "Rendering References" to the DifferentialChangesetParser level
Summary:
Separates changeset IDs from rendering. Now each changeset has a "rendering
reference" which is basically a description of what the ajax endpoint should
render. For Differential, it's in the form "id/vs". For Diffusion,
"branch/path;commit".
I believe this fixes pretty much all of the bugs related to "show more" breaking
in various obscure ways, although I never got a great repro for T153.
Test Plan:
Clicked "show more" in diffusion change and commit views and differential diff,
diff-of-diff, standalone-diff, standalone-diff-of-diff views. Verified refs and
'whitespace' were always sent correctly.
Made inline comments on diffs and diffs-of-diffs. Used "Reply".
Reviewed By: tuomaspelkonen
Reviewers: tuomaspelkonen, jungejason, aran
CC: aran, tuomaspelkonen, epriestley
Differential Revision: 274
2011-05-12 06:46:29 +02:00
|
|
|
$id = (int)$id;
|
|
|
|
$vs = (int)$vs;
|
2011-02-04 00:41:58 +01:00
|
|
|
|
2014-05-25 17:59:31 +02:00
|
|
|
$load_ids = array($id);
|
|
|
|
if ($vs && ($vs != -1)) {
|
|
|
|
$load_ids[] = $vs;
|
2011-01-25 00:52:35 +01:00
|
|
|
}
|
|
|
|
|
2014-05-25 17:59:31 +02:00
|
|
|
$changesets = id(new DifferentialChangesetQuery())
|
Track a "Done" state on inline comments
Summary:
Ref T1460. This just barely works, but throwing it up in case any of it sounds mechanically crazy before we build integrations/UI/etc.
Specifically, these are the behaviors:
- You can mark your own draft comments as "done" before you submit them. The intent is to let reviewers mark their stuff advisory/minor/not-important before they submit it, to hint to authors that they don't expect the feedback to necessarily be addressed (maybe it's a joke, maybe it's just discussion, maybe it's "consider..").
- You can mark others' published comments as "done" if you're the revision/commit author. The intent is to keep this lightweight by not requiring an audit trail of who marked what done when. If anyone could mark anything done, we'd have to have some way to show who marked stuff.
- When you mark stuff done (or unmark it), it goes into a "draft" state, where you see the change but others don't see it yet. The intent is twofold:
- Be consistent with how inlines work.
- Allow us to publish a "epriestley updated this revision + epriestley marked 15 inlines as done" story later if we want. This seems more useful than publishing 15 "epriestley marked one thing as done" stories.
- The actual bit where done-ness publishes isn't implemented.
- UI is bare bones.
- No integration with the rest of the UI yet.
Test Plan: Clicked some checkboxes.
Reviewers: chad, btrahan
Reviewed By: btrahan
Subscribers: paulshen, chasemp, epriestley
Maniphest Tasks: T1460
Differential Revision: https://secure.phabricator.com/D12033
2015-03-10 02:41:47 +01:00
|
|
|
->setViewer($viewer)
|
2014-05-25 17:59:31 +02:00
|
|
|
->withIDs($load_ids)
|
|
|
|
->needHunks(true)
|
|
|
|
->execute();
|
|
|
|
$changesets = mpull($changesets, null, 'getID');
|
|
|
|
|
|
|
|
$changeset = idx($changesets, $id);
|
|
|
|
if (!$changeset) {
|
2013-09-27 03:45:04 +02:00
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
|
2014-05-25 17:59:31 +02:00
|
|
|
$vs_changeset = null;
|
|
|
|
if ($vs && ($vs != -1)) {
|
|
|
|
$vs_changeset = idx($changesets, $vs);
|
|
|
|
if (!$vs_changeset) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
}
|
2013-09-27 03:45:04 +02:00
|
|
|
|
2011-05-06 21:58:53 +02:00
|
|
|
$view = $request->getStr('view');
|
|
|
|
if ($view) {
|
2012-02-06 20:58:21 +01:00
|
|
|
$phid = idx($changeset->getMetadata(), "$view:binary-phid");
|
|
|
|
if ($phid) {
|
|
|
|
return id(new AphrontRedirectResponse())->setURI("/file/info/$phid/");
|
|
|
|
}
|
|
|
|
switch ($view) {
|
|
|
|
case 'new':
|
2012-02-15 02:00:20 +01:00
|
|
|
return $this->buildRawFileResponse($changeset, $is_new = true);
|
2012-02-06 20:58:21 +01:00
|
|
|
case 'old':
|
2014-05-25 17:59:31 +02:00
|
|
|
if ($vs_changeset) {
|
|
|
|
return $this->buildRawFileResponse($vs_changeset, $is_new = true);
|
2012-08-08 03:53:22 +02:00
|
|
|
}
|
2012-02-15 02:00:20 +01:00
|
|
|
return $this->buildRawFileResponse($changeset, $is_new = false);
|
2012-02-06 20:58:21 +01:00
|
|
|
default:
|
|
|
|
return new Aphront400Response();
|
2011-05-06 21:58:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-22 00:31:18 +02:00
|
|
|
$old = array();
|
|
|
|
$new = array();
|
2011-02-04 00:41:58 +01:00
|
|
|
if (!$vs) {
|
|
|
|
$right = $changeset;
|
|
|
|
$left = null;
|
|
|
|
|
|
|
|
$right_source = $right->getID();
|
|
|
|
$right_new = true;
|
|
|
|
$left_source = $right->getID();
|
|
|
|
$left_new = false;
|
2011-05-05 16:08:10 +02:00
|
|
|
|
|
|
|
$render_cache_key = $right->getID();
|
2015-04-22 00:31:18 +02:00
|
|
|
|
|
|
|
$old[] = $changeset;
|
|
|
|
$new[] = $changeset;
|
2011-02-04 00:41:58 +01:00
|
|
|
} else if ($vs == -1) {
|
|
|
|
$right = null;
|
|
|
|
$left = $changeset;
|
|
|
|
|
|
|
|
$right_source = $left->getID();
|
|
|
|
$right_new = false;
|
|
|
|
$left_source = $left->getID();
|
|
|
|
$left_new = true;
|
2011-05-05 16:08:10 +02:00
|
|
|
|
|
|
|
$render_cache_key = null;
|
2015-04-22 00:31:18 +02:00
|
|
|
|
|
|
|
$old[] = $changeset;
|
|
|
|
$new[] = $changeset;
|
2011-02-04 00:41:58 +01:00
|
|
|
} else {
|
|
|
|
$right = $changeset;
|
|
|
|
$left = $vs_changeset;
|
|
|
|
|
|
|
|
$right_source = $right->getID();
|
|
|
|
$right_new = true;
|
|
|
|
$left_source = $left->getID();
|
|
|
|
$left_new = true;
|
2011-05-05 16:08:10 +02:00
|
|
|
|
|
|
|
$render_cache_key = null;
|
2015-04-22 00:31:18 +02:00
|
|
|
|
|
|
|
$new[] = $left;
|
|
|
|
$new[] = $right;
|
2011-02-04 00:41:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($left) {
|
|
|
|
$left_data = $left->makeNewFile();
|
|
|
|
if ($right) {
|
|
|
|
$right_data = $right->makeNewFile();
|
|
|
|
} else {
|
|
|
|
$right_data = $left->makeOldFile();
|
|
|
|
}
|
|
|
|
|
2011-07-17 20:06:02 +02:00
|
|
|
$engine = new PhabricatorDifferenceEngine();
|
|
|
|
$synthetic = $engine->generateChangesetFromFileContent(
|
|
|
|
$left_data,
|
|
|
|
$right_data);
|
2011-02-04 00:41:58 +01:00
|
|
|
|
2012-06-15 09:53:26 +02:00
|
|
|
$choice = clone nonempty($left, $right);
|
2011-07-17 20:06:02 +02:00
|
|
|
$choice->attachHunks($synthetic->getHunks());
|
2011-02-04 00:41:58 +01:00
|
|
|
|
|
|
|
$changeset = $choice;
|
|
|
|
}
|
2011-01-25 00:52:35 +01:00
|
|
|
|
2015-08-10 23:16:36 +02:00
|
|
|
if ($left_new || $right_new) {
|
|
|
|
$diff_map = array();
|
|
|
|
if ($left) {
|
|
|
|
$diff_map[] = $left->getDiff();
|
|
|
|
}
|
|
|
|
if ($right) {
|
|
|
|
$diff_map[] = $right->getDiff();
|
|
|
|
}
|
|
|
|
$diff_map = mpull($diff_map, null, 'getPHID');
|
Show coverage information in Differential
Summary:
Render coverage information in the right gutter, if available.
We could render some kind of summary report deal too but this seems like a good
start.
Test Plan:
- Looked at diffs with coverage.
- Looked at diffs without coverage.
- Used inline comments, diff-of-diff, "show more", "show entire file", "show
generated file", "undo". Nothing seemed disrupted by the addition of a 5th
column.
Reviewers: btrahan, tuomaspelkonen, jungejason
Reviewed By: btrahan
CC: zeeg, aran, epriestley
Maniphest Tasks: T140
Differential Revision: https://secure.phabricator.com/D1527
2012-01-31 21:07:47 +01:00
|
|
|
|
2015-08-10 23:16:36 +02:00
|
|
|
$buildables = id(new HarbormasterBuildableQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withBuildablePHIDs(array_keys($diff_map))
|
|
|
|
->withManualBuildables(false)
|
|
|
|
->needBuilds(true)
|
|
|
|
->needTargets(true)
|
|
|
|
->execute();
|
|
|
|
$buildables = mpull($buildables, null, 'getBuildablePHID');
|
|
|
|
foreach ($diff_map as $diff_phid => $changeset_diff) {
|
|
|
|
$changeset_diff->attachBuildable(idx($buildables, $diff_phid));
|
Show coverage information in Differential
Summary:
Render coverage information in the right gutter, if available.
We could render some kind of summary report deal too but this seems like a good
start.
Test Plan:
- Looked at diffs with coverage.
- Looked at diffs without coverage.
- Used inline comments, diff-of-diff, "show more", "show entire file", "show
generated file", "undo". Nothing seemed disrupted by the addition of a 5th
column.
Reviewers: btrahan, tuomaspelkonen, jungejason
Reviewed By: btrahan
CC: zeeg, aran, epriestley
Maniphest Tasks: T140
Differential Revision: https://secure.phabricator.com/D1527
2012-01-31 21:07:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-10 23:16:36 +02:00
|
|
|
$coverage = null;
|
|
|
|
if ($right_new) {
|
|
|
|
$coverage = $this->loadCoverage($right);
|
|
|
|
}
|
|
|
|
|
2011-07-17 20:06:02 +02:00
|
|
|
$spec = $request->getStr('range');
|
|
|
|
list($range_s, $range_e, $mask) =
|
|
|
|
DifferentialChangesetParser::parseRangeSpecification($spec);
|
2011-02-01 05:38:13 +01:00
|
|
|
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
$parser = id(new DifferentialChangesetParser())
|
|
|
|
->setCoverage($coverage)
|
|
|
|
->setChangeset($changeset)
|
|
|
|
->setRenderingReference($rendering_reference)
|
|
|
|
->setRenderCacheKey($render_cache_key)
|
|
|
|
->setRightSideCommentMapping($right_source, $right_new)
|
|
|
|
->setLeftSideCommentMapping($left_source, $left_new);
|
2011-02-02 22:48:52 +01:00
|
|
|
|
Make "Show Context" persist rendering, whitespace, encoding, etc
Summary:
Ref T2009. Currently, we do not persist view parameters when making context rendering requests.
The big one is the renderer (1up vs 2up). This makes context on unified diffs come in with too many columns.
However, it impacts other parameters too. For example, at HEAD, if you change highlighting to "rainbow" and then load more context, the context uses the original highlighter instead of the rainbow highlighter.
This moves context loads into ChangesetViewManager, which maintains view parameters and can provide them correctly.
- This removes "ref"; it is no longer required, as the ChangesetViewManager tracks it.
- This removes URI management from `behavior-show-more`; it is no longer required, since the ChangesetViewManager knows how to render.
- This removes "whitespace" since this is handled properly by the view manager.
Test Plan:
- Used "Show Top" / "Show All" / "Show Bottom" in 1-up and 2-up views.
- Changed file highlighting to rainbow, loaded stuff, saw rainbow stick.
- Used "Show Entire File" in 1-up and 2-up views.
- Saw loading chrome.
- No loading chrome normally.
- Made inlines, verified `copyRows()` code runs.
- Poked around Diffusion -- it is missing some parameter handling, but works OK.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D11977
2015-03-05 23:03:00 +01:00
|
|
|
$parser->readParametersFromRequest($request);
|
2013-01-14 23:20:35 +01:00
|
|
|
|
2012-06-15 09:53:26 +02:00
|
|
|
if ($left && $right) {
|
|
|
|
$parser->setOriginals($left, $right);
|
|
|
|
}
|
|
|
|
|
2015-04-21 00:06:20 +02:00
|
|
|
$diff = $changeset->getDiff();
|
|
|
|
$revision_id = $diff->getRevisionID();
|
|
|
|
|
|
|
|
$can_mark = false;
|
|
|
|
$object_owner_phid = null;
|
2015-04-22 04:28:43 +02:00
|
|
|
$revision = null;
|
2015-04-21 00:06:20 +02:00
|
|
|
if ($revision_id) {
|
|
|
|
$revision = id(new DifferentialRevisionQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withIDs(array($revision_id))
|
|
|
|
->executeOne();
|
|
|
|
if ($revision) {
|
|
|
|
$can_mark = ($revision->getAuthorPHID() == $viewer->getPHID());
|
|
|
|
$object_owner_phid = $revision->getAuthorPHID();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-09 06:22:25 +02:00
|
|
|
// Load both left-side and right-side inline comments.
|
2015-04-21 00:06:20 +02:00
|
|
|
if ($revision) {
|
2015-04-22 00:31:18 +02:00
|
|
|
$query = id(new DifferentialInlineCommentQuery())
|
|
|
|
->setViewer($viewer)
|
Allow inline comments to be individually hidden
Summary:
Ref T7447. Implements per-viewer comment hiding. Once a comment is obsolete or uninteresting, you can hide it completely.
This is sticky per-user.
My hope is that this will strike a better balance between concerns than some of the other approaches (conservative porting, summarization, hide-all).
Specifically, this adds a new action here:
{F435621}
Clicking it completely collapses the comment into a small icon on the previous line, and saves the comment state as hidden for you:
{F435626}
You can click the icon to reveal all hidden comments below the line.
Test Plan:
- Hid comments.
- Showed comments.
- Created, edited, deleted and submitted comments.
- Used Diffusion comments (hiding is not implemented there yet, but I'd plan to bring it there eventually if it works out in Differential).
Reviewers: btrahan, chad
Reviewed By: btrahan
Subscribers: jparise, yelirekim, epriestley
Maniphest Tasks: T7447
Differential Revision: https://secure.phabricator.com/D13009
2015-05-27 19:28:38 +02:00
|
|
|
->needHidden(true)
|
2015-04-22 00:31:18 +02:00
|
|
|
->withRevisionPHIDs(array($revision->getPHID()));
|
|
|
|
$inlines = $query->execute();
|
2015-05-04 20:52:21 +02:00
|
|
|
$inlines = $query->adjustInlinesForChangesets(
|
|
|
|
$inlines,
|
|
|
|
$old,
|
|
|
|
$new,
|
|
|
|
$revision);
|
2015-04-21 00:06:20 +02:00
|
|
|
} else {
|
|
|
|
$inlines = array();
|
|
|
|
}
|
2011-05-09 06:22:25 +02:00
|
|
|
|
2012-01-04 18:10:37 +01:00
|
|
|
if ($left_new) {
|
|
|
|
$inlines = array_merge(
|
|
|
|
$inlines,
|
|
|
|
$this->buildLintInlineComments($left));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($right_new) {
|
|
|
|
$inlines = array_merge(
|
|
|
|
$inlines,
|
|
|
|
$this->buildLintInlineComments($right));
|
|
|
|
}
|
|
|
|
|
2011-02-02 01:42:36 +01:00
|
|
|
$phids = array();
|
|
|
|
foreach ($inlines as $inline) {
|
|
|
|
$parser->parseInlineComment($inline);
|
2012-01-04 18:10:37 +01:00
|
|
|
if ($inline->getAuthorPHID()) {
|
|
|
|
$phids[$inline->getAuthorPHID()] = true;
|
|
|
|
}
|
2011-02-02 01:42:36 +01:00
|
|
|
}
|
|
|
|
$phids = array_keys($phids);
|
2011-02-02 22:48:52 +01:00
|
|
|
|
2012-09-05 04:02:56 +02:00
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2011-02-02 01:42:36 +01:00
|
|
|
$parser->setHandles($handles);
|
2011-02-02 22:48:52 +01:00
|
|
|
|
2012-10-24 02:33:58 +02:00
|
|
|
$engine = new PhabricatorMarkupEngine();
|
Track a "Done" state on inline comments
Summary:
Ref T1460. This just barely works, but throwing it up in case any of it sounds mechanically crazy before we build integrations/UI/etc.
Specifically, these are the behaviors:
- You can mark your own draft comments as "done" before you submit them. The intent is to let reviewers mark their stuff advisory/minor/not-important before they submit it, to hint to authors that they don't expect the feedback to necessarily be addressed (maybe it's a joke, maybe it's just discussion, maybe it's "consider..").
- You can mark others' published comments as "done" if you're the revision/commit author. The intent is to keep this lightweight by not requiring an audit trail of who marked what done when. If anyone could mark anything done, we'd have to have some way to show who marked stuff.
- When you mark stuff done (or unmark it), it goes into a "draft" state, where you see the change but others don't see it yet. The intent is twofold:
- Be consistent with how inlines work.
- Allow us to publish a "epriestley updated this revision + epriestley marked 15 inlines as done" story later if we want. This seems more useful than publishing 15 "epriestley marked one thing as done" stories.
- The actual bit where done-ness publishes isn't implemented.
- UI is bare bones.
- No integration with the rest of the UI yet.
Test Plan: Clicked some checkboxes.
Reviewers: chad, btrahan
Reviewed By: btrahan
Subscribers: paulshen, chasemp, epriestley
Maniphest Tasks: T1460
Differential Revision: https://secure.phabricator.com/D12033
2015-03-10 02:41:47 +01:00
|
|
|
$engine->setViewer($viewer);
|
2012-10-24 02:33:58 +02:00
|
|
|
|
|
|
|
foreach ($inlines as $inline) {
|
|
|
|
$engine->addObject(
|
|
|
|
$inline,
|
|
|
|
PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
|
|
|
|
}
|
|
|
|
|
|
|
|
$engine->process();
|
2011-01-25 00:52:35 +01:00
|
|
|
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
$parser
|
Track a "Done" state on inline comments
Summary:
Ref T1460. This just barely works, but throwing it up in case any of it sounds mechanically crazy before we build integrations/UI/etc.
Specifically, these are the behaviors:
- You can mark your own draft comments as "done" before you submit them. The intent is to let reviewers mark their stuff advisory/minor/not-important before they submit it, to hint to authors that they don't expect the feedback to necessarily be addressed (maybe it's a joke, maybe it's just discussion, maybe it's "consider..").
- You can mark others' published comments as "done" if you're the revision/commit author. The intent is to keep this lightweight by not requiring an audit trail of who marked what done when. If anyone could mark anything done, we'd have to have some way to show who marked stuff.
- When you mark stuff done (or unmark it), it goes into a "draft" state, where you see the change but others don't see it yet. The intent is twofold:
- Be consistent with how inlines work.
- Allow us to publish a "epriestley updated this revision + epriestley marked 15 inlines as done" story later if we want. This seems more useful than publishing 15 "epriestley marked one thing as done" stories.
- The actual bit where done-ness publishes isn't implemented.
- UI is bare bones.
- No integration with the rest of the UI yet.
Test Plan: Clicked some checkboxes.
Reviewers: chad, btrahan
Reviewed By: btrahan
Subscribers: paulshen, chasemp, epriestley
Maniphest Tasks: T1460
Differential Revision: https://secure.phabricator.com/D12033
2015-03-10 02:41:47 +01:00
|
|
|
->setUser($viewer)
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
->setMarkupEngine($engine)
|
|
|
|
->setShowEditAndReplyLinks(true)
|
Track a "Done" state on inline comments
Summary:
Ref T1460. This just barely works, but throwing it up in case any of it sounds mechanically crazy before we build integrations/UI/etc.
Specifically, these are the behaviors:
- You can mark your own draft comments as "done" before you submit them. The intent is to let reviewers mark their stuff advisory/minor/not-important before they submit it, to hint to authors that they don't expect the feedback to necessarily be addressed (maybe it's a joke, maybe it's just discussion, maybe it's "consider..").
- You can mark others' published comments as "done" if you're the revision/commit author. The intent is to keep this lightweight by not requiring an audit trail of who marked what done when. If anyone could mark anything done, we'd have to have some way to show who marked stuff.
- When you mark stuff done (or unmark it), it goes into a "draft" state, where you see the change but others don't see it yet. The intent is twofold:
- Be consistent with how inlines work.
- Allow us to publish a "epriestley updated this revision + epriestley marked 15 inlines as done" story later if we want. This seems more useful than publishing 15 "epriestley marked one thing as done" stories.
- The actual bit where done-ness publishes isn't implemented.
- UI is bare bones.
- No integration with the rest of the UI yet.
Test Plan: Clicked some checkboxes.
Reviewers: chad, btrahan
Reviewed By: btrahan
Subscribers: paulshen, chasemp, epriestley
Maniphest Tasks: T1460
Differential Revision: https://secure.phabricator.com/D12033
2015-03-10 02:41:47 +01:00
|
|
|
->setCanMarkDone($can_mark)
|
2015-03-27 19:23:10 +01:00
|
|
|
->setObjectOwnerPHID($object_owner_phid)
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
->setRange($range_s, $range_e)
|
|
|
|
->setMask($mask);
|
2012-03-13 01:06:55 +01:00
|
|
|
|
2011-01-25 20:57:47 +01:00
|
|
|
if ($request->isAjax()) {
|
2015-08-11 00:24:15 +02:00
|
|
|
// NOTE: We must render the changeset before we render coverage
|
|
|
|
// information, since it builds some caches.
|
|
|
|
$rendered_changeset = $parser->renderChangeset();
|
|
|
|
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
$mcov = $parser->renderModifiedCoverage();
|
|
|
|
|
2015-08-11 00:24:15 +02:00
|
|
|
$coverage_data = array(
|
2012-03-13 05:39:05 +01:00
|
|
|
'differential-mcoverage-'.md5($changeset->getFilename()) => $mcov,
|
2012-03-13 01:06:55 +01:00
|
|
|
);
|
2012-03-13 05:39:05 +01:00
|
|
|
|
|
|
|
return id(new PhabricatorChangesetResponse())
|
2015-08-11 00:24:15 +02:00
|
|
|
->setRenderedChangeset($rendered_changeset)
|
|
|
|
->setCoverage($coverage_data)
|
2015-03-08 23:27:16 +01:00
|
|
|
->setUndoTemplates($parser->getRenderer()->renderUndoTemplates());
|
2011-01-25 20:57:47 +01:00
|
|
|
}
|
|
|
|
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
$detail = id(new DifferentialChangesetListView())
|
2015-03-05 23:01:15 +01:00
|
|
|
->setUser($this->getViewer())
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
->setChangesets(array($changeset))
|
|
|
|
->setVisibleChangesets(array($changeset))
|
|
|
|
->setRenderingReferences(array($rendering_reference))
|
Make "Show Context" persist rendering, whitespace, encoding, etc
Summary:
Ref T2009. Currently, we do not persist view parameters when making context rendering requests.
The big one is the renderer (1up vs 2up). This makes context on unified diffs come in with too many columns.
However, it impacts other parameters too. For example, at HEAD, if you change highlighting to "rainbow" and then load more context, the context uses the original highlighter instead of the rainbow highlighter.
This moves context loads into ChangesetViewManager, which maintains view parameters and can provide them correctly.
- This removes "ref"; it is no longer required, as the ChangesetViewManager tracks it.
- This removes URI management from `behavior-show-more`; it is no longer required, since the ChangesetViewManager knows how to render.
- This removes "whitespace" since this is handled properly by the view manager.
Test Plan:
- Used "Show Top" / "Show All" / "Show Bottom" in 1-up and 2-up views.
- Changed file highlighting to rainbow, loaded stuff, saw rainbow stick.
- Used "Show Entire File" in 1-up and 2-up views.
- Saw loading chrome.
- No loading chrome normally.
- Made inlines, verified `copyRows()` code runs.
- Poked around Diffusion -- it is missing some parameter handling, but works OK.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D11977
2015-03-05 23:03:00 +01:00
|
|
|
->setRenderURI('/differential/changeset/')
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
->setDiff($diff)
|
|
|
|
->setTitle(pht('Standalone View'))
|
2016-03-30 21:41:32 +02:00
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
->setParser($parser);
|
2011-05-06 21:58:53 +02:00
|
|
|
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
if ($revision_id) {
|
|
|
|
$detail->setInlineCommentControllerURI(
|
|
|
|
'/differential/comment/inline/edit/'.$revision_id.'/');
|
|
|
|
}
|
2011-01-25 00:52:35 +01:00
|
|
|
|
2014-05-25 17:59:31 +02:00
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
|
|
|
|
|
|
|
if ($revision_id) {
|
|
|
|
$crumbs->addTextCrumb('D'.$revision_id, '/D'.$revision_id);
|
|
|
|
}
|
|
|
|
|
Use ChangesetListView on Differential standalone view
Summary:
Fixes T4452. Ref T2009. There's a hierarchy of changeset rendering power: only low-level calls, use of ChangesetDetailView, then use of ChangesetListView (a list of DetailViews).
Prior to work here, the various changeset rendering controllers got their hands dirty to varying degrees, with some using only the lowest-level rendering pipeline:
- Phriction: no view (lowest level)
- Diffusion: DetailView
- Differential Changeset: DetailView
- Differential Diff: ListView
- Differential Revision: ListView
I brought Phriction up to use DetailView, but want to bring everything all the way up to use ListView. Each composition layer adds more features to diff browsing. In particular, this change enables "Highlight As", switching 1up vs 2up, adding inlines, etc., on the standalone view.
Test Plan:
- Viewed a changeset standalone. Could change highlighting, switch 1up vs 2up, add and edit inlines, etc.
- Viewed a revision; no behavioral changes.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T4452, T2009
Differential Revision: https://secure.phabricator.com/D12012
2015-03-08 12:10:11 +01:00
|
|
|
$diff_id = $diff->getID();
|
2014-05-25 17:59:31 +02:00
|
|
|
if ($diff_id) {
|
|
|
|
$crumbs->addTextCrumb(
|
|
|
|
pht('Diff %d', $diff_id),
|
|
|
|
$this->getApplicationURI('diff/'.$diff_id));
|
|
|
|
}
|
|
|
|
|
|
|
|
$crumbs->addTextCrumb($changeset->getDisplayFilename());
|
2016-03-30 21:41:32 +02:00
|
|
|
$crumbs->setBorder(true);
|
2014-05-25 17:59:31 +02:00
|
|
|
|
2016-03-30 21:41:32 +02:00
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader(pht('Changeset View'))
|
|
|
|
->setHeaderIcon('fa-gear');
|
|
|
|
|
|
|
|
$view = id(new PHUITwoColumnView())
|
|
|
|
->setHeader($header)
|
|
|
|
->setFooter($detail);
|
|
|
|
|
|
|
|
return $this->newPage()
|
|
|
|
->setTitle(pht('Changeset View'))
|
|
|
|
->setCrumbs($crumbs)
|
|
|
|
->appendChild($view);
|
2011-01-25 00:52:35 +01:00
|
|
|
}
|
|
|
|
|
2012-02-15 02:00:20 +01:00
|
|
|
private function buildRawFileResponse(
|
|
|
|
DifferentialChangeset $changeset,
|
|
|
|
$is_new) {
|
|
|
|
|
Track a "Done" state on inline comments
Summary:
Ref T1460. This just barely works, but throwing it up in case any of it sounds mechanically crazy before we build integrations/UI/etc.
Specifically, these are the behaviors:
- You can mark your own draft comments as "done" before you submit them. The intent is to let reviewers mark their stuff advisory/minor/not-important before they submit it, to hint to authors that they don't expect the feedback to necessarily be addressed (maybe it's a joke, maybe it's just discussion, maybe it's "consider..").
- You can mark others' published comments as "done" if you're the revision/commit author. The intent is to keep this lightweight by not requiring an audit trail of who marked what done when. If anyone could mark anything done, we'd have to have some way to show who marked stuff.
- When you mark stuff done (or unmark it), it goes into a "draft" state, where you see the change but others don't see it yet. The intent is twofold:
- Be consistent with how inlines work.
- Allow us to publish a "epriestley updated this revision + epriestley marked 15 inlines as done" story later if we want. This seems more useful than publishing 15 "epriestley marked one thing as done" stories.
- The actual bit where done-ness publishes isn't implemented.
- UI is bare bones.
- No integration with the rest of the UI yet.
Test Plan: Clicked some checkboxes.
Reviewers: chad, btrahan
Reviewed By: btrahan
Subscribers: paulshen, chasemp, epriestley
Maniphest Tasks: T1460
Differential Revision: https://secure.phabricator.com/D12033
2015-03-10 02:41:47 +01:00
|
|
|
$viewer = $this->getViewer();
|
2013-09-30 18:38:13 +02:00
|
|
|
|
2012-02-15 02:00:20 +01:00
|
|
|
if ($is_new) {
|
|
|
|
$key = 'raw:new:phid';
|
|
|
|
} else {
|
|
|
|
$key = 'raw:old:phid';
|
|
|
|
}
|
|
|
|
|
|
|
|
$metadata = $changeset->getMetadata();
|
|
|
|
|
|
|
|
$file = null;
|
|
|
|
$phid = idx($metadata, $key);
|
|
|
|
if ($phid) {
|
2013-09-30 18:38:13 +02:00
|
|
|
$file = id(new PhabricatorFileQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withPHIDs(array($phid))
|
|
|
|
->execute();
|
|
|
|
if ($file) {
|
|
|
|
$file = head($file);
|
|
|
|
}
|
2012-02-15 02:00:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!$file) {
|
|
|
|
// This is just building a cache of the changeset content in the file
|
|
|
|
// tool, and is safe to run on a read pathway.
|
|
|
|
$unguard = AphrontWriteGuard::beginScopedUnguardedWrites();
|
|
|
|
|
|
|
|
if ($is_new) {
|
|
|
|
$data = $changeset->makeNewFile();
|
|
|
|
} else {
|
|
|
|
$data = $changeset->makeOldFile();
|
|
|
|
}
|
|
|
|
|
2017-03-16 17:06:22 +01:00
|
|
|
$diff = $changeset->getDiff();
|
|
|
|
|
2012-02-15 02:00:20 +01:00
|
|
|
$file = PhabricatorFile::newFromFileData(
|
|
|
|
$data,
|
|
|
|
array(
|
2017-03-16 17:06:22 +01:00
|
|
|
'name' => $changeset->getFilename(),
|
2012-02-15 02:00:20 +01:00
|
|
|
'mime-type' => 'text/plain',
|
Make the Files "TTL" API more structured
Summary:
Ref T11357. When creating a file, callers can currently specify a `ttl`. However, it isn't unambiguous what you're supposed to pass, and some callers get it wrong.
For example, to mean "this file expires in 60 minutes", you might pass either of these:
- `time() + phutil_units('60 minutes in seconds')`
- `phutil_units('60 minutes in seconds')`
The former means "60 minutes from now". The latter means "1 AM, January 1, 1970". In practice, because the GC normally runs only once every four hours (at least, until recently), and all the bad TTLs are cases where files are normally accessed immediately, these 1970 TTLs didn't cause any real problems.
Split `ttl` into `ttl.relative` and `ttl.absolute`, and make sure the values are sane. Then correct all callers, and simplify out the `time()` calls where possible to make switching to `PhabricatorTime` easier.
Test Plan:
- Generated an SSH keypair.
- Viewed a changeset.
- Viewed a raw diff.
- Viewed a commit's file data.
- Viewed a temporary file's details, saw expiration date and relative time.
- Ran unit tests.
- (Didn't really test Phragment.)
Reviewers: chad
Reviewed By: chad
Subscribers: hach-que
Maniphest Tasks: T11357
Differential Revision: https://secure.phabricator.com/D17616
2017-04-04 20:01:43 +02:00
|
|
|
'ttl.relative' => phutil_units('24 hours in seconds'),
|
2017-03-16 17:06:22 +01:00
|
|
|
'viewPolicy' => PhabricatorPolicies::POLICY_NOONE,
|
2012-02-15 02:00:20 +01:00
|
|
|
));
|
|
|
|
|
2017-03-16 17:06:22 +01:00
|
|
|
$file->attachToObject($diff->getPHID());
|
|
|
|
|
2012-02-15 02:00:20 +01:00
|
|
|
$metadata[$key] = $file->getPHID();
|
|
|
|
$changeset->setMetadata($metadata);
|
|
|
|
$changeset->save();
|
|
|
|
|
|
|
|
unset($unguard);
|
|
|
|
}
|
|
|
|
|
2014-08-20 00:53:15 +02:00
|
|
|
return $file->getRedirectResponse();
|
2011-05-06 21:58:53 +02:00
|
|
|
}
|
2011-02-02 01:42:36 +01:00
|
|
|
|
2012-01-04 18:10:37 +01:00
|
|
|
private function buildLintInlineComments($changeset) {
|
2015-08-10 23:16:14 +02:00
|
|
|
$diff = $changeset->getDiff();
|
|
|
|
|
2015-08-10 23:16:36 +02:00
|
|
|
$target_phids = $diff->getBuildTargetPHIDs();
|
2015-08-10 23:16:14 +02:00
|
|
|
if (!$target_phids) {
|
|
|
|
return array();
|
|
|
|
}
|
2012-01-04 18:10:37 +01:00
|
|
|
|
2015-08-10 23:16:14 +02:00
|
|
|
$messages = id(new HarbormasterBuildLintMessage())->loadAllWhere(
|
|
|
|
'buildTargetPHID IN (%Ls) AND path = %s',
|
|
|
|
$target_phids,
|
|
|
|
$changeset->getFilename());
|
2012-01-04 18:10:37 +01:00
|
|
|
|
2015-08-10 23:16:14 +02:00
|
|
|
if (!$messages) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
$template = id(new DifferentialInlineComment())
|
|
|
|
->setChangesetID($changeset->getID())
|
|
|
|
->setIsNewFile(1)
|
|
|
|
->setLineLength(0);
|
|
|
|
|
|
|
|
$inlines = array();
|
|
|
|
foreach ($messages as $message) {
|
|
|
|
$description = $message->getProperty('description');
|
|
|
|
|
|
|
|
$inlines[] = id(clone $template)
|
|
|
|
->setSyntheticAuthor(pht('Lint: %s', $message->getName()))
|
|
|
|
->setLineNumber($message->getLine())
|
|
|
|
->setContent($description);
|
2012-01-04 18:10:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return $inlines;
|
|
|
|
}
|
|
|
|
|
2015-08-10 23:16:36 +02:00
|
|
|
private function loadCoverage(DifferentialChangeset $changeset) {
|
|
|
|
$target_phids = $changeset->getDiff()->getBuildTargetPHIDs();
|
|
|
|
if (!$target_phids) {
|
2016-01-18 16:10:00 +01:00
|
|
|
return null;
|
2015-08-10 23:16:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$unit = id(new HarbormasterBuildUnitMessage())->loadAllWhere(
|
|
|
|
'buildTargetPHID IN (%Ls)',
|
|
|
|
$target_phids);
|
|
|
|
|
2016-01-18 16:10:00 +01:00
|
|
|
if (!$unit) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-08-10 23:16:36 +02:00
|
|
|
$coverage = array();
|
|
|
|
foreach ($unit as $message) {
|
2016-01-18 16:10:00 +01:00
|
|
|
$test_coverage = $message->getProperty('coverage');
|
|
|
|
if ($test_coverage === null) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-08-10 23:16:36 +02:00
|
|
|
$coverage_data = idx($test_coverage, $changeset->getFileName());
|
|
|
|
if (!strlen($coverage_data)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$coverage[] = $coverage_data;
|
|
|
|
}
|
|
|
|
|
2016-01-18 16:10:00 +01:00
|
|
|
if (!$coverage) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-08-10 23:16:36 +02:00
|
|
|
return ArcanistUnitTestResult::mergeCoverage($coverage);
|
|
|
|
}
|
|
|
|
|
2011-01-25 00:52:35 +01:00
|
|
|
}
|