/** * Be careful due to a svn bug, this method will be call twice by svn server <= 1.7 * The first time with the new commit_message as expected * The second time with the OLD commit message (oh yeah baby!) * http://subversion.tigris.org/issues/show_bug.cgi?id=3085 * * @param String $repository_path * @param String $revision * @param String $user_name * @param String $old_commit_message */ public function update($repository_path, $revision, $user_name, $old_commit_message) { $project = $this->svn_hooks->getProjectFromRepositoryPath($repository_path); $user = $this->svn_hooks->getUserByName($user_name); $message = $this->svn_hooks->getMessageFromRevision($repository_path, $revision); $this->dao->updateCommitMessage($project->getID(), $revision, $message); $this->removePreviousCrossReferences($project, $revision, $old_commit_message); // Marvelous, extractCrossRef depends on globals group_id to find the group // when it's not explicit... yeah! $GLOBALS['group_id'] = $project->getID(); $this->reference_manager->extractCrossRef($message, $revision, ReferenceManager::REFERENCE_NATURE_SVNREVISION, $project->getID(), $user->getId()); }
/** * @param string $repository * * @return Project */ protected function getProjectFromRepositoryPath($repository) { return $this->svn_hooks->getProjectFromRepositoryPath($repository); }
* This file is a part of Tuleap. * * Tuleap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Tuleap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Tuleap. If not, see <http://www.gnu.org/licenses/>. */ try { require_once 'pre.php'; require_once 'common/reference/ReferenceManager.class.php'; require_once 'common/svn/SVN_Hooks.class.php'; $repository = $argv[1]; $txn = $argv[2]; $svn_hooks = new SVN_Hooks(ProjectManager::instance(), UserManager::instance()); $commit_message = $svn_hooks->getMessageFromTransaction($repository, $txn); $hook = new SVN_Hook_PreCommit($svn_hooks, new SVN_CommitMessageValidator(ReferenceManager::instance()), new SVN_Svnlook(), new SVN_Immutable_Tags_Handler(new SVN_Immutable_Tags_DAO()), new BackendLogger()); $hook->assertCommitMessageIsValid($repository, $commit_message); $hook->assertCommitToTagIsAllowed($repository, $txn); exit(0); } catch (Exception $exeption) { fwrite(STDERR, $exeption->getMessage()); exit(1); }