Differential D16174 Diff 38912 src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
| Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | private function updateRepositoryInitStatus($code, $message = null) { | ||||
| $this->getRepository()->writeStatusMessage( | $this->getRepository()->writeStatusMessage( | ||||
| PhabricatorRepositoryStatusMessage::TYPE_INIT, | PhabricatorRepositoryStatusMessage::TYPE_INIT, | ||||
| $code, | $code, | ||||
| array( | array( | ||||
| 'message' => $message, | 'message' => $message, | ||||
| )); | )); | ||||
| } | } | ||||
| private function installHook($path) { | private function installHook($path, array $hook_argv = array()) { | ||||
| $this->log('%s', pht('Installing commit hook to "%s"...', $path)); | $this->log('%s', pht('Installing commit hook to "%s"...', $path)); | ||||
| $repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
| $identifier = $this->getHookContextIdentifier($repository); | $identifier = $this->getHookContextIdentifier($repository); | ||||
| $root = dirname(phutil_get_library_root('phabricator')); | $root = dirname(phutil_get_library_root('phabricator')); | ||||
| $bin = $root.'/bin/commit-hook'; | $bin = $root.'/bin/commit-hook'; | ||||
| $full_php_path = Filesystem::resolveBinary('php'); | $full_php_path = Filesystem::resolveBinary('php'); | ||||
| $cmd = csprintf( | $cmd = csprintf( | ||||
| 'exec %s -f %s -- %s "$@"', | 'exec %s -f %s -- %s %Ls "$@"', | ||||
| $full_php_path, | $full_php_path, | ||||
| $bin, | $bin, | ||||
| $identifier); | $identifier, | ||||
| $hook_argv); | |||||
| $hook = "#!/bin/sh\nexport TERM=dumb\n{$cmd}\n"; | $hook = "#!/bin/sh\nexport TERM=dumb\n{$cmd}\n"; | ||||
| Filesystem::writeFile($path, $hook); | Filesystem::writeFile($path, $hook); | ||||
| Filesystem::changePermissions($path, 0755); | Filesystem::changePermissions($path, 0755); | ||||
| } | } | ||||
| private function installHookDirectory($path) { | private function installHookDirectory($path) { | ||||
| ▲ Show 20 Lines • Show All 363 Lines • ▼ Show 20 Lines | /* -( Pulling Subversion Working Copies )---------------------------------- */ | ||||
| /** | /** | ||||
| * @task svn | * @task svn | ||||
| */ | */ | ||||
| private function installSubversionHook() { | private function installSubversionHook() { | ||||
| $repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
| $root = $repository->getLocalPath(); | $root = $repository->getLocalPath(); | ||||
| $path = '/hooks/pre-commit'; | $path = '/hooks/pre-commit'; | ||||
| $this->installHook($root.$path); | $this->installHook($root.$path); | ||||
| $revprop_path = '/hooks/pre-revprop-change'; | |||||
| $revprop_argv = array( | |||||
| '--hook-mode', | |||||
| 'svn-revprop', | |||||
| ); | |||||
| $this->installHook($root.$revprop_path, $revprop_argv); | |||||
| } | } | ||||
| } | } | ||||