diff --git a/resources/sql/patches/011.badcommit.sql b/resources/sql/patches/011.badcommit.sql
new file mode 100644
index 0000000000..4ec76332b0
--- /dev/null
+++ b/resources/sql/patches/011.badcommit.sql
@@ -0,0 +1,44 @@
+CREATE DATABASE phabricator_herald;
+
+CREATE TABLE phabricator_herald.herald_action (
+ id int unsigned not null auto_increment primary key,
+ ruleID int unsigned not null,
+ action varchar(255) not null,
+ target text not null
+);
+
+CREATE TABLE phabricator_herald.herald_rule (
+ id int unsigned not null auto_increment primary key,
+ name varchar(255) not null,
+ authorPHID varchar(64) binary not null,
+ contentType varchar(255) not null,
+ mustMatchAll bool not null,
+ configVersion int unsigned not null default '1',
+ dateCreated int unsigned not null,
+ dateModified int unsigned not null,
+ unique key (authorPHID, name)
+);
+
+CREATE TABLE phabricator_herald.herald_condition (
+ id int unsigned not null auto_increment primary key,
+ ruleID int unsigned not null,
+ fieldName varchar(255) not null,
+ fieldCondition varchar(255) not null,
+ value text not null
+);
+
+CREATE TABLE phabricator_herald.herald_transcript (
+ id int unsigned not null auto_increment primary key,
+ phid varchar(64) binary not null,
+ time int unsigned not null,
+ host varchar(255) not null,
+ psth varchar(255) not null,
+ duration float not null,
+ objectPHID varchar(64) binary not null,
+ dryRun bool not null,
+ objectTranscript longblob not null,
+ ruleTranscripts longblob not null,
+ conditionTranscripts longblob not null,
+ applyTranscripts longblob not null,
+ unique key (phid)
+);
\ No newline at end of file
diff --git a/src/applications/diffusion/controller/commit/DiffusionCommitController.php b/src/applications/diffusion/controller/commit/DiffusionCommitController.php
index 11a754c9ec..0c62de6e0a 100644
--- a/src/applications/diffusion/controller/commit/DiffusionCommitController.php
+++ b/src/applications/diffusion/controller/commit/DiffusionCommitController.php
@@ -30,6 +30,12 @@ class DiffusionCommitController extends DiffusionController {
$repository = $drequest->getRepository();
$commit = $drequest->loadCommit();
+
+ if (!$commit) {
+ // TODO: Make more user-friendly.
+ throw new Exception('This commit has not parsed yet.');
+ }
+
$commit_data = $drequest->loadCommitData();
require_celerity_resource('diffusion-commit-view-css');
@@ -70,19 +76,38 @@ class DiffusionCommitController extends DiffusionController {
$count = number_format(count($changes));
- $change_panel = new AphrontPanelView();
- $change_panel->setHeader("Changes ({$count})");
- $change_panel->appendChild($change_table);
+ $bad_commit = null;
+ if ($count == 0) {
+ $bad_commit = queryfx_one(
+ id(new PhabricatorRepository())->establishConnection('r'),
+ 'SELECT * FROM %T WHERE fullCommitName = %s',
+ PhabricatorRepository::TABLE_BADCOMMIT,
+ 'r'.$repository->getCallsign().$commit->getCommitIdentifier());
+ }
- $content[] = $change_panel;
+ if ($bad_commit) {
+ $error_panel = new AphrontErrorView();
+ $error_panel->setWidth(AphrontErrorView::WIDTH_WIDE);
+ $error_panel->setTitle('Bad Commit');
+ $error_panel->appendChild(
+ phutil_escape_html($bad_commit['description']));
+ $content[] = $error_panel;
+ } else {
+ $change_panel = new AphrontPanelView();
+ $change_panel->setHeader("Changes ({$count})");
+ $change_panel->appendChild($change_table);
- $change_list =
- '
'.
- '(list of changes goes here)'.
- '
';
+ $content[] = $change_panel;
- $content[] = $change_list;
+ $change_list =
+ ''.
+ '(list of changes goes here)'.
+ '
';
+
+ $content[] = $change_list;
+ }
return $this->buildStandardPageResponse(
$content,
diff --git a/src/applications/diffusion/controller/commit/__init__.php b/src/applications/diffusion/controller/commit/__init__.php
index 0abf62d921..6e629ab204 100644
--- a/src/applications/diffusion/controller/commit/__init__.php
+++ b/src/applications/diffusion/controller/commit/__init__.php
@@ -9,10 +9,14 @@
phutil_require_module('phabricator', 'applications/diffusion/controller/base');
phutil_require_module('phabricator', 'applications/diffusion/query/pathchange/base');
phutil_require_module('phabricator', 'applications/diffusion/view/commitchangetable');
+phutil_require_module('phabricator', 'applications/repository/storage/repository');
phutil_require_module('phabricator', 'infrastructure/celerity/api');
+phutil_require_module('phabricator', 'storage/queryfx');
+phutil_require_module('phabricator', 'view/form/error');
phutil_require_module('phabricator', 'view/layout/panel');
phutil_require_module('phutil', 'markup');
+phutil_require_module('phutil', 'utils');
phutil_require_source('DiffusionCommitController.php');
diff --git a/src/applications/repository/storage/repository/PhabricatorRepository.php b/src/applications/repository/storage/repository/PhabricatorRepository.php
index 8212b4bff0..ec2e0f1059 100644
--- a/src/applications/repository/storage/repository/PhabricatorRepository.php
+++ b/src/applications/repository/storage/repository/PhabricatorRepository.php
@@ -22,6 +22,7 @@ class PhabricatorRepository extends PhabricatorRepositoryDAO {
const TABLE_PATHCHANGE = 'repository_pathchange';
const TABLE_FILESYSTEM = 'repository_filesystem';
const TABLE_SUMMARY = 'repository_summary';
+ const TABLE_BADCOMMIT = 'repository_badcommit';
protected $phid;
protected $name;
diff --git a/src/applications/repository/worker/base/PhabricatorRepositoryCommitParserWorker.php b/src/applications/repository/worker/base/PhabricatorRepositoryCommitParserWorker.php
index 19346397b0..fc23edac0f 100644
--- a/src/applications/repository/worker/base/PhabricatorRepositoryCommitParserWorker.php
+++ b/src/applications/repository/worker/base/PhabricatorRepositoryCommitParserWorker.php
@@ -84,4 +84,16 @@ abstract class PhabricatorRepositoryCommitParserWorker
return new SimpleXMLElement($xml);
}
+ protected function isBadCommit($full_commit_name) {
+ $repository = new PhabricatorRepository();
+
+ $bad_commit = queryfx_one(
+ $repository->establishConnection('w'),
+ 'SELECT * FROM %T WHERE fullCommitName = %s',
+ PhabricatorRepository::TABLE_BADCOMMIT,
+ $full_commit_name);
+
+ return (bool)$bad_commit;
+ }
+
}
diff --git a/src/applications/repository/worker/base/__init__.php b/src/applications/repository/worker/base/__init__.php
index ff7c96282d..d78aaa2839 100644
--- a/src/applications/repository/worker/base/__init__.php
+++ b/src/applications/repository/worker/base/__init__.php
@@ -9,6 +9,7 @@
phutil_require_module('phabricator', 'applications/repository/storage/commit');
phutil_require_module('phabricator', 'applications/repository/storage/repository');
phutil_require_module('phabricator', 'infrastructure/daemon/workers/worker');
+phutil_require_module('phabricator', 'storage/queryfx');
phutil_require_module('phutil', 'future/exec');
phutil_require_module('phutil', 'parser/uri');
diff --git a/src/applications/repository/worker/commitchangeparser/git/PhabricatorRepositoryGitCommitChangeParserWorker.php b/src/applications/repository/worker/commitchangeparser/git/PhabricatorRepositoryGitCommitChangeParserWorker.php
index 8baa3d5f6d..b3d504f1a1 100644
--- a/src/applications/repository/worker/commitchangeparser/git/PhabricatorRepositoryGitCommitChangeParserWorker.php
+++ b/src/applications/repository/worker/commitchangeparser/git/PhabricatorRepositoryGitCommitChangeParserWorker.php
@@ -23,6 +23,13 @@ class PhabricatorRepositoryGitCommitChangeParserWorker
PhabricatorRepository $repository,
PhabricatorRepositoryCommit $commit) {
+ $full_name = 'r'.$repository->getCallsign().$commit->getCommitIdentifier();
+ echo "Parsing {$full_name}...\n";
+ if ($this->isBadCommit($full_name)) {
+ echo "This commit is marked bad!\n";
+ return;
+ }
+
$local_path = $repository->getDetail('local-path');
list($raw) = execx(
diff --git a/src/applications/repository/worker/commitchangeparser/svn/PhabricatorRepositorySvnCommitChangeParserWorker.php b/src/applications/repository/worker/commitchangeparser/svn/PhabricatorRepositorySvnCommitChangeParserWorker.php
index 8e55474a1d..fcbbf5b67c 100644
--- a/src/applications/repository/worker/commitchangeparser/svn/PhabricatorRepositorySvnCommitChangeParserWorker.php
+++ b/src/applications/repository/worker/commitchangeparser/svn/PhabricatorRepositorySvnCommitChangeParserWorker.php
@@ -44,7 +44,13 @@ class PhabricatorRepositorySvnCommitChangeParserWorker
$svn_commit = $commit->getCommitIdentifier();
$callsign = $repository->getCallsign();
- echo "Parsing r{$callsign}{$svn_commit}...\n";
+ $full_name = 'r'.$callsign.$svn_commit;
+ echo "Parsing {$full_name}...\n";
+
+ if ($this->isBadCommit($full_name)) {
+ echo "This commit is marked bad!\n";
+ return;
+ }
// Pull the top-level path changes out of "svn log". This is pretty
// straightforward; just parse the XML log.