Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DiffusionCompareController extends DiffusionController {
|
|
|
|
|
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
$response = $this->loadDiffusionContext();
|
|
|
|
if ($response) {
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
if (!$repository->supportsBranchComparison()) {
|
|
|
|
return $this->newDialog()
|
|
|
|
->setTitle(pht('Not Supported'))
|
|
|
|
->appendParagraph(
|
|
|
|
pht(
|
|
|
|
'Branch comparison is not supported for this version control '.
|
|
|
|
'system.'))
|
|
|
|
->addCancelButton($this->getApplicationURI(), pht('Okay'));
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$head_ref = $request->getStr('head');
|
|
|
|
$against_ref = $request->getStr('against');
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$must_prompt = false;
|
|
|
|
if (!$request->isFormPost()) {
|
|
|
|
if (!strlen($head_ref)) {
|
|
|
|
$head_ref = $drequest->getSymbolicCommit();
|
|
|
|
if (!strlen($head_ref)) {
|
|
|
|
$head_ref = $drequest->getBranch();
|
|
|
|
}
|
|
|
|
}
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
if (!strlen($against_ref)) {
|
|
|
|
$default_branch = $repository->getDefaultBranch();
|
|
|
|
if ($default_branch != $head_ref) {
|
|
|
|
$against_ref = $default_branch;
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
// If we filled this in by default, we want to prompt the user to
|
|
|
|
// confirm that this is really what they want.
|
|
|
|
$must_prompt = true;
|
|
|
|
}
|
|
|
|
}
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
}
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$refs = $drequest->resolveRefs(
|
|
|
|
array_filter(
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
array(
|
2016-12-06 02:40:24 +01:00
|
|
|
$head_ref,
|
|
|
|
$against_ref,
|
|
|
|
)));
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$identical = false;
|
|
|
|
if ($head_ref === $against_ref) {
|
|
|
|
$identical = true;
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
} else {
|
2016-12-06 02:40:24 +01:00
|
|
|
if (count($refs) == 2) {
|
|
|
|
if ($refs[$head_ref] === $refs[$against_ref]) {
|
|
|
|
$identical = true;
|
|
|
|
}
|
|
|
|
}
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
}
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
if ($must_prompt || count($refs) != 2 || $identical) {
|
|
|
|
return $this->buildCompareDialog(
|
|
|
|
$head_ref,
|
|
|
|
$against_ref,
|
|
|
|
$refs,
|
|
|
|
$identical);
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
}
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
if ($request->isFormPost()) {
|
|
|
|
// Redirect to a stable URI that can be copy/pasted.
|
|
|
|
$compare_uri = $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'compare',
|
|
|
|
'head' => $head_ref,
|
|
|
|
'against' => $against_ref,
|
|
|
|
));
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
return id(new AphrontRedirectResponse())->setURI($compare_uri);
|
|
|
|
}
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$crumbs = $this->buildCrumbs(
|
|
|
|
array(
|
|
|
|
'view' => 'compare',
|
|
|
|
));
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
|
|
|
$pager = id(new PHUIPagerView())
|
|
|
|
->readFromRequest($request);
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$history = null;
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
try {
|
|
|
|
$history_results = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.historyquery',
|
|
|
|
array(
|
|
|
|
'commit' => $head_ref,
|
|
|
|
'against' => $against_ref,
|
|
|
|
'path' => $drequest->getPath(),
|
|
|
|
'offset' => $pager->getOffset(),
|
|
|
|
'limit' => $pager->getPageSize() + 1,
|
|
|
|
));
|
|
|
|
$history = DiffusionPathChange::newFromConduit(
|
|
|
|
$history_results['pathChanges']);
|
|
|
|
$history = $pager->sliceResults($history);
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$history_view = $this->newHistoryView(
|
|
|
|
$history_results,
|
|
|
|
$history,
|
|
|
|
$pager,
|
|
|
|
$head_ref,
|
|
|
|
$against_ref);
|
|
|
|
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
} catch (Exception $ex) {
|
2016-12-06 02:40:24 +01:00
|
|
|
if ($repository->isImporting()) {
|
|
|
|
$history_view = $this->renderStatusMessage(
|
|
|
|
pht('Still Importing...'),
|
|
|
|
pht(
|
|
|
|
'This repository is still importing. History is not yet '.
|
|
|
|
'available.'));
|
|
|
|
} else {
|
|
|
|
$history_view = $this->renderStatusMessage(
|
|
|
|
pht('Unable to Retrieve History'),
|
|
|
|
$ex->getMessage());
|
|
|
|
}
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
}
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader(
|
|
|
|
pht(
|
|
|
|
'Changes on %s but not %s',
|
|
|
|
phutil_tag('em', array(), $head_ref),
|
|
|
|
phutil_tag('em', array(), $against_ref)));
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$curtain = $this->buildCurtain($head_ref, $against_ref);
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$column_view = id(new PHUITwoColumnView())
|
|
|
|
->setHeader($header)
|
|
|
|
->setCurtain($curtain)
|
|
|
|
->setMainColumn(
|
|
|
|
array(
|
|
|
|
$history_view,
|
|
|
|
));
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
return $this->newPage()
|
|
|
|
->setTitle(
|
|
|
|
array(
|
|
|
|
$repository->getName(),
|
|
|
|
$repository->getDisplayName(),
|
|
|
|
))
|
|
|
|
->setCrumbs($crumbs)
|
|
|
|
->appendChild($column_view);
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
}
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
private function buildCompareDialog(
|
|
|
|
$head_ref,
|
|
|
|
$against_ref,
|
|
|
|
array $resolved,
|
|
|
|
$identical) {
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$viewer = $this->getViewer();
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
$request = $this->getRequest();
|
2016-12-06 02:40:24 +01:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$e_head = null;
|
|
|
|
$e_against = null;
|
|
|
|
$errors = array();
|
|
|
|
if ($request->isFormPost()) {
|
|
|
|
if (!strlen($head_ref)) {
|
|
|
|
$e_head = pht('Required');
|
|
|
|
$errors[] = pht(
|
|
|
|
'You must provide two different commits to compare.');
|
|
|
|
} else if (!isset($resolved[$head_ref])) {
|
|
|
|
$e_head = pht('Not Found');
|
|
|
|
$errors[] = pht(
|
|
|
|
'Commit "%s" is not a valid commit in this repository.',
|
|
|
|
$head_ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strlen($against_ref)) {
|
|
|
|
$e_against = pht('Required');
|
|
|
|
$errors[] = pht(
|
|
|
|
'You must provide two different commits to compare.');
|
|
|
|
} else if (!isset($resolved[$against_ref])) {
|
|
|
|
$e_against = pht('Not Found');
|
|
|
|
$errors[] = pht(
|
|
|
|
'Commit "%s" is not a valid commit in this repository.',
|
|
|
|
$against_ref);
|
|
|
|
}
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
if ($identical) {
|
|
|
|
$e_head = pht('Identical');
|
|
|
|
$e_against = pht('Identical');
|
|
|
|
$errors[] = pht(
|
|
|
|
'Both references identify the same commit. You can not compare a '.
|
|
|
|
'commit against itself.');
|
|
|
|
}
|
|
|
|
}
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$form = id(new AphrontFormView())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->appendControl(
|
|
|
|
id(new AphrontFormTextControl())
|
|
|
|
->setLabel(pht('Head'))
|
|
|
|
->setName('head')
|
|
|
|
->setError($e_head)
|
|
|
|
->setValue($head_ref))
|
|
|
|
->appendControl(
|
|
|
|
id(new AphrontFormTextControl())
|
|
|
|
->setLabel(pht('Against'))
|
|
|
|
->setName('against')
|
|
|
|
->setError($e_against)
|
|
|
|
->setValue($against_ref));
|
|
|
|
|
|
|
|
$cancel_uri = $repository->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'browse',
|
|
|
|
));
|
|
|
|
|
|
|
|
return $this->newDialog()
|
|
|
|
->setTitle(pht('Compare Against'))
|
|
|
|
->setWidth(AphrontDialogView::WIDTH_FORM)
|
|
|
|
->setErrors($errors)
|
|
|
|
->appendForm($form)
|
|
|
|
->addSubmitButton(pht('Compare'))
|
|
|
|
->addCancelButton($cancel_uri, pht('Cancel'));
|
|
|
|
}
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
private function buildCurtain($head_ref, $against_ref) {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
|
|
|
$curtain = $this->newCurtainView(null);
|
|
|
|
|
|
|
|
$reverse_uri = $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'compare',
|
|
|
|
'head' => $against_ref,
|
|
|
|
'against' => $head_ref,
|
|
|
|
));
|
|
|
|
|
|
|
|
$curtain->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
->setName(pht('Reverse Comparison'))
|
|
|
|
->setHref($reverse_uri)
|
2016-12-06 02:40:24 +01:00
|
|
|
->setIcon('fa-refresh'));
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$compare_uri = $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'compare',
|
|
|
|
'head' => $head_ref,
|
|
|
|
));
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
$curtain->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
|
|
|
->setName(pht('Compare Against...'))
|
|
|
|
->setIcon('fa-code-fork')
|
|
|
|
->setWorkflow(true)
|
|
|
|
->setHref($compare_uri));
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
// TODO: Provide a "Show Diff" action.
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
return $curtain;
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
}
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
private function newHistoryView(
|
|
|
|
array $results,
|
|
|
|
array $history,
|
|
|
|
PHUIPagerView $pager,
|
|
|
|
$head_ref,
|
|
|
|
$against_ref) {
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
|
|
|
$request = $this->getRequest();
|
2016-12-06 02:40:24 +01:00
|
|
|
$viewer = $this->getViewer();
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
|
|
|
if (!$history) {
|
|
|
|
return $this->renderStatusMessage(
|
2016-12-06 02:40:24 +01:00
|
|
|
pht('Up To Date'),
|
|
|
|
pht(
|
|
|
|
'There are no commits on %s that are not already on %s.',
|
|
|
|
phutil_tag('strong', array(), $head_ref),
|
|
|
|
phutil_tag('strong', array(), $against_ref)));
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$history_table = id(new DiffusionHistoryTableView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setDiffusionRequest($drequest)
|
|
|
|
->setHistory($history);
|
|
|
|
|
|
|
|
$history_table->loadRevisions();
|
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
if ($history) {
|
|
|
|
$history_table->setParents($results['parents']);
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
$history_table->setIsHead(!$pager->getOffset());
|
|
|
|
$history_table->setIsTail(!$pager->getHasMorePages());
|
|
|
|
}
|
|
|
|
|
|
|
|
$header = id(new PHUIHeaderView())
|
2016-12-06 02:40:24 +01:00
|
|
|
->setHeader(pht('Commits'));
|
|
|
|
|
|
|
|
$object_box = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
|
|
|
->setTable($history_table);
|
|
|
|
|
|
|
|
$pager_box = $this->renderTablePagerBox($pager);
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
|
2016-12-06 02:40:24 +01:00
|
|
|
return array(
|
|
|
|
$object_box,
|
|
|
|
$pager_box,
|
|
|
|
);
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-06 01:19:26 +01:00
|
|
|
}
|
|
|
|
}
|