Use one daemon to discover commits in all repositories, not one per repository
Summary:
See D2418. This merges the commit discovery daemon into the same single daemon, and applies all the same rules to it.
There are relatively few implementation changes, but a few things did change:
- I simplified/improved Mercurial importing, by finding full branch tip hashes with "--debug branches" and using "parents --template {node}" so we don't need to do separate "--debug id" calls.
- Added a new "--not" flag to exclude repositories, since I switched to real arg parsing anyway.
- I removed a web UI notification that you need to restart the daemons, this is no longer true.
- I added a web UI notification that no pull daemon is running on the machine.
NOTE: @makinde, this doesn't change anything from your perspective, but it something breaks this is the likely cause.
This implicitly resolves T792, because discovery no longer runs before pulling.
Test Plan:
- Swapped databases to a fresh install.
- Ran "pulllocal" in debug mode. Verified it correctly does nothing (fixed a minor issue with min() on empty array).
- Added an SVN repository. Verified it cloned and discovered correctly.
- Added a Mercurial repository. Verified it cloned and discovered correctly.
- Added a Git repository. Verified it cloned and discovered correctly.
- Ran with arguments to verify behaviors: "--not MTEST --not STEST", "P --no-discovery", "P".
Reviewers: btrahan, csilvers, Makinde
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T792
Differential Revision: https://secure.phabricator.com/D2430
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,8 +32,43 @@ abstract class PhabricatorRepositoryController extends PhabricatorController {
|
||||
$page->setGlyph("rX");
|
||||
$page->appendChild($view);
|
||||
|
||||
|
||||
$response = new AphrontWebpageResponse();
|
||||
return $response->setContent($page->render());
|
||||
}
|
||||
|
||||
private function isPullDaemonRunningOnThisMachine() {
|
||||
|
||||
// This is sort of hacky, but should probably work.
|
||||
|
||||
list($stdout) = execx('ps auxwww');
|
||||
return preg_match('/PhabricatorRepositoryPullLocalDaemon/', $stdout);
|
||||
}
|
||||
|
||||
protected function renderDaemonNotice() {
|
||||
$daemon_running = $this->isPullDaemonRunningOnThisMachine();
|
||||
if ($daemon_running) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$documentation = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => PhabricatorEnv::getDoclink(
|
||||
'article/Diffusion_User_Guide.html'),
|
||||
),
|
||||
'Diffusion User Guide');
|
||||
|
||||
$view = new AphrontErrorView();
|
||||
$view->setSeverity(AphrontErrorView::SEVERITY_WARNING);
|
||||
$view->setTitle('Repository Daemon Not Running');
|
||||
$view->appendChild(
|
||||
"<p>The repository daemon is not running on this machine. Without this ".
|
||||
"daemon, Phabricator will not be able to import or update repositories. ".
|
||||
"For instructions on starting the daemon, see ".
|
||||
"<strong>{$documentation}</strong>.</p>");
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
|
||||
phutil_require_module('phabricator', 'aphront/response/webpage');
|
||||
phutil_require_module('phabricator', 'applications/base/controller/base');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
|
||||
phutil_require_module('phutil', 'future/exec');
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ final class PhabricatorRepositoryEditController
|
||||
phutil_escape_html($name)));
|
||||
}
|
||||
|
||||
$nav->appendChild($this->renderDaemonNotice());
|
||||
|
||||
$this->sideNav = $nav;
|
||||
|
||||
switch ($this->view) {
|
||||
@@ -345,9 +347,7 @@ final class PhabricatorRepositoryEditController
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
|
||||
$error_view->setTitle('Changes Saved');
|
||||
$error_view->appendChild(
|
||||
'Tracking changes were saved. You may need to restart the daemon '.
|
||||
'before changes will take effect.');
|
||||
$error_view->appendChild('Tracking changes were saved.');
|
||||
} else if (!$repository->isTracked()) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setSeverity(AphrontErrorView::SEVERITY_WARNING);
|
||||
|
||||
@@ -157,6 +157,7 @@ final class PhabricatorRepositoryListController
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
array(
|
||||
$this->renderDaemonNotice(),
|
||||
$panel,
|
||||
$project_panel,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user