Page MenuHomePhabricator

D12698.id30548.diff
No OneTemporary

D12698.id30548.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -93,7 +93,6 @@
'ArcanistHgProxyClient' => 'hgdaemon/ArcanistHgProxyClient.php',
'ArcanistHgProxyServer' => 'hgdaemon/ArcanistHgProxyServer.php',
'ArcanistHgServerChannel' => 'hgdaemon/ArcanistHgServerChannel.php',
- 'ArcanistHookAPI' => 'repository/hookapi/ArcanistHookAPI.php',
'ArcanistInstallCertificateWorkflow' => 'workflow/ArcanistInstallCertificateWorkflow.php',
'ArcanistJSHintLinter' => 'lint/linter/ArcanistJSHintLinter.php',
'ArcanistJSHintLinterTestCase' => 'lint/linter/__tests__/ArcanistJSHintLinterTestCase.php',
@@ -172,7 +171,6 @@
'ArcanistStartWorkflow' => 'workflow/ArcanistStartWorkflow.php',
'ArcanistStopWorkflow' => 'workflow/ArcanistStopWorkflow.php',
'ArcanistSubversionAPI' => 'repository/api/ArcanistSubversionAPI.php',
- 'ArcanistSubversionHookAPI' => 'repository/hookapi/ArcanistSubversionHookAPI.php',
'ArcanistSummaryLintRenderer' => 'lint/renderer/ArcanistSummaryLintRenderer.php',
'ArcanistTasksWorkflow' => 'workflow/ArcanistTasksWorkflow.php',
'ArcanistTestCase' => 'infrastructure/testing/ArcanistTestCase.php',
@@ -353,7 +351,6 @@
'ArcanistStartWorkflow' => 'ArcanistPhrequentWorkflow',
'ArcanistStopWorkflow' => 'ArcanistPhrequentWorkflow',
'ArcanistSubversionAPI' => 'ArcanistRepositoryAPI',
- 'ArcanistSubversionHookAPI' => 'ArcanistHookAPI',
'ArcanistSummaryLintRenderer' => 'ArcanistLintRenderer',
'ArcanistTasksWorkflow' => 'ArcanistWorkflow',
'ArcanistTestCase' => 'ArcanistPhutilTestCase',
diff --git a/src/lint/engine/ArcanistLintEngine.php b/src/lint/engine/ArcanistLintEngine.php
--- a/src/lint/engine/ArcanistLintEngine.php
+++ b/src/lint/engine/ArcanistLintEngine.php
@@ -57,8 +57,6 @@
private $minimumSeverity = ArcanistLintSeverity::SEVERITY_DISABLED;
private $changedLines = array();
- private $commitHookMode = false;
- private $hookAPI;
private $enableAsyncLint = false;
private $postponedLinters = array();
@@ -115,20 +113,6 @@
return $this;
}
- final public function setCommitHookMode($mode) {
- $this->commitHookMode = $mode;
- return $this;
- }
-
- final public function setHookAPI(ArcanistHookAPI $hook_api) {
- $this->hookAPI = $hook_api;
- return $this;
- }
-
- final public function getHookAPI() {
- return $this->hookAPI;
- }
-
final public function setEnableAsyncLint($enable_async_lint) {
$this->enableAsyncLint = $enable_async_lint;
return $this;
@@ -140,41 +124,20 @@
final public function loadData($path) {
if (!isset($this->fileData[$path])) {
- if ($this->getCommitHookMode()) {
- $this->fileData[$path] = $this->getHookAPI()
- ->getCurrentFileData($path);
- } else {
$disk_path = $this->getFilePathOnDisk($path);
$this->fileData[$path] = Filesystem::readFile($disk_path);
- }
}
return $this->fileData[$path];
}
public function pathExists($path) {
- if ($this->getCommitHookMode()) {
- $file_data = $this->loadData($path);
- return ($file_data !== null);
- } else {
- $disk_path = $this->getFilePathOnDisk($path);
- return Filesystem::pathExists($disk_path);
- }
+ $disk_path = $this->getFilePathOnDisk($path);
+ return Filesystem::pathExists($disk_path);
}
final public function isDirectory($path) {
- if ($this->getCommitHookMode()) {
- // TODO: This won't get the right result in every case (we need more
- // metadata) but should almost always be correct.
- try {
- $this->loadData($path);
- return false;
- } catch (Exception $ex) {
- return true;
- }
- } else {
- $disk_path = $this->getFilePathOnDisk($path);
- return is_dir($disk_path);
- }
+ $disk_path = $this->getFilePathOnDisk($path);
+ return is_dir($disk_path);
}
final public function isBinaryFile($path) {
@@ -202,10 +165,6 @@
return $this;
}
- final public function getCommitHookMode() {
- return $this->commitHookMode;
- }
-
final public function run() {
$linters = $this->buildLinters();
if (!$linters) {
@@ -328,9 +287,6 @@
$cache_granularity,
$repository_version) {
- if ($this->commitHookMode) {
- return false;
- }
switch ($cache_granularity) {
case ArcanistLinter::GRANULARITY_FILE:
return true;
diff --git a/src/lint/linter/ArcanistLinter.php b/src/lint/linter/ArcanistLinter.php
--- a/src/lint/linter/ArcanistLinter.php
+++ b/src/lint/linter/ArcanistLinter.php
@@ -386,11 +386,10 @@
}
final protected function addLintMessage(ArcanistLintMessage $message) {
- if (!$this->getEngine()->getCommitHookMode()) {
- $root = $this->getEngine()->getWorkingCopy()->getProjectRoot();
- $path = Filesystem::resolvePath($message->getPath(), $root);
- $message->setPath(Filesystem::readablePath($path, $root));
- }
+ $root = $this->getEngine()->getWorkingCopy()->getProjectRoot();
+ $path = Filesystem::resolvePath($message->getPath(), $root);
+ $message->setPath(Filesystem::readablePath($path, $root));
+
$this->messages[] = $message;
return $message;
}
diff --git a/src/lint/linter/__tests__/ArcanistLinterTestCase.php b/src/lint/linter/__tests__/ArcanistLinterTestCase.php
--- a/src/lint/linter/__tests__/ArcanistLinterTestCase.php
+++ b/src/lint/linter/__tests__/ArcanistLinterTestCase.php
@@ -76,7 +76,6 @@
PhutilTypeSpec::checkMap(
$config,
array(
- 'hook' => 'optional bool',
'config' => 'optional map<string, wild>',
'path' => 'optional string',
'mode' => 'optional string',
@@ -114,8 +113,6 @@
$engine->setWorkingCopy($working_copy);
$engine->setConfigurationManager($configuration_manager);
- $engine->setCommitHookMode(idx($config, 'hook', false));
-
$path_name = idx($config, 'path', $path);
$engine->setPaths(array($path_name));
diff --git a/src/lint/linter/__tests__/spelling/spell.lint-test b/src/lint/linter/__tests__/spelling/spell.lint-test
--- a/src/lint/linter/__tests__/spelling/spell.lint-test
+++ b/src/lint/linter/__tests__/spelling/spell.lint-test
@@ -18,8 +18,3 @@
warning:9:15
warning:10:11
warning:11:12
-~~~~~~~~~~
-~~~~~~~~~~
-{
- "hook" : true
-}
diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php
--- a/src/repository/api/ArcanistGitAPI.php
+++ b/src/repository/api/ArcanistGitAPI.php
@@ -17,10 +17,6 @@
private $symbolicHeadCommit;
private $resolvedHeadCommit;
- public static function newHookAPI($root) {
- return new ArcanistGitAPI($root);
- }
-
protected function buildLocalFuture(array $argv) {
$argv[0] = 'git '.$argv[0];
@@ -704,15 +700,6 @@
return $this;
}
- public function getPreReceiveHookStatus($old_ref, $new_ref) {
- $options = $this->getDiffBaseOptions();
- list($stdout) = $this->execxLocal(
- "diff {$options} --raw %s %s --",
- $old_ref,
- $new_ref);
- return $this->parseGitStatus($stdout, $full = true);
- }
-
private function parseGitStatus($status, $full = false) {
static $flags = array(
'A' => self::FLAG_ADDED,
diff --git a/src/repository/hookapi/ArcanistHookAPI.php b/src/repository/hookapi/ArcanistHookAPI.php
deleted file mode 100644
--- a/src/repository/hookapi/ArcanistHookAPI.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-/**
- * API while running in the context of a commit hook.
- */
-abstract class ArcanistHookAPI {
- abstract public function getCurrentFileData($path);
- abstract public function getUpstreamFileData($path);
-}
diff --git a/src/repository/hookapi/ArcanistSubversionHookAPI.php b/src/repository/hookapi/ArcanistSubversionHookAPI.php
deleted file mode 100644
--- a/src/repository/hookapi/ArcanistSubversionHookAPI.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * Interfaces with Subversion while running as a commit hook.
- */
-final class ArcanistSubversionHookAPI extends ArcanistHookAPI {
-
- protected $root;
- protected $transaction;
- protected $repository;
-
- public function __construct($root, $transaction, $repository) {
- $this->root = $root;
- $this->transaction = $transaction;
- $this->repository = $repository;
- }
-
- public function getCurrentFileData($path) {
- list($err, $file) = exec_manual(
- 'svnlook cat --transaction %s %s %s',
- $this->transaction,
- $this->repository,
- $path);
-
- return ($err? null : $file);
- }
-
- public function getUpstreamFileData($path) {
- list($err, $file) = exec_manual(
- 'svnlook cat %s %s',
- $this->repository,
- $this->root."/$path");
- return ($err ? null : $file);
- }
-
-}

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 24, 9:37 PM (1 w, 1 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7706051
Default Alt Text
D12698.id30548.diff (8 KB)

Event Timeline